• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2
3# Check whether -c and -w options work.
4
5. "${srcdir=.}/init.sh"
6
7check_prog grep
8check_prog sleep
9
10grep_log()
11{
12	local pattern="$1"; shift
13
14	run_strace "$@"
15
16	grep nanosleep "$LOG" > /dev/null ||
17		framework_skip_ 'sleep does not use nanosleep'
18
19	LC_ALL=C grep -E -x -e "$pattern" "$LOG" > /dev/null || {
20		echo "Pattern of expected output: $pattern"
21		echo 'Actual output:'
22		dump_log_and_fail_with "$STRACE $args output mismatch"
23	}
24}
25
26grep_log ' *[^ ]+ +0\.0[^n]*nanosleep'		-c sleep 1
27grep_log ' *[^ ]+ +0\.0[^n]*nanosleep'		-c -enanosleep sleep 1
28grep_log ' *[^ ]+ +(1\.0|0\.99)[^n]*nanosleep'	-cw sleep 1
29grep_log '100\.00 +(1\.0|0\.99)[^n]*nanosleep'	-cw -enanosleep sleep 1
30
31exit 0
32