summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2023-09-08 18:56:02 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-09-11 16:04:35 +0100
commita1b3e8758eca008c2d8e05ece0a121d6509dfa78 (patch)
tree38a4ab63f9542654412cb3c2540e479475d865ae
parent14a6dc7c0510d7b47e084fa63c168ce771572247 (diff)
downloadpoky-a1b3e8758eca008c2d8e05ece0a121d6509dfa78.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: 585bf4b780a8ad60ba2b33cede4f0092ff61ddfc) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-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 e63abe838d..619a959fd2 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" 19PV = "0+git"
@@ -48,5 +49,9 @@ do_install () {
48 cp -r ${S}/src ${D}${install_path} 49 cp -r ${S}/src ${D}${install_path}
49} 50}
50 51
52do_install_ptest_base:append() {
53 install -Dm 0755 ${WORKDIR}/run-libc-ptests ${D}${PTEST_PATH}/run-libc-ptests
54}
55
51COMPATIBLE_HOST = "null" 56COMPATIBLE_HOST = "null"
52COMPATIBLE_HOST:libc-musl = "(.*)" 57COMPATIBLE_HOST:libc-musl = "(.*)"