strace/tests/count.test
Dmitry V. Levin 6e7ba0d8fe tests: robustify -w option test
* tests/count.test: Allow nanosleep to spend a bit less time than 1 second.
2014-06-05 15:42:04 +00:00

45 lines
722 B
Bash
Executable File

#!/bin/sh
# Check whether -c and -w options work.
. "${srcdir=.}/init.sh"
check_prog sleep
check_prog grep
make_log()
{
$STRACE $args > $LOG 2>&1 || {
cat $LOG
fail_ "$STRACE $args failed"
}
}
grep_log()
{
LC_ALL=C grep -E -x -e "$*" $LOG > /dev/null || {
cat $LOG
fail_ "unexpected output from $STRACE $args"
}
}
args='-c sleep 1'
make_log
grep nanosleep $LOG > /dev/null ||
skip_ 'sleep does not use nanosleep'
grep_log ' *[^ ]+ +0\.0[^n]*nanosleep'
args='-c -enanosleep sleep 1'
make_log
grep_log ' *[^ ]+ +0\.0[^n]*nanosleep'
args='-cw sleep 1'
make_log
grep_log ' *[^ ]+ +(1\.0|0\.99)[^n]*nanosleep'
args='-cw -enanosleep sleep 1'
make_log
grep_log '100\.00 +(1\.0|0\.99)[^n]*nanosleep'
exit 0