summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChase Qi <chase.qi@linaro.org>2022-11-09 06:47:09 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-11-11 13:43:40 +0000
commit3a403ea562c7bc7aa07c40f5095c6078dc33366b (patch)
tree4f7b5f2344b1f188a1269b3c2022dcf3ff8af808
parentf260b288020f07fdf0616d245691b2e40b6b6b4b (diff)
downloadpoky-3a403ea562c7bc7aa07c40f5095c6078dc33366b.tar.gz
libc-test: add libc testsuite for musl
libc-test is a collection of unit test to measure the correctness and robustness of a C/POSIX standard library implementation. It is developed as part of the musl project. (From OE-Core rev: 4a94cdc7e841ebe583b0e6935fc50d233c8c310e) Signed-off-by: Chase Qi <chase.qi@linaro.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/conf/distro/include/maintainers.inc1
-rw-r--r--meta/conf/distro/include/ptest-packagelists.inc1
-rw-r--r--meta/recipes-core/musl/libc-test/run-ptest28
-rw-r--r--meta/recipes-core/musl/libc-test_git.bb51
4 files changed, 81 insertions, 0 deletions
diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc
index 57319cd8f5..5b7ce77c3c 100644
--- a/meta/conf/distro/include/maintainers.inc
+++ b/meta/conf/distro/include/maintainers.inc
@@ -306,6 +306,7 @@ RECIPE_MAINTAINER:pn-libarchive = "Otavio Salvador <otavio.salvador@ossystems.co
306RECIPE_MAINTAINER:pn-libassuan = "Unassigned <unassigned@yoctoproject.org>" 306RECIPE_MAINTAINER:pn-libassuan = "Unassigned <unassigned@yoctoproject.org>"
307RECIPE_MAINTAINER:pn-libatomic-ops = "Anuj Mittal <anuj.mittal@intel.com>" 307RECIPE_MAINTAINER:pn-libatomic-ops = "Anuj Mittal <anuj.mittal@intel.com>"
308RECIPE_MAINTAINER:pn-libbsd = "Yi Zhao <yi.zhao@windriver.com>" 308RECIPE_MAINTAINER:pn-libbsd = "Yi Zhao <yi.zhao@windriver.com>"
309RECIPE_MAINTAINER:pn-libc-test = "Chase Qi <chase.qi@linaro.org>"
309RECIPE_MAINTAINER:pn-libcap = "Yi Zhao <yi.zhao@windriver.com>" 310RECIPE_MAINTAINER:pn-libcap = "Yi Zhao <yi.zhao@windriver.com>"
310RECIPE_MAINTAINER:pn-libcap-ng = "Yi Zhao <yi.zhao@windriver.com>" 311RECIPE_MAINTAINER:pn-libcap-ng = "Yi Zhao <yi.zhao@windriver.com>"
311RECIPE_MAINTAINER:pn-libcap-ng-python = "Yi Zhao <yi.zhao@windriver.com>" 312RECIPE_MAINTAINER:pn-libcap-ng-python = "Yi Zhao <yi.zhao@windriver.com>"
diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index 32b0e5297a..3c9ff43bd9 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -105,6 +105,7 @@ PTESTS_SLOW = "\
105 105
106PTESTS_SLOW:remove:riscv64 = "valgrind-ptest" 106PTESTS_SLOW:remove:riscv64 = "valgrind-ptest"
107PTESTS_PROBLEMS:append:riscv64 = "valgrind-ptest" 107PTESTS_PROBLEMS:append:riscv64 = "valgrind-ptest"
108PTESTS_SLOW:append:libc-musl = " libc-test-ptest"
108 109
109# ruby-ptest \ # Timeout 110# ruby-ptest \ # Timeout
110# lz4-ptest \ # Needs a rewrite 111# lz4-ptest \ # Needs a rewrite
diff --git a/meta/recipes-core/musl/libc-test/run-ptest b/meta/recipes-core/musl/libc-test/run-ptest
new file mode 100644
index 0000000000..0b4b687dec
--- /dev/null
+++ b/meta/recipes-core/musl/libc-test/run-ptest
@@ -0,0 +1,28 @@
1#!/bin/sh
2
3set -e
4
5cd /opt/libc-test
6make cleanall
7make run || true
8
9echo ""
10echo "--- ptest result ---"
11# libc-test runs tests by module(e.g. src/api) and generates sub-module test
12# report(e.g. src/api/REPORT) first. After all tests finish, it generates the
13# consolidated report file src/REPORT.
14report="/opt/libc-test/src/REPORT"
15if ! [ -f "${report}" ]; then
16 echo "${report} not found!"
17 echo "FAIL: libc-test"
18 exit 1
19# libc-test prints error on failure and prints nothing on success.
20elif grep -q '^FAIL src.*\.exe.*' "${report}"; then
21 # Print test failure in ptest format.
22 # e.g. "FAIL src/api/main.exe [status 1]" -> "FAIL: api_main"
23 grep '^FAIL src.*\.exe.*' "${report}" \
24 | sed 's|^FAIL src/|FAIL: |;s|/|_|;s|\.exe.*\]||'
25 exit 1
26else
27 echo "PASS: libc-test"
28fi
diff --git a/meta/recipes-core/musl/libc-test_git.bb b/meta/recipes-core/musl/libc-test_git.bb
new file mode 100644
index 0000000000..b5bfc6e34c
--- /dev/null
+++ b/meta/recipes-core/musl/libc-test_git.bb
@@ -0,0 +1,51 @@
1SUMMARY = "Musl libc unit tests"
2HOMEPAGE = "https://wiki.musl-libc.org/libc-test.html"
3DESCRIPTION = "libc-test is a collection of unit tests to measure the \
4correctness and robustness of a C/POSIX standard library implementation. It is \
5developed as part of the musl project."
6SECTION = "tests"
7LICENSE = "MIT"
8LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=43ed1245085be90dc934288117d55a3b"
9
10inherit ptest
11
12SRCREV = "18e28496adee3d84fefdda6efcb9c5b8996a2398"
13SRC_URI = " \
14 git://repo.or.cz/libc-test;branch=master \
15 file://run-ptest \
16"
17
18PV = "0+git${SRCPV}"
19
20S = "${WORKDIR}/git"
21
22# libc-test 'make' or 'make run' command is designed to build and run tests. It
23# reports both build and test failures. The commands should be run on target.
24do_compile() {
25 :
26}
27
28RDEPENDS:${PN} = " \
29 bash \
30 grep \
31 musl \
32 packagegroup-core-buildessential \
33"
34
35RDEPENDS:${PN}-ptest = " \
36 ${PN} \
37 sed \
38"
39
40install_path = "/opt/${PN}"
41FILES:${PN} += "${install_path}/*"
42
43do_install () {
44 install -d ${D}${install_path}/
45 cp ${S}/Makefile ${D}${install_path}
46 cp ${S}/config.mak.def ${D}${install_path}/config.mak
47 cp -r ${S}/src ${D}${install_path}
48}
49
50COMPATIBLE_HOST = "null"
51COMPATIBLE_HOST:libc-musl = "(.*)"