summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGyorgy Sarvari <skandigraun@gmail.com>2025-08-07 22:13:50 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-08-11 18:04:25 +0100
commit434d647efab2c9b32c311ac119543e42fca9a25e (patch)
tree817fd97a98f2a3cf78dfc856ba78eb2dc965ed28
parent45c3732ab47892d5444dbb18c97924ee16d09e3d (diff)
downloadpoky-434d647efab2c9b32c311ac119543e42fca9a25e.tar.gz
dpkg: add ptest support
Added it to slow tests, as it takes betwen 165 and 190 seconds on my machine to execute (qemux86-64 + kvm). The test folder's Makefile contains a list of passing, failing and manual tests. By default, only the expected-to-pass tests are executed by the Makefile (unless magic environment variable is set). The run-ptest script mimics the default behavior of executing the expected-to-pass tests, however they are executed one by one, instead of running them as one batch - that way it is easier to determine exactly which tests pass and which fail. One other thing that might worth a note, is that the tests folder that needs to be installed contains a number of subfolders called "DEBIAN". When packaging them at least with rpm, these folders are omitted from the package. However these are essential for the tests, as they contain test data. As a workaround, these folders are renamed during installation to DEBIAN-ptest, and before execution the run-ptest script restores their names. (From OE-Core rev: 02ed7fad85463840c46b6c0fa0ac9decef77c503) Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/conf/distro/include/ptest-packagelists.inc1
-rw-r--r--meta/recipes-devtools/dpkg/dpkg.inc16
-rw-r--r--meta/recipes-devtools/dpkg/dpkg/run-ptest35
-rw-r--r--meta/recipes-devtools/dpkg/dpkg_1.22.21.bb1
4 files changed, 52 insertions, 1 deletions
diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index 85c0350161..e3099439f4 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -101,6 +101,7 @@ PTESTS_SLOW = "\
101 curl \ 101 curl \
102 dbus \ 102 dbus \
103 dosfstools \ 103 dosfstools \
104 dpkg \
104 e2fsprogs \ 105 e2fsprogs \
105 elfutils \ 106 elfutils \
106 gettext \ 107 gettext \
diff --git a/meta/recipes-devtools/dpkg/dpkg.inc b/meta/recipes-devtools/dpkg/dpkg.inc
index dea1894a4c..b4e9667107 100644
--- a/meta/recipes-devtools/dpkg/dpkg.inc
+++ b/meta/recipes-devtools/dpkg/dpkg.inc
@@ -11,7 +11,7 @@ RDEPENDS:${PN}:class-native = ""
11 11
12UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>(\d+(\.\d+)+))" 12UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>(\d+(\.\d+)+))"
13 13
14inherit autotools gettext perlnative pkgconfig perl-version update-alternatives bash-completion 14inherit autotools gettext perlnative pkgconfig perl-version ptest update-alternatives bash-completion
15 15
16PERL:class-native = "${STAGING_BINDIR_NATIVE}/perl-native/perl" 16PERL:class-native = "${STAGING_BINDIR_NATIVE}/perl-native/perl"
17 17
@@ -56,6 +56,18 @@ do_install:append () {
56 fi 56 fi
57} 57}
58 58
59do_install_ptest () {
60 install -d ${D}${PTEST_PATH}/tests ${D}${PTEST_PATH}/src/sh
61 install -m 0755 ${S}/src/sh/dpkg-error.sh ${D}${PTEST_PATH}/src/sh/
62 cp --preserve=mode,timestamps -R ${S}/tests/* ${D}${PTEST_PATH}/tests
63
64 # The folder has a number of test folders called DEBIAN, but these are
65 # explicitly omitted from some packages, e.g. from rpm.
66 # However these are essential for the tests, so rename them to DEBIAN-ptest, and at runtime
67 # from the run-ptest script restore their names
68 find ${D}${PTEST_PATH}/tests -name DEBIAN -type d | xargs -n1 -I{} mv "{}" "{}-ptest"
69}
70
59PROV = "virtual/update-alternatives" 71PROV = "virtual/update-alternatives"
60PROV:class-native = "" 72PROV:class-native = ""
61PROV:class-nativesdk = "" 73PROV:class-nativesdk = ""
@@ -90,6 +102,8 @@ RDEPENDS:${PN}-perl += "perl-module-carp perl-module-constant \
90 perl-module-time-hires perl-module-time-piece \ 102 perl-module-time-hires perl-module-time-piece \
91 perl-module-xsloader" 103 perl-module-xsloader"
92 104
105RDEPENDS:${PN}-ptest += "make coreutils findutils"
106
93# Split out start-stop-daemon to its own package. Note that it 107# Split out start-stop-daemon to its own package. Note that it
94# is installed in a different directory than the one used for 108# is installed in a different directory than the one used for
95# the bitbake version. 109# the bitbake version.
diff --git a/meta/recipes-devtools/dpkg/dpkg/run-ptest b/meta/recipes-devtools/dpkg/dpkg/run-ptest
new file mode 100644
index 0000000000..8c4739ab66
--- /dev/null
+++ b/meta/recipes-devtools/dpkg/dpkg/run-ptest
@@ -0,0 +1,35 @@
1#!/bin/sh
2
3rm -f dpkg-test.log
4cd tests
5
6FAILED_TESTS=0
7ALL_TESTS=0
8
9# During installation the "DEBIAN" folders are renamed to avoid
10# problems with packaging. Restore their names here.
11for d in $(find . -name DEBIAN-ptest -type d); do
12 dname=$(dirname "$d")
13 mv ${d} ${dname}/DEBIAN
14done
15
16# This allows running tests that require root access (which we have)
17export DPKG_AS_ROOT=1
18
19for test in $(grep "TESTS_PASS +=" Makefile | cut -f3 -d" "); do
20 ALL_TESTS=$((ALL_TESTS + 1))
21 make ${test}-test >> ../dpkg-test.log 2>&1
22
23 if [ $? -eq 0 ]; then
24 echo PASS: $test
25 else
26 echo FAIL: $test
27 FAILED_TESTS=$((FAILED_TESTS + 1))
28 fi
29done
30
31if [ $FAILED_TESTS -eq 0 ]; then
32 echo All $ALL_TESTS tests passed
33else
34 echo $FAILED_TESTS of $ALL_TESTS tests failed
35fi
diff --git a/meta/recipes-devtools/dpkg/dpkg_1.22.21.bb b/meta/recipes-devtools/dpkg/dpkg_1.22.21.bb
index cc30b71109..d793c26d57 100644
--- a/meta/recipes-devtools/dpkg/dpkg_1.22.21.bb
+++ b/meta/recipes-devtools/dpkg/dpkg_1.22.21.bb
@@ -6,6 +6,7 @@ SRC_URI = "git://salsa.debian.org/dpkg-team/dpkg.git;protocol=https;branch=1.22.
6 file://remove-tar-no-timestamp.patch \ 6 file://remove-tar-no-timestamp.patch \
7 file://arch_pm.patch \ 7 file://arch_pm.patch \
8 file://add_armeb_triplet_entry.patch \ 8 file://add_armeb_triplet_entry.patch \
9 file://run-ptest \
9 file://0002-Adapt-to-linux-wrs-kernel-version-which-has-characte.patch \ 10 file://0002-Adapt-to-linux-wrs-kernel-version-which-has-characte.patch \
10 file://0001-script.c-avoid-use-of-chroot.patch \ 11 file://0001-script.c-avoid-use-of-chroot.patch \
11 file://0004-The-lutimes-function-doesn-t-work-properly-for-all-s.patch \ 12 file://0004-The-lutimes-function-doesn-t-work-properly-for-all-s.patch \