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 <thomas@t-8ch.de>
return
}
-function ts_failed_subtest {
+function ts_failed {
local msg="FAILED"
local ret=1
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 {
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")"
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)"
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"
"$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"
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"
"$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
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"
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"