openposix: Run the Open POSIX tests with kirk
v3 cover openposix: Run the Open POSIX tests with kirk
Hi,
There are no runtest files for the Open POSIX tests, so kirk can not run them.
Patch 1 and 2 make the two mqueues_multi_send_rev tests use one thread by default and remove the .args files. Patch 3 rebuilds run.sh when the Makefile changes. Patch 4 generates runtest/openposix-* at install time. Each line calls a small wrapper that maps the Open POSIX exit codes to the LTP ones.
Changes in v3:
- Drop "openposix: Install the .args files". Instead use one thread by default in multi_send_rev_1 and multi_send_rev_2, and remove the .args files and the code in run-tests.sh that reads them. (Petr)
- The runtest files do not read .args files any more.
- New patch: rebuild run.sh when the Makefile changes.
Changes in v2:
- Take the list of tests from the installed run.sh files. v1 used all the files in DESTDIR, so it picked up old tests left from an earlier install, like pthread_detach_1-2. (LTP AI Reviewer)
This does not cover a removed test directory: its old run.sh stays in DESTDIR, so its tests are still listed.
openposix_run.sh does not use t0 like run-tests.sh does. So a hung test is stopped by the kirk timeout and not after 300 seconds. The kirk default is 1h for one test and also 1h for the whole suite.
I ran all three runtest files with kirk on qemu-arm64, with a 6.18.54 kernel and a Debian forky rootfs. 1735 tests ran in about 17 minutes:
1694 pass, 40 TCONF and 1 fail (pthread_rwlock_unlock_3-1). The mqueues_multi_send_rev tests pass with the default of one thread.
v2: https://lore.kernel.org/ltp/[email protected]/
v1: https://lore.kernel.org/ltp/[email protected]/
Cheers,
Anders
Anders Roxell (4):
openposix: mqueues: Use one thread by default
openposix: Remove the .args files
openposix: Rebuild run.sh when the Makefile changes
openposix: Add runtest files for kirk
testcases/open_posix_testsuite/Makefile | 11 +++++- testcases/open_posix_testsuite/bin/Makefile | 6 +++- .../open_posix_testsuite/bin/openposix_run.sh | 29 +++++++++++++++ .../open_posix_testsuite/bin/run-tests.sh | 2 +- .../include/mk/config.mk.in | 3 ++ .../scripts/generate-makefiles.sh | 2 +- .../scripts/generate-runtest.sh | 35 +++++++++++++++++++ .../mqueues/mqueues_multi_send_rev_1.args | 1 - .../mqueues/mqueues_multi_send_rev_2.args | 1 - .../stress/mqueues/multi_send_rev_1.c | 8 +++-- .../stress/mqueues/multi_send_rev_2.c | 8 +++-- 11 files changed, 94 insertions(+), 12 deletions(-) create mode 100755 testcases/open_posix_testsuite/bin/openposix_run.sh create mode 100755 testcases/open_posix_testsuite/scripts/generate-runtest.sh delete mode 100644 testcases/open_posix_testsuite/stress/mqueues/mqueues_multi_send_rev_1.args delete mode 100644 testcases/open_posix_testsuite/stress/mqueues/mqueues_multi_send_rev_2.args
Signature · 5 lines
2.53.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v3 1/4 openposix: mqueues: Use one thread by default
multi_send_rev_1 and multi_send_rev_2 fail without the number of threads as an argument. Only run-tests.sh passes it, from a .args file that make install does not install.
Default to one thread like the .args files, and remove the unused getopt.h include.
--- .../stress/mqueues/multi_send_rev_1.c | 8 +++++--- .../stress/mqueues/multi_send_rev_2.c | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-)
testcases/open_posix_testsuite/stress/mqueues/multi_send_rev_1.c +5 -3
@@ -18,7 +18,6 @@#include <sys/wait.h> #include <sys/mman.h> #include <string.h> -#include <getopt.h> #include <pthread.h> #include <limits.h> #include <mqueue.h>
@@ -28,6 +27,7 @@#define MSG_SIZE 128#define MAX_MSG 3#define Max_Threads 10 +#define DEFAULT_THREADS 1#define Name_Size 20 typedef struct {
@@ -96,8 +96,10 @@ int test_main(int argc, char **argv)printf("_POSIX_MESSAGE_PASSING is not defined \n"); return PTS_UNRESOLVED; #endif */ -if ((2 != argc) || ((num =atoi (argv[1 ])) <=0 )) { -fprintf (stderr,"Usage: %s number_of_threads\n" , argv[0 ]); +if (argc <2 ) { + num =DEFAULT_THREADS ; + }else if ((num =atoi (argv[1 ])) <=0 ) { +fprintf (stderr,"Usage: %s [number_of_threads]\n" , argv[0 ]);return PTS_FAIL ; }if (num > Max_Threads) {
testcases/open_posix_testsuite/stress/mqueues/multi_send_rev_2.c +5 -3
@@ -18,7 +18,6 @@#include <sys/wait.h> #include <sys/mman.h> #include <string.h> -#include <getopt.h> #include <pthread.h> #include <limits.h> #include <mqueue.h>
@@ -29,6 +28,7 @@#define MSG_SIZE 128#define MAX_MSG 5#define Max_Threads 100 +#define DEFAULT_THREADS 1static const char *s_msg_ptr[] = {"send_1 1" ,"send_1 2" ,"send_1 3" ,"send_1 4" ,"send_1 5" };
@@ -85,8 +85,10 @@ int test_main(int argc, char **argv)printf("_POSIX_MESSAGE_PASSING is not defined \n"); return PTS_UNRESOLVED; #endif */ -if ((2 != argc) || ((num =atoi (argv[1 ])) <=0 )) { -fprintf (stderr,"Usage: %s number_of_threads\n" , argv[0 ]); +if (argc <2 ) { + num =DEFAULT_THREADS ; + }else if ((num =atoi (argv[1 ])) <=0 ) { +fprintf (stderr,"Usage: %s [number_of_threads]\n" , argv[0 ]);return PTS_FAIL ; }if (num > Max_Threads) {
Signature · 5 lines
2.53.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] openposix: mqueues: Use one thread by default
Hi Anders,
Quoted 1 line · Anders Roxell
openposix: mqueues: Use one thread by default
Verdict - Reviewed
---
Note:
The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v3 2/4 openposix: Remove the .args files
In reply to Anders RoxellOnly the two mqueues_multi_send_rev tests used them, and they now use one thread by default. Remove the files and the code in run-tests.sh that reads them.
--- testcases/open_posix_testsuite/bin/run-tests.sh | 2 +- .../stress/mqueues/mqueues_multi_send_rev_1.args | 1 - .../stress/mqueues/mqueues_multi_send_rev_2.args | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 testcases/open_posix_testsuite/stress/mqueues/mqueues_multi_send_rev_1.args delete mode 100644 testcases/open_posix_testsuite/stress/mqueues/mqueues_multi_send_rev_2.args
testcases/open_posix_testsuite/bin/run-tests.sh +1 -1
@@ -46,7 +46,7 @@ run_test() { complog=$(basename $testname).log.$$ - sh -c "$SCRIPT_DIR/t0 $TIMEOUT_VAL ./$1 $(cat ./$(echo "$1" | sed 's,\.[^\.]*,,').args 2>/dev/null)" > $complog 2>&1 + sh -c "$SCRIPT_DIR/t0 $TIMEOUT_VAL ./$1" > $complog 2>&1 ret_code=$?
testcases/open_posix_testsuite/stress/mqueues/mqueues_multi_send_rev_1.args deleted +0 -1
@@ -1 +0,0 @@ -1
testcases/open_posix_testsuite/stress/mqueues/mqueues_multi_send_rev_2.args deleted +0 -1
@@ -1 +0,0 @@ -1
Signature · 5 lines
2.53.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v3 3/4 openposix: Rebuild run.sh when the Makefile changes
In reply to Anders Roxellrun.sh has no prerequisites, so it keeps an old list of tests after tests are added or removed. Only make clean fixes it.
Make run.sh depend on the Makefile that lists the tests.
--- testcases/open_posix_testsuite/scripts/generate-makefiles.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/open_posix_testsuite/scripts/generate-makefiles.sh +1 -1
@@ -200,7 +200,7 @@ EOF if ! grep -q '^run.sh' "$makefile.3"; then cat >> "$makefile.3" <<EOF -run.sh: +run.sh: Makefile @echo '#!/bin/sh' > \$@ @echo "\$(top_srcdir)/bin/run-tests.sh \$(subdir) \$(INSTALL_TARGETS)" >> \$@ @chmod +x run.sh
Signature · 5 lines
2.53.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v3 4/4 openposix: Add runtest files for kirk
In reply to Anders RoxellKirk can not run the Open POSIX tests, because they have no runtest files.
Generate one for each suite at install time. The list comes from the installed run.sh files, so old test binaries left in DESTDIR are not listed. The speculative tests are left out like in run.sh, and a run.sh without a run-tests.sh line fails the install.
Each line calls openposix_run.sh. It runs the test from its own directory and maps PTS_UNSUPPORTED and PTS_UNTESTED to TCONF, so kirk does not report them as TWARN and TFAIL.
A removed test directory is still listed, because its old run.sh stays in DESTDIR.
--- testcases/open_posix_testsuite/Makefile | 11 +++++- testcases/open_posix_testsuite/bin/Makefile | 6 +++- .../open_posix_testsuite/bin/openposix_run.sh | 29 +++++++++++++++ .../include/mk/config.mk.in | 3 ++ .../scripts/generate-runtest.sh | 35 +++++++++++++++++++ 5 files changed, 82 insertions(+), 2 deletions(-) create mode 100755 testcases/open_posix_testsuite/bin/openposix_run.sh create mode 100755 testcases/open_posix_testsuite/scripts/generate-runtest.sh
testcases/open_posix_testsuite/Makefile +10 -1
@@ -74,7 +74,7 @@ generate-makefiles: distclean-makefiles $(top_srcdir)/scripts/generate-makefiles.sh .PHONY: install -install: bin-install conformance-install functional-install stress-install +install: bin-install conformance-install functional-install stress-install runtest-install .PHONY: test test: conformance-test functional-test stress-test
@@ -119,6 +119,15 @@ stress-test: @rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@ @$(TEST_MAKE) -C stress test +.PHONY: runtest-install +runtest-install: $(addsuffix -install,$(SUBDIRS)) + @mkdir -p $(DESTDIR)/$(runtestdir) + @set -e; for suite in $(SUBDIRS); do \ + $(top_srcdir)/scripts/generate-runtest.sh \ + $(DESTDIR)/$(testdir) "$(testdir_rel)" $$suite \ + > $(DESTDIR)/$(runtestdir)/openposix-$$suite; \ + done + # Tools build and install targets. .PHONY: bin-install bin-install:
testcases/open_posix_testsuite/bin/Makefile +5 -1
@@ -16,7 +16,7 @@ clean: @rm -f t0.val .PHONY: install -install: clean $(DESTDIR)/$(bindir) $(DESTDIR)/$(testdir_bin) +install: clean $(DESTDIR)/$(bindir) $(DESTDIR)/$(testdir_bin) $(DESTDIR)/$(ltp_bindir) set -e; for file in $(INSTALL_BIN_TARGETS); do \ install -m 00755 $$file $(DESTDIR)/$(bindir)/$$file; \ done
@@ -27,9 +27,13 @@ install: clean $(DESTDIR)/$(bindir) $(DESTDIR)/$(testdir_bin) install -m 00755 $$file $(DESTDIR)/$(testdir_bin)/$$file; \ done + install -m 00755 openposix_run.sh $(DESTDIR)/$(ltp_bindir)/ $(DESTDIR)/$(bindir): mkdir -p $@ $(DESTDIR)/$(testdir_bin): mkdir -p $@ + +$(DESTDIR)/$(ltp_bindir): + mkdir -p $@
testcases/open_posix_testsuite/bin/openposix_run.sh new file +29 -0
@@ -0,0 +1,29 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2026 Linaro Limited + +LTPROOT=${LTPROOT:-$(cd "$(dirname "$0")/../.." && pwd)} + +if [ $# -lt 1 ]; then + echo "Usage: $(basename "$0") <test path relative to LTPROOT> [args]" >&2 + exit 2 +fi + +test_path=$LTPROOT/$1 +test_file=${test_path##*/} +shift + +if [ ! -x "$test_path" ]; then + echo "$test_path is missing or not executable" >&2 + exit 2 +fi + +cd "${test_path%/*}" || exit 2 + +./"$test_file" "$@" +ret=$? + +case $ret in +4|5) exit 32 ;; +*) exit $ret ;; +esac
testcases/open_posix_testsuite/include/mk/config.mk.in +3 -0
@@ -14,4 +14,7 @@ testdir_rel := @testdir@ testdir := ${prefix}/${testdir_rel} testdir_bin := ${testdir}/bin +ltp_bindir := ${prefix}/testcases/bin +runtestdir := ${prefix}/runtest + CFLAGS += -std=c99 -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -Wall -Wextra
testcases/open_posix_testsuite/scripts/generate-runtest.sh new file +35 -0
@@ -0,0 +1,35 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2026 Linaro Limited + +if [ $# -ne 3 ]; then + echo "Usage: $(basename "$0") <installed testdir> <testdir relative to LTPROOT> <suite>" >&2 + exit 1 +fi + +installed_testdir=$1 +testdir_rel=$2 +suite=$3 + +cd "$installed_testdir" || exit 1 + +if [ ! -d "$suite" ]; then + echo "$installed_testdir/$suite does not exist" >&2 + exit 1 +fi + +run_tests_line='^[^ ]*/run-tests\.sh [^ ]* ' + +find "$suite" -name speculative -prune -o -name run.sh -print | sort | \ +while read -r run_sh; do + if ! grep -q "$run_tests_line" "$run_sh"; then + echo "$run_sh has no run-tests.sh line" >&2 + exit 1 + fi + dir=${run_sh%/run.sh} + tests=$(sed -n "s,$run_tests_line,,p" "$run_sh") + for test_name in $tests; do + [ -f "$dir/$test_name" ] || continue + echo "${test_name%.*} openposix_run.sh ${testdir_rel:+$testdir_rel/}$dir/$test_name" + done +done
Signature · 5 lines
2.53.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp