strace/tests/count.test
Dmitry V. Levin c6782f144a tests: change the license to GPL-2.0-or-later
strace test suite is now provided under the terms of the GNU General
Public License version 2 or later, see tests/COPYING for more details.
2018-12-10 00:00:00 +00:00

42 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
#
# Check whether -c and -w options work.
#
# Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org>
# Copyright (c) 2014-2018 The strace developers.
# All rights reserved.
#
# SPDX-License-Identifier: GPL-2.0-or-later
. "${srcdir=.}/init.sh"
run_prog ../sleep 0
check_prog grep
grep_log()
{
local pattern="$1"; shift
run_strace "$@" ../sleep 1
grep nanosleep "$LOG" > /dev/null ||
framework_skip_ 'sleep does not use nanosleep'
LC_ALL=C grep -E -x -e "$pattern" "$LOG" > /dev/null || {
echo "Pattern of expected output: $pattern"
echo 'Actual output:'
dump_log_and_fail_with "$STRACE $args output mismatch"
}
}
grep_log ' *[^ ]+ +0\.0[^n]*nanosleep' -c
grep_log ' *[^ ]+ +0\.0[^n]*nanosleep' -c -O1
grep_log ' *[^ ]+ +0\.0[^n]*nanosleep' -c -enanosleep
grep_log ' *[^ ]+ +0\.0[^n]*nanosleep' -c -O1 -enanosleep
grep_log ' *[^ ]+ +(1\.[01]|0\.99)[^n]*nanosleep' -cw
grep_log ' *[^ ]+ +(1\.[01]|0\.99)[^n]*nanosleep' -cw -O1
grep_log '100\.00 +(1\.[01]|0\.99)[^n]*nanosleep' -cw -enanosleep
grep_log '100\.00 +(1\.[01]|0\.99)[^n]*nanosleep' -cw -O1 -enanosleep
exit 0