Skip to content

Commit baa1cba

Browse files
rossburtonrpurdie
authored andcommitted
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. Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
1 parent a6f29ce commit baa1cba

File tree

2 files changed

+38
-36
lines changed

2 files changed

+38
-36
lines changed
Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
11
#!/bin/sh
22

3-
set +e
4-
make test-suite.log
5-
exitcode=$?
6-
if [ $exitcode -ne 0 -a -e test-suite.log ]; then
7-
cat test-suite.log
8-
fi
9-
exit $exitcode
3+
failed=0
4+
all=0
5+
6+
for f in *.test; do
7+
./run $f
8+
case "$?" in
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
22+
done
1023

24+
if [ "$failed" -eq 0 ] ; then
25+
echo "All $all tests passed"
26+
exit 0
27+
else
28+
echo "$failed of $all tests failed"
29+
exit 1
30+
fi

meta/recipes-support/attr/attr_2.5.2.bb

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -32,47 +32,29 @@ ALTERNATIVE:${PN} = "setfattr getfattr"
3232
ALTERNATIVE_TARGET[setfattr] = "${bindir}/setfattr"
3333
ALTERNATIVE_TARGET[getfattr] = "${bindir}/getfattr"
3434

35-
PTEST_BUILD_HOST_FILES = "builddefs"
36-
PTEST_BUILD_HOST_PATTERN = "^RPM"
37-
3835
do_install_ptest() {
39-
cp ${B}/Makefile ${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
36+
install -m755 ${S}/test/run ${S}/test/sort-getfattr-output ${D}${PTEST_PATH}/
5337

54-
cp -rf ${S}/build-aux/ ${D}${PTEST_PATH}
55-
cp -rf ${S}/test/ ${D}${PTEST_PATH}
38+
for t in $(makefile-getvar ${S}/test/Makemodule.am TESTS); do
39+
install -m644 ${S}/$t ${D}${PTEST_PATH}/
40+
done
5641
}
5742

5843
do_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
6048
}
6149

6250
RDEPENDS:${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 \
7051
perl \
71-
gawk \
7252
perl-module-cwd \
7353
perl-module-file-basename \
7454
perl-module-file-path \
75-
perl-module-file-spec \
55+
perl-module-filehandle \
56+
perl-module-getopt-std \
57+
perl-module-posix \
7658
"
7759

7860
BBCLASSEXTEND = "native nativesdk"

0 commit comments

Comments
 (0)