summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2025-03-24 17:20:07 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-03-27 11:19:04 +0000
commit32139d1420931540905c0f568b5ec3c6c6c4b871 (patch)
treee255ceca486df325723e7e0a1801099ccd20b267
parent862a1f290437b99b4373784ae3f8f0ec5daba739 (diff)
downloadpoky-32139d1420931540905c0f568b5ec3c6c6c4b871.tar.gz
attr: improve ptest packaging
As there's just a few test binaries in attr, instead of installing large chunks of the build tree we can install just those and use a boilerplate test runner. Also add a comment explaining why we have to sed the test suite if musl is used. (From OE-Core rev: baa1cbab47326656f762562303ddf4b0d9cc2b5c) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-support/attr/attr/run-ptest34
-rw-r--r--meta/recipes-support/attr/attr_2.5.2.bb40
2 files changed, 38 insertions, 36 deletions
diff --git a/meta/recipes-support/attr/attr/run-ptest b/meta/recipes-support/attr/attr/run-ptest
index 3e7a3a17a0..028671a9bd 100644
--- a/meta/recipes-support/attr/attr/run-ptest
+++ b/meta/recipes-support/attr/attr/run-ptest
@@ -1,10 +1,30 @@
1#!/bin/sh 1#!/bin/sh
2 2
3set +e 3failed=0
4make test-suite.log 4all=0
5exitcode=$? 5
6if [ $exitcode -ne 0 -a -e test-suite.log ]; then 6for f in *.test; do
7 cat test-suite.log 7 ./run $f
8fi 8 case "$?" in
9exit $exitcode 9 0)
10 echo "PASS: $f"
11 all=$((all + 1))
12 ;;
13 77)
14 echo "SKIP: $f"
15 ;;
16 *)
17 echo "FAIL: $f"
18 failed=$((failed + 1))
19 all=$((all + 1))
20 ;;
21 esac
22done
10 23
24if [ "$failed" -eq 0 ] ; then
25 echo "All $all tests passed"
26 exit 0
27else
28 echo "$failed of $all tests failed"
29 exit 1
30fi
diff --git a/meta/recipes-support/attr/attr_2.5.2.bb b/meta/recipes-support/attr/attr_2.5.2.bb
index b1a20930ed..390445b959 100644
--- a/meta/recipes-support/attr/attr_2.5.2.bb
+++ b/meta/recipes-support/attr/attr_2.5.2.bb
@@ -32,47 +32,29 @@ ALTERNATIVE:${PN} = "setfattr getfattr"
32ALTERNATIVE_TARGET[setfattr] = "${bindir}/setfattr" 32ALTERNATIVE_TARGET[setfattr] = "${bindir}/setfattr"
33ALTERNATIVE_TARGET[getfattr] = "${bindir}/getfattr" 33ALTERNATIVE_TARGET[getfattr] = "${bindir}/getfattr"
34 34
35PTEST_BUILD_HOST_FILES = "builddefs"
36PTEST_BUILD_HOST_PATTERN = "^RPM"
37
38do_install_ptest() { 35do_install_ptest() {
39 cp ${B}/Makefile ${D}${PTEST_PATH} 36 install -m755 ${S}/test/run ${S}/test/sort-getfattr-output ${D}${PTEST_PATH}/
40 sed -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \
41 -e 's|${DEBUG_PREFIX_MAP}||g' \
42 -e 's:${HOSTTOOLS_DIR}/::g' \
43 -e 's:${RECIPE_SYSROOT_NATIVE}::g' \
44 -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \
45 -i ${D}${PTEST_PATH}/Makefile
46
47 sed -e "s|^srcdir =.*|srcdir = .|" \
48 -e "s|^abs_srcdir =.*|abs_srcdir = .|" \
49 -e "s|^abs_top_srcdir =.*|abs_top_srcdir = ..|" \
50 -e "s|^Makefile:.*|Makefile:|" \
51 -e "/^TEST_LOG_DRIVER =/s|(top_srcdir)|(top_builddir)|" \
52 -i ${D}${PTEST_PATH}/Makefile
53 37
54 cp -rf ${S}/build-aux/ ${D}${PTEST_PATH} 38 for t in $(makefile-getvar ${S}/test/Makemodule.am TESTS); do
55 cp -rf ${S}/test/ ${D}${PTEST_PATH} 39 install -m644 ${S}/$t ${D}${PTEST_PATH}/
40 done
56} 41}
57 42
58do_install_ptest:append:libc-musl() { 43do_install_ptest:append:libc-musl() {
59 sed -i -e 's|f: Operation n|f: N|g' ${D}${PTEST_PATH}/test/attr.test 44 # With glibc strerror(ENOTSUP) is "Operation not supported" but
45 # musl is "Not supported".
46 # https://savannah.nongnu.org/bugs/?62370
47 sed -i -e 's|f: Operation not supported|f: Not supported|g' ${D}${PTEST_PATH}/attr.test
60} 48}
61 49
62RDEPENDS:${PN}-ptest = "attr \ 50RDEPENDS:${PN}-ptest = "attr \
63 bash \
64 coreutils \
65 perl-module-constant \
66 perl-module-filehandle \
67 perl-module-getopt-std \
68 perl-module-posix \
69 make \
70 perl \ 51 perl \
71 gawk \
72 perl-module-cwd \ 52 perl-module-cwd \
73 perl-module-file-basename \ 53 perl-module-file-basename \
74 perl-module-file-path \ 54 perl-module-file-path \
75 perl-module-file-spec \ 55 perl-module-filehandle \
56 perl-module-getopt-std \
57 perl-module-posix \
76 " 58 "
77 59
78BBCLASSEXTEND = "native nativesdk" 60BBCLASSEXTEND = "native nativesdk"