From: Thomas Weißschuh Date: Tue, 19 May 2026 20:54:44 +0000 (+0200) Subject: tests: fold ts_failed_subtest into ts_failed X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=69f82d15e00b434fc63f71057ed11ccabb1cef88;p=thirdparty%2Futil-linux.git tests: fold ts_failed_subtest into ts_failed The differences between ts_failed_subtest and ts_failed are miniminal. Make ts_failed usable from subtest context and remove the now unnecessary ts_failed_subtest. Signed-off-by: Thomas Weißschuh --- diff --git a/tests/functions.sh b/tests/functions.sh index f28e18c7d..a54064b79 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -194,7 +194,7 @@ function ts_runs_on_qemu { return } -function ts_failed_subtest { +function ts_failed { local msg="FAILED" local ret=1 @@ -211,12 +211,11 @@ function ts_failed_subtest { ts_report " $msg ($1)" fi - return $ret -} + if [ -z "$TS_SUBNAME" ]; then + exit $ret + fi -function ts_failed { - ts_failed_subtest "$1" - exit $? + return $ret } function ts_report_ok { @@ -652,7 +651,7 @@ function ts_finalize_subtest { else ts_gen_diff if [ $? -eq 1 ]; then - ts_failed_subtest "$1" + ts_failed "$1" res=1 else ts_report_ok "$(tt_gen_mem_report "$1")" diff --git a/tests/ts/chrt/all-tasks b/tests/ts/chrt/all-tasks index 4e9c26228..f3203a256 100755 --- a/tests/ts/chrt/all-tasks +++ b/tests/ts/chrt/all-tasks @@ -72,7 +72,7 @@ function search_tids() { ts_init_subtest "get-attributes" if ! start_threads_create 5 5; then - ts_failed_subtest "failed to start threads helper program" + ts_failed "failed to start threads helper program" else chrt_output="$("$TS_CMD_CHRT" --all-tasks --pid "$HELPER_PID" 2>>"$TS_ERRLOG"\ | sed -E 's/pid ([0-9]*).*/\1/g' | sort | uniq)" @@ -101,7 +101,7 @@ ts_init_subtest "set-attributes" PRIORITY=33 if ! start_threads_create 5 5; then - ts_failed_subtest "failed to start threads helper program" + ts_failed "failed to start threads helper program" else # Set the real-time scheduling attributes for all tasks "$TS_CMD_CHRT" --all-tasks --fifo --pid "$PRIORITY" "$HELPER_PID" 2>>"$TS_ERRLOG" diff --git a/tests/ts/getino/getino b/tests/ts/getino/getino index 61d138a2f..044ac928e 100755 --- a/tests/ts/getino/getino +++ b/tests/ts/getino/getino @@ -77,7 +77,7 @@ function do_ns_check() { "$TS_CMD_GETINO --${ns_name}ns \$\$" 2>>"$TS_ERRLOG") if (( ts_ns_ino == unshare_ns_ino )); then - ts_failed_subtest "${ns_name} namespace unchanged (NS ID: $ts_ns_ino)" + ts_failed "${ns_name} namespace unchanged (NS ID: $ts_ns_ino)" fi else ts_skip "no ${ns_name} namespace support" @@ -125,7 +125,7 @@ if [ -r /proc/self/ns/user ]; then if grep "$("$TS_HELPER_STRERROR" EACCES)" "$TS_ERRLOG" &>/dev/null; then ts_skip "missing permissions to obtain user namespace" else - (( ts_user_ns == unshare_user_ns )) && ts_failed_subtest "user namespace unchanged" + (( ts_user_ns == unshare_user_ns )) && ts_failed "user namespace unchanged" fi else ts_skip "no user namespace support" diff --git a/tests/ts/lsfd/lsfd-functions.bash b/tests/ts/lsfd/lsfd-functions.bash index 2b5817241..29229b343 100644 --- a/tests/ts/lsfd/lsfd-functions.bash +++ b/tests/ts/lsfd/lsfd-functions.bash @@ -139,7 +139,7 @@ function lsfd_check_sockdiag "$ENOENT") ts_skip "sockdiag netlink socket is not available";; *) - ts_failed$suffix "failed to create a sockdiag netlink socket $family ($err): $msg";; + ts_failed "failed to create a sockdiag netlink socket $family ($err): $msg";; esac return 1 diff --git a/tests/ts/lsfd/mkfds-unix-dgram b/tests/ts/lsfd/mkfds-unix-dgram index 9f0916e54..8d647f60e 100755 --- a/tests/ts/lsfd/mkfds-unix-dgram +++ b/tests/ts/lsfd/mkfds-unix-dgram @@ -75,7 +75,7 @@ ts_finalize_subtest ts_init_subtest "ENDPOINTS-column" if ! lsfd_check_sockdiag --subtest unix; then - # lsfd_check_sockdiag calls ts_skip or ts_failed_subtest. + # lsfd_check_sockdiag calls ts_skip or ts_failed. : elif ts_is_in_docker; then ts_skip "unsupported in docker environment" @@ -107,7 +107,7 @@ ts_finalize_subtest ts_init_subtest "UNIX.IPEEER-column" if ! lsfd_check_sockdiag --subtest unix; then - # lsfd_check_sockdiag calls ts_skip or ts_failed_subtest. + # lsfd_check_sockdiag calls ts_skip or ts_failed. : elif ts_is_in_docker; then ts_skip "unsupported in docker environment"