strace/tests/strace-tt.test
Dmitry V. Levin 52fe35f262 tests: fix expected output in strace-tt.test
If strace -tt is running too long, it might happen that time stamps
before and after its invocation differ for more than a second.
Adjust expected output to handle this rare but possible case.

* tests/strace-tt.test: Allow any time stamp between start and finish
of strace invocation.
2016-12-06 15:27:08 +00:00

29 lines
584 B
Bash
Executable File

#!/bin/sh
# Check -tt option.
. "${srcdir=.}/init.sh"
run_prog_skip_if_failed date +%s > "$LOG"
run_prog_skip_if_failed date +%T --date "@$(cat "$LOG")" > /dev/null
run_prog ./sleep 0
s0="$(date +%s)"
run_strace -tt -eexecve $args
s1="$(date +%s)"
s="$s0"
t_reg=
while [ "$s" -le "$s1" ]; do
t="$(date +%T --date "@$s")"
[ -z "$t_reg" ] && t_reg="$t" || t_reg="$t_reg|$t"
s=$(($s + 1))
done
cat > "$EXP" << __EOF__
($t_reg)\\.[[:digit:]]{6} execve\\("\\./sleep", \\["\\./sleep", "0"\\], \\[/\\* [[:digit:]]+ vars \\*/\\]\\) = 0
__EOF__
match_grep "$LOG" "$EXP"
rm -f "$EXP"