tests/init.sh: check for successful run under strace in run_prog
In some environments it's possible that syscalls behave differently when the process is being ptrace'd. * tests/init.sh (run_prog): Move down, rewrite using try_run_prog, add a check for successful execution of the program under strace in the "medicinal mode" (-qq -enone -esignal=none -o /dev/null).
This commit is contained in:
parent
0484e396f2
commit
c31ced973c
@ -50,23 +50,6 @@ dump_log_and_fail_with()
|
||||
fail_ "$*"
|
||||
}
|
||||
|
||||
run_prog()
|
||||
{
|
||||
if [ $# -eq 0 ]; then
|
||||
set -- "../$NAME"
|
||||
fi
|
||||
args="$*"
|
||||
"$@" || {
|
||||
rc=$?
|
||||
if [ $rc -eq 77 ]; then
|
||||
skip_ "$args exited with code 77"
|
||||
else
|
||||
fail_ "$args failed with code $rc"
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
run_prog_skip_if_failed()
|
||||
{
|
||||
args="$*"
|
||||
@ -87,6 +70,22 @@ try_run_prog()
|
||||
}
|
||||
}
|
||||
|
||||
run_prog()
|
||||
{
|
||||
if [ $# -eq 0 ]; then
|
||||
set -- "../$NAME"
|
||||
fi
|
||||
args="$*"
|
||||
# We try to run under strace since there could be some security policies
|
||||
# or seccomp filters in place that change behaviour of various syscalls
|
||||
# when a process is being traced
|
||||
|
||||
try_run_prog "$@" || skip_ "$args exited with code 77"
|
||||
try_run_prog $STRACE -o /dev/null -qq -enone -esignal=none "$@" ||
|
||||
skip_ "$STRACE -o /dev/null -qq -enone -esignal=none $args" \
|
||||
"exited with code 77"
|
||||
}
|
||||
|
||||
run_strace()
|
||||
{
|
||||
> "$LOG" || fail_ "failed to write $LOG"
|
||||
|
Loading…
x
Reference in New Issue
Block a user