summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2023-09-08 18:56:02 -0700
committerSteve Sakoman <steve@sakoman.com>2023-10-18 05:25:19 -1000
commit5aaae18b8943d167e7b97dd96cf3dccd26e77d95 (patch)
treee8d9011c78851bd5e300eeefdf81f3660e6987b9
parent04296bff893dd92aaa8918cf9c36feb31485a0bd (diff)
downloadpoky-5aaae18b8943d167e7b97dd96cf3dccd26e77d95.tar.gz
libc-test: Run as non-root user
Some of tests impose rlimit on it before running which wont be imposed when running as root user. Fixes src/regression/pthread_atfork-errno-clobber.c:23: (pid = fork()) == -1 failed: fork succeeded despite rlimit src/regression/pthread_atfork-errno-clobber.c:23: (pid = fork()) == -1 failed: fork succeeded despite rlimit FAIL src/regression/pthread_atfork-errno-clobber-static.exe [status 1] (From OE-Core rev: 16075f19b49cb23ead2dec6746d2be6773ae4ae7) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> (cherry picked from commit 585bf4b780a8ad60ba2b33cede4f0092ff61ddfc) Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-core/musl/libc-test/run-libc-ptests28
-rw-r--r--meta/recipes-core/musl/libc-test/run-ptest29
-rw-r--r--meta/recipes-core/musl/libc-test_git.bb5
3 files changed, 35 insertions, 27 deletions
diff --git a/meta/recipes-core/musl/libc-test/run-libc-ptests b/meta/recipes-core/musl/libc-test/run-libc-ptests
new file mode 100644
index 0000000000..0b4b687dec
--- /dev/null
+++ b/meta/recipes-core/musl/libc-test/run-libc-ptests
@@ -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/run-ptest b/meta/recipes-core/musl/libc-test/run-ptest
index 0b4b687dec..53cd34f506 100644
--- a/meta/recipes-core/musl/libc-test/run-ptest
+++ b/meta/recipes-core/musl/libc-test/run-ptest
@@ -1,28 +1,3 @@
1#!/bin/sh 1#!/bin/sh
2 2chown -R ptest:ptest /opt/libc-test
3set -e 3 su -c ./run-libc-ptests ptest
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
index 6d64592f0c..060f5f9f12 100644
--- a/meta/recipes-core/musl/libc-test_git.bb
+++ b/meta/recipes-core/musl/libc-test_git.bb
@@ -13,6 +13,7 @@ SRCREV = "18e28496adee3d84fefdda6efcb9c5b8996a2398"
13SRC_URI = " \ 13SRC_URI = " \
14 git://repo.or.cz/libc-test;branch=master;protocol=https \ 14 git://repo.or.cz/libc-test;branch=master;protocol=https \
15 file://run-ptest \ 15 file://run-ptest \
16 file://run-libc-ptests \
16" 17"
17 18
18PV = "0+git${SRCPV}" 19PV = "0+git${SRCPV}"
@@ -47,5 +48,9 @@ do_install () {
47 cp -r ${S}/src ${D}${install_path} 48 cp -r ${S}/src ${D}${install_path}
48} 49}
49 50
51do_install_ptest_base:append() {
52 install -Dm 0755 ${WORKDIR}/run-libc-ptests ${D}${PTEST_PATH}/run-libc-ptests
53}
54
50COMPATIBLE_HOST = "null" 55COMPATIBLE_HOST = "null"
51COMPATIBLE_HOST:libc-musl = "(.*)" 56COMPATIBLE_HOST:libc-musl = "(.*)"