Skip to contentSkip to conversation

Add ptest for less

PATCH New Julien Stephan 1 participant 3 messages Jul 6, 2023

lore
Share & tools
lore
#0 lore raw

v4 cover Add ptest for less

Hi all,

This series is adding ptest support for less.

As of today, release tarballs are fetched from
http://www.greenwoodsoftware.com/ but the less test code is not bundled within these releases. A github issue has been opened asking for maintainer to add the test code into it [1].

So before test code gets bundled into the release tarballs, switch to github URI.

Here is the output when running the ptest on the target:

FAIL: chinese1.lt
PASS: colorbars.lt
PASS: github216.lt
PASS: github265.lt
PASS: github329.lt
PASS: hdr-unicode1.lt
PASS: hdr-unicode.lt
PASS: proc-special.lt
PASS: seq200.lt
PASS: table-50x200.lt
FAIL: utf8-2.txt.lt
PASS: version.c.lt
============================================================================
Testsuite summary for less
============================================================================
# TOTAL: 12
# PASS: 10
# FAIL: 2
============================================================================

I am building a core-image-minimal image with poky DISTRO and run it into qemu. I have 2 FAIL. All tests PASS on my computer.
I suspect a locale issue here but I may need some help on this.

EDIT: added locale-base-en-us in v3 to fix these issues

I opened a pull request on less for Makefile modification [2]

And I also opened a github issue [3] to ask a reformating of the less test summary to follow Automake simple test format to simplify the run-ptest script.

My branch is available on poky-contrib repository [4]

[YOCTO #15073]

Best
Julien

[1]: https://github.com/gwsw/less/issues/344
[2]: https://github.com/gwsw/less/pull/398
[3]: https://github.com/gwsw/less/issues/399
[4]: https://git.yoctoproject.org/poky-contrib/log/?h=jstephan/add-ptest-for-less

v1 can be found here: https://lists.openembedded.org/g/openembedded-core/message/183894
v2 can be found here: https://lists.openembedded.org/g/openembedded-core/message/183919
v3 can be found here: https://lists.openembedded.org/g/openembedded-core/message/183931

Changes in v4:
- add verbose output on failure

Changes in v3:
- add locale-base-en-us in RDEPENDS:${PN}-ptest to fix the failing test

Changes in v2:
- split commit in two: one for switching to github and one to add the ptest support

Julien Stephan (2):
less: switch to github URI
less: add ptest support

 .../distro/include/ptest-packagelists.inc     |  1 +
 ...akefile-allow-CFLAGS-to-be-overitten.patch | 28 +++++++++++++
 ...esstest-Makefile-add-LDFLAGS-support.patch | 41 +++++++++++++++++++
 meta/recipes-extended/less/files/run-ptest    | 26 ++++++++++++
 meta/recipes-extended/less/less_633.bb        | 37 ++++++++++++++---
 5 files changed, 128 insertions(+), 5 deletions(-)
 create mode 100644 meta/recipes-extended/less/files/0001-lesstest-Makefile-allow-CFLAGS-to-be-overitten.patch
 create mode 100644 meta/recipes-extended/less/files/0002-lesstest-Makefile-add-LDFLAGS-support.patch
 create mode 100644 meta/recipes-extended/less/files/run-ptest
Signature · 1 line
2.41.0
#1 lore raw

PATCH v4 1/2 less: switch to github URI

as of today, release tarballs are fetched from [1] but the less test code is not bundled within these releases. A github issue has been opened asking for maintainer to bundle it [2]

In order to add ptest for less, switch to github URI. This commit can be reverted if release tarballs from [1] bundle the test code in the future.

[YOCTO #15073]

[1]: http://www.greenwoodsoftware.com/
[2]: https://github.com/gwsw/less/issues/344

---
 meta/recipes-extended/less/less_633.bb | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
meta/recipes-extended/less/less_633.bb +12 -5
index 2defb5ccb7a..e6535d16a78 100644
@@ -23,16 +23,23 @@ LICENSE = "GPL-3.0-or-later | BSD-2-Clause"
 LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464 \
                     file://LICENSE;md5=1b2446f5c8632bf63a97d7a49750e1c6 \
                     "
-DEPENDS = "ncurses"
+DEPENDS = "ncurses groff-native"
 
-SRC_URI = "http://www.greenwoodsoftware.com/${BPN}/${BPN}-${PV}.tar.gz"
+SRC_URI = "git://github.com/gwsw/less.git;protocol=https;branch=master"
+SRCREV = "0d7ca880375bde651313f03f7115d26921b43722"
 
-SRC_URI[sha256sum] = "2f201d64b828b88af36dfe6cfdba3e0819ece2e446ebe6224813209aaefed04f"
-
-UPSTREAM_CHECK_URI = "http://www.greenwoodsoftware.com/less/download.html"
+S = "${WORKDIR}/git"
 
 inherit autotools update-alternatives
 
+# According to the README of the project when getting code from git we should run
+# the following command before running the configure script
+do_configure:prepend () {
+        cd ${S}
+        make -f Makefile.aut distfiles
+        cd -
+}
+
 do_install () {
         oe_runmake 'bindir=${D}${bindir}' 'mandir=${D}${mandir}' install
 }
Signature · 1 line
2.41.0
#2 lore raw

PATCH v4 2/2 less: add ptest support

In reply to Julien Stephan

add ptest support for less

[YOCTO #15073]

---
 .../distro/include/ptest-packagelists.inc     |  1 +
 ...akefile-allow-CFLAGS-to-be-overitten.patch | 28 +++++++++++++
 ...esstest-Makefile-add-LDFLAGS-support.patch | 41 +++++++++++++++++++
 meta/recipes-extended/less/files/run-ptest    | 26 ++++++++++++
 meta/recipes-extended/less/less_633.bb        | 24 ++++++++++-
 5 files changed, 118 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-extended/less/files/0001-lesstest-Makefile-allow-CFLAGS-to-be-overitten.patch
 create mode 100644 meta/recipes-extended/less/files/0002-lesstest-Makefile-add-LDFLAGS-support.patch
 create mode 100644 meta/recipes-extended/less/files/run-ptest
meta/conf/distro/include/ptest-packagelists.inc +1 -0
index da9153b998c..6f4b6912013 100644
@@ -95,6 +95,7 @@ PTESTS_SLOW = "\
     glib-2.0 \
     gnutls \
     gstreamer1.0 \
+    less \
     libevent \
     libgcrypt \
     libmodule-build-perl \
meta/recipes-extended/less/files/0001-lesstest-Makefile-allow-CFLAGS-to-be-overitten.patch new file +28 -0
new file mode 100644
index 00000000000..f7f6efb7718
@@ -0,0 +1,28 @@
+From 6499e388a0af8c4531f845ccc58f30ffb1a03c51 Mon Sep 17 00:00:00 2001
+From: Julien Stephan <[email protected]>
+Date: Tue, 4 Jul 2023 11:43:14 +0200
+Subject: [PATCH 1/2] lesstest: Makefile: allow CFLAGS to be overitten
+
+use weak assignment for CFLAGS so user can set its CFLAGS and still have
+a sane default value
+
+Upstream-Status: Submitted [https://github.com/gwsw/less/pull/398]
+
+Signed-off-by: Julien Stephan <[email protected]>
+---
+ lesstest/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lesstest/Makefile b/lesstest/Makefile
+index 387b7ae..a231900 100644
+--- a/lesstest/Makefile
++++ b/lesstest/Makefile
+@@ -1,5 +1,5 @@
+ CC ?= gcc
+-CFLAGS = -Wall -O2
++CFLAGS ?= -Wall -O2
+ TERMLIB = -lncurses
+
+ all: lesstest lt_screen 
+--
+2.41.0
meta/recipes-extended/less/files/0002-lesstest-Makefile-add-LDFLAGS-support.patch new file +41 -0

41 lines not on this page · raw message

meta/recipes-extended/less/files/run-ptest new file +26 -0
new file mode 100644
index 00000000000..b3245ac825f
@@ -0,0 +1,26 @@
+#! /bin/sh
+
+fail=0
+pass=0
+
+for i in lt/*; do
+	output=$(./runtest -l /usr/bin/less -t lesstest -O d $i)
+
+	if [[ $? -eq 0 ]]; then
+		echo "PASS: $(basename $i)"
+		pass=$((pass+1))
+	else
+		echo "$output"
+		echo "FAIL: $(basename $i)"
+		fail=$((fail+1))
+	fi
+done
+
+echo "============================================================================"
+echo Testsuite summary for less
+echo "============================================================================"
+echo "# TOTAL: $((fail+pass))"
+echo "# PASS: $pass"
+echo "# FAIL: $fail"
+echo "============================================================================"
+
meta/recipes-extended/less/less_633.bb +22 -2
index e6535d16a78..92fa61a50a9 100644
@@ -25,12 +25,18 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464 \
                     "
 DEPENDS = "ncurses groff-native"
 
-SRC_URI = "git://github.com/gwsw/less.git;protocol=https;branch=master"
+SRC_URI = "git://github.com/gwsw/less.git;protocol=https;branch=master \
+           file://run-ptest \
+           file://0001-lesstest-Makefile-allow-CFLAGS-to-be-overitten.patch \
+           file://0002-lesstest-Makefile-add-LDFLAGS-support.patch \
+           "
 SRCREV = "0d7ca880375bde651313f03f7115d26921b43722"
 
 S = "${WORKDIR}/git"
 
-inherit autotools update-alternatives
+inherit autotools ptest update-alternatives
+
+EXTRA_OEMAKE += " LESSTEST=1"
 
 # According to the README of the project when getting code from git we should run
 # the following command before running the configure script
@@ -40,9 +46,23 @@ do_configure:prepend () {
         cd -
 }
 
+do_compile_ptest () {
+        cd ${S}/lesstest
+        oe_runmake
+}
+
 do_install () {
         oe_runmake 'bindir=${D}${bindir}' 'mandir=${D}${mandir}' install
 }
 
+do_install_ptest () {
+        cp ${S}/lesstest/lesstest ${D}${PTEST_PATH}
+        cp ${S}/lesstest/runtest ${D}${PTEST_PATH}
+        cp ${S}/lesstest/lt_screen ${D}${PTEST_PATH}
+        cp -r ${S}/lesstest/lt ${D}${PTEST_PATH}
+}
+
+RDEPENDS:${PN}-ptest:append = " perl-module-getopt-std perl-module-cwd locale-base-en-us"
+
 ALTERNATIVE:${PN} = "less"
 ALTERNATIVE_PRIORITY = "100"
Signature · 1 line
2.41.0