1 #!/bin/sh 2 3 # Check whether -c and -w options work. 4 5 . "${srcdir=.}/init.sh" 6 7 check_prog sleep 8 check_prog grep 9 10 make_log() 11 { 12 $STRACE $args > $LOG 2>&1 || { 13 cat $LOG 14 fail_ "$STRACE $args failed" 15 } 16 } 17 18 grep_log() 19 { 20 LC_ALL=C grep -E -x -e "$*" $LOG > /dev/null || { 21 cat $LOG 22 fail_ "unexpected output from $STRACE $args" 23 } 24 } 25 26 args='-c sleep 1' 27 make_log 28 grep nanosleep $LOG > /dev/null || 29 skip_ 'sleep does not use nanosleep' 30 grep_log ' *[^ ]+ +0\.0[^n]*nanosleep' 31 32 args='-c -enanosleep sleep 1' 33 make_log 34 grep_log ' *[^ ]+ +0\.0[^n]*nanosleep' 35 36 args='-cw sleep 1' 37 make_log 38 grep_log ' *[^ ]+ +(1\.0|0\.99)[^n]*nanosleep' 39 40 args='-cw -enanosleep sleep 1' 41 make_log 42 grep_log '100\.00 +(1\.0|0\.99)[^n]*nanosleep' 43 44 exit 0 45