diff mbox series

[1/2] quilt: rewrite ptest glue

Message ID 20230113165702.1312882-1-ross.burton@arm.com
State Accepted, archived
Commit 9a287b456347a2be44bff6f9e547795018fb729d
Headers show
Series [1/2] quilt: rewrite ptest glue | expand

Commit Message

Ross Burton Jan. 13, 2023, 4:57 p.m. UTC
The ptest glue was overly complex. Not as many files are needed to be
installed if we tell it to use the system's quilt tools, there's no
need for a custom Makefile just to set some environment variables, and
/usr/bin/ed doesn't appear to be used at all.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/recipes-devtools/quilt/quilt.inc       | 28 ++++++++-------------
 meta/recipes-devtools/quilt/quilt/Makefile  | 14 -----------
 meta/recipes-devtools/quilt/quilt/run-ptest |  7 +++---
 meta/recipes-devtools/quilt/quilt/test.sh   | 25 +++++++++++++++++-
 4 files changed, 38 insertions(+), 36 deletions(-)
 delete mode 100644 meta/recipes-devtools/quilt/quilt/Makefile
diff mbox series

Patch

diff --git a/meta/recipes-devtools/quilt/quilt.inc b/meta/recipes-devtools/quilt/quilt.inc
index ec69705093b..b4284dcafb3 100644
--- a/meta/recipes-devtools/quilt/quilt.inc
+++ b/meta/recipes-devtools/quilt/quilt.inc
@@ -9,7 +9,6 @@  LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
 
 SRC_URI = "${SAVANNAH_GNU_MIRROR}/quilt/quilt-${PV}.tar.gz \
         file://run-ptest \
-        file://Makefile \
         file://test.sh \
         file://0001-tests-Allow-different-output-from-mv.patch \
         file://fix-grep-3.8.patch \
@@ -61,17 +60,12 @@  do_install:append:class-native () {
     touch ${D}${sysconfdir}/quiltrc
 }
 
-do_compile_ptest() {
-	oe_runmake bin/patch-wrapper test/.depend
-}
-
 do_install_ptest() {
-	tar -c --exclude=\*.in bin/ | ( cd ${D}${PTEST_PATH} && tar -xf - )
-	tar -c --exclude=\*.in compat/ | ( cd ${D}${PTEST_PATH} && tar -xf - )
-	tar -c --exclude=\*.in quilt/ | ( cd ${D}${PTEST_PATH} && tar -xf - )
-	tar -c --exclude=mail.test --exclude=delete.test test/ | ( cd ${D}${PTEST_PATH} && tar -xf - && chmod 777 test)
-	cp ${WORKDIR}/Makefile ${D}${PTEST_PATH}
-	cp ${WORKDIR}/test.sh ${D}${PTEST_PATH}
+	install ${WORKDIR}/test.sh ${D}${PTEST_PATH}
+    mkdir ${D}${PTEST_PATH}/test
+    install ${S}/test/* ${D}${PTEST_PATH}/test
+    # mail needs a MTA, and the patch-wrapper is disabled
+    rm -f ${D}${PTEST_PATH}/test/mail.test ${D}${PTEST_PATH}/test/patch-wrapper.test
 }
 
 PACKAGES += "guards guards-doc"
@@ -85,9 +79,9 @@  FILES:guards-doc = "${mandir}/man1/guards.1"
 RDEPENDS:${PN} = "bash patch diffstat bzip2 util-linux less"
 RDEPENDS:${PN}:class-native = "diffstat-native patch-native bzip2-native"
 
-RDEPENDS:${PN}-ptest = "make file sed gawk diffutils findutils ed perl \
-                        perl-module-filehandle perl-module-getopt-std \
-                        perl-module-posix perl-module-file-temp \
-                        perl-module-text-parsewords perl-module-overloading \
-                        bash util-linux-getopt patch \
-                       "
+RDEPENDS:${PN}-ptest += "file sed gawk diffutils findutils ed perl \
+                         perl-module-filehandle perl-module-getopt-std \
+                         perl-module-posix perl-module-file-temp \
+                         perl-module-text-parsewords perl-module-overloading \
+                         bash util-linux-getopt \
+                        "
diff --git a/meta/recipes-devtools/quilt/quilt/Makefile b/meta/recipes-devtools/quilt/quilt/Makefile
deleted file mode 100644
index 1f6cd2479ca..00000000000
--- a/meta/recipes-devtools/quilt/quilt/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@ 
-PATH :=         $(CURDIR)/bin:$(CURDIR)/compat:$(PATH)
-QUILT_DIR :=    $(CURDIR)/quilt
-QUILTRC :=      $(CURDIR)/test/test.quiltrc
-export QUILT_DIR QUILTRC
-CHECK_ENV := P=patches/; _P=../patches/; export P _P;
-CHECK_ENV += QUILT_PC=.pc; export QUILT_PC
--include test/.depend
-
-check-% : test/%.test
-	@LANG=C; LC_ALL=C; \
-	export LANG LC_ALL; \
-	$(CHECK_ENV); \
-	cd $(<D); \
-	./run -q $(<F)
diff --git a/meta/recipes-devtools/quilt/quilt/run-ptest b/meta/recipes-devtools/quilt/quilt/run-ptest
index d2de5c855a3..322508cbe25 100755
--- a/meta/recipes-devtools/quilt/quilt/run-ptest
+++ b/meta/recipes-devtools/quilt/quilt/run-ptest
@@ -1,8 +1,7 @@ 
 #!/bin/sh
 
-THIS_SH=/bin/sh
-ln -sf /bin/ed /usr/bin/ed
 /usr/sbin/adduser --disabled-password --gecos "" quilttest
-su -c "${THIS_SH} ./test.sh" quilttest
+
+su -c ./test.sh quilttest
+
 /usr/sbin/deluser quilttest
-rm -f /usr/bin/ed
diff --git a/meta/recipes-devtools/quilt/quilt/test.sh b/meta/recipes-devtools/quilt/quilt/test.sh
index 6563e4a2fb0..7dac8f44231 100755
--- a/meta/recipes-devtools/quilt/quilt/test.sh
+++ b/meta/recipes-devtools/quilt/quilt/test.sh
@@ -1 +1,24 @@ 
-for i in `ls test/*.test |awk -F. '{print $1}' |awk -F/ '{print $2}'`; do make check-$i; if [ $? -eq 0 ]; then echo PASS: $i.test; else echo FAIL: $i.test; fi; done
+#! /bin/sh
+
+set -e -u
+
+export LANG=C
+export LC_ALL=C
+export P=patches/
+export _P=../patches/
+export QUILTRC=$(pwd)/test/test.quiltrc
+export QUILT_PC=.pc
+export QUILT_DIR=/usr/share/quilt/
+
+# Specify on the commandline, else runs all of the tests
+TESTS=${@:-test/*.test}
+
+for FILENAME in $TESTS; do
+    TESTNAME=$(basename $FILENAME .test)
+    ./test/run $FILENAME
+    if [ $? -eq 0 ];
+        then echo PASS: $TESTNAME
+    else
+        echo FAIL: $TESTNAME
+    fi
+done