1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-09 05:29:32 +00:00

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>
This commit is contained in:
Ross Burton
2025-03-24 17:20:07 +00:00
committed by Richard Purdie
parent 862a1f2904
commit 32139d1420
2 changed files with 38 additions and 36 deletions
+27 -7
View File
@@ -1,10 +1,30 @@
#!/bin/sh
set +e
make test-suite.log
exitcode=$?
if [ $exitcode -ne 0 -a -e test-suite.log ]; then
cat test-suite.log
fi
exit $exitcode
failed=0
all=0
for f in *.test; do
./run $f
case "$?" in
0)
echo "PASS: $f"
all=$((all + 1))
;;
77)
echo "SKIP: $f"
;;
*)
echo "FAIL: $f"
failed=$((failed + 1))
all=$((all + 1))
;;
esac
done
if [ "$failed" -eq 0 ] ; then
echo "All $all tests passed"
exit 0
else
echo "$failed of $all tests failed"
exit 1
fi
+11 -29
View File
@@ -32,47 +32,29 @@ ALTERNATIVE:${PN} = "setfattr getfattr"
ALTERNATIVE_TARGET[setfattr] = "${bindir}/setfattr"
ALTERNATIVE_TARGET[getfattr] = "${bindir}/getfattr"
PTEST_BUILD_HOST_FILES = "builddefs"
PTEST_BUILD_HOST_PATTERN = "^RPM"
do_install_ptest() {
cp ${B}/Makefile ${D}${PTEST_PATH}
sed -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \
-e 's|${DEBUG_PREFIX_MAP}||g' \
-e 's:${HOSTTOOLS_DIR}/::g' \
-e 's:${RECIPE_SYSROOT_NATIVE}::g' \
-e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \
-i ${D}${PTEST_PATH}/Makefile
install -m755 ${S}/test/run ${S}/test/sort-getfattr-output ${D}${PTEST_PATH}/
sed -e "s|^srcdir =.*|srcdir = .|" \
-e "s|^abs_srcdir =.*|abs_srcdir = .|" \
-e "s|^abs_top_srcdir =.*|abs_top_srcdir = ..|" \
-e "s|^Makefile:.*|Makefile:|" \
-e "/^TEST_LOG_DRIVER =/s|(top_srcdir)|(top_builddir)|" \
-i ${D}${PTEST_PATH}/Makefile
cp -rf ${S}/build-aux/ ${D}${PTEST_PATH}
cp -rf ${S}/test/ ${D}${PTEST_PATH}
for t in $(makefile-getvar ${S}/test/Makemodule.am TESTS); do
install -m644 ${S}/$t ${D}${PTEST_PATH}/
done
}
do_install_ptest:append:libc-musl() {
sed -i -e 's|f: Operation n|f: N|g' ${D}${PTEST_PATH}/test/attr.test
# With glibc strerror(ENOTSUP) is "Operation not supported" but
# musl is "Not supported".
# https://savannah.nongnu.org/bugs/?62370
sed -i -e 's|f: Operation not supported|f: Not supported|g' ${D}${PTEST_PATH}/attr.test
}
RDEPENDS:${PN}-ptest = "attr \
bash \
coreutils \
perl-module-constant \
perl-module-filehandle \
perl-module-getopt-std \
perl-module-posix \
make \
perl \
gawk \
perl-module-cwd \
perl-module-file-basename \
perl-module-file-path \
perl-module-file-spec \
perl-module-filehandle \
perl-module-getopt-std \
perl-module-posix \
"
BBCLASSEXTEND = "native nativesdk"