summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2023-05-04 16:28:15 -0700
committerSteve Sakoman <steve@sakoman.com>2023-05-31 04:08:11 -1000
commit721efdc519d45fa274e05274eca787b19528e2a4 (patch)
tree77decbd2d606ffbd23cea35f7a5ab54e326766c6
parent578715ebe692e0a2a6f1c27179fc29f4befaa690 (diff)
downloadpoky-721efdc519d45fa274e05274eca787b19528e2a4.tar.gz
cpio: Run ptests under ptest user
Running these tests under root user on musl works ok but it emits additional diagnostic cpio: dir: Cannot change ownership to uid 0, gid 0: Not supported Ideally its better to run this test suite under non-root user which is often how these are run. Moreover, tests work on musl as well. (From OE-Core rev: 22d19266269c28f596f031fcba8f2831c6465880) (From OE-Core rev: fd5bd772ab031606dcfe637fe7425b52b51365fa) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> (cherry picked from commit 587e007d9febfe92fef434dea984d31642bb23a1) Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rwxr-xr-x[-rw-r--r--]meta/recipes-extended/cpio/cpio-2.13/run-ptest9
-rw-r--r--meta/recipes-extended/cpio/cpio-2.13/test.sh10
-rw-r--r--meta/recipes-extended/cpio/cpio_2.13.bb18
3 files changed, 28 insertions, 9 deletions
diff --git a/meta/recipes-extended/cpio/cpio-2.13/run-ptest b/meta/recipes-extended/cpio/cpio-2.13/run-ptest
index f027574e86..f35a756d6b 100644..100755
--- a/meta/recipes-extended/cpio/cpio-2.13/run-ptest
+++ b/meta/recipes-extended/cpio/cpio-2.13/run-ptest
@@ -1,10 +1,3 @@
1#!/bin/sh 1#!/bin/sh
2 2
3# Define cpio test work dir 3su -c ./test.sh ptest
4WORKDIR=@PTEST_PATH@/tests/
5
6# Run test
7cd ${WORKDIR}
8./atconfig ./atlocal ./testsuite
9
10./testsuite 2>&1 | grep -E '[0-9]{1,3}: ' | sed -e 's/^.....//' -e '/[ok]$/s/^/PASS: /;/FAILED (.*)/s/^/FAIL: /;/skipped (.*)/s/^/SKIP: /;/expected failure/ s/^/PASS: /;/UNEXPECTED PASS/s/^/FAIL: /' -e 's/ok$//g' -e 's/FAILED.*//g' -e 's/skipped.*//g' -e 's/expected failure.*//g' -e 's/UNEXPECTED PASS.*//g'
diff --git a/meta/recipes-extended/cpio/cpio-2.13/test.sh b/meta/recipes-extended/cpio/cpio-2.13/test.sh
new file mode 100644
index 0000000000..f027574e86
--- /dev/null
+++ b/meta/recipes-extended/cpio/cpio-2.13/test.sh
@@ -0,0 +1,10 @@
1#!/bin/sh
2
3# Define cpio test work dir
4WORKDIR=@PTEST_PATH@/tests/
5
6# Run test
7cd ${WORKDIR}
8./atconfig ./atlocal ./testsuite
9
10./testsuite 2>&1 | grep -E '[0-9]{1,3}: ' | sed -e 's/^.....//' -e '/[ok]$/s/^/PASS: /;/FAILED (.*)/s/^/FAIL: /;/skipped (.*)/s/^/SKIP: /;/expected failure/ s/^/PASS: /;/UNEXPECTED PASS/s/^/FAIL: /' -e 's/ok$//g' -e 's/FAILED.*//g' -e 's/skipped.*//g' -e 's/expected failure.*//g' -e 's/UNEXPECTED PASS.*//g'
diff --git a/meta/recipes-extended/cpio/cpio_2.13.bb b/meta/recipes-extended/cpio/cpio_2.13.bb
index d48429b8ce..400c6b2f90 100644
--- a/meta/recipes-extended/cpio/cpio_2.13.bb
+++ b/meta/recipes-extended/cpio/cpio_2.13.bb
@@ -15,6 +15,7 @@ SRC_URI = "${GNU_MIRROR}/cpio/cpio-${PV}.tar.gz \
15 file://0001-Wrong-CRC-with-ASCII-CRC-for-large-files.patch \ 15 file://0001-Wrong-CRC-with-ASCII-CRC-for-large-files.patch \
16 file://0001-Fix-appending-to-archives-bigger-than-2G.patch \ 16 file://0001-Fix-appending-to-archives-bigger-than-2G.patch \
17 file://run-ptest \ 17 file://run-ptest \
18 file://test.sh \
18 " 19 "
19 20
20SRC_URI[md5sum] = "389c5452d667c23b5eceb206f5000810" 21SRC_URI[md5sum] = "389c5452d667c23b5eceb206f5000810"
@@ -58,9 +59,24 @@ do_install_ptest() {
58 install --mode=755 ${B}/tests/atlocal ${D}${PTEST_PATH}/tests/ 59 install --mode=755 ${B}/tests/atlocal ${D}${PTEST_PATH}/tests/
59 install --mode=755 ${B}/tests/genfile ${D}${PTEST_PATH}/tests/ 60 install --mode=755 ${B}/tests/genfile ${D}${PTEST_PATH}/tests/
60 install --mode=755 ${S}/tests/testsuite ${D}${PTEST_PATH}/tests/ 61 install --mode=755 ${S}/tests/testsuite ${D}${PTEST_PATH}/tests/
61 sed -i "s#@PTEST_PATH@#${PTEST_PATH}#g" ${D}${PTEST_PATH}/run-ptest 62 install --mode=755 ${WORKDIR}/test.sh ${D}${PTEST_PATH}/test.sh
63 sed -i "s#@PTEST_PATH@#${PTEST_PATH}#g" ${D}${PTEST_PATH}/test.sh
62} 64}
63 65
66# ptest.bbclass currently chowns the ptest directory explicitly, so we need to
67# change permission after that has happened so the ptest user can write a
68# temporary directory.
69do_install_ptest_base:append() {
70 chgrp -R ptest ${D}${PTEST_PATH}/
71 chmod -R g+w ${D}${PTEST_PATH}/
72}
73
74# The tests need to run as a non-root user, so pull in the ptest user
75DEPENDS:append:class-target = "${@bb.utils.contains('PTEST_ENABLED', '1', ' ptest-runner', '', d)}"
76PACKAGE_WRITE_DEPS += "ptest-runner"
77
78RDEPENDS:${PN}-ptest += "ptest-runner"
79
64PACKAGES =+ "${PN}-rmt" 80PACKAGES =+ "${PN}-rmt"
65 81
66FILES:${PN}-rmt = "${sbindir}/rmt*" 82FILES:${PN}-rmt = "${sbindir}/rmt*"