strace/tests/strace-S.test
Dmitry V. Levin a44c5184f9 strace-S.test: check "-S name"
* tests/strace-S.test: Add a check for "-c -S name" output.
2016-05-10 00:39:17 +00:00

30 lines
660 B
Bash
Executable File

#!/bin/sh
# Check -S option.
. "${srcdir=.}/init.sh"
run_prog_skip_if_failed date > /dev/null
test_c()
{
local sortby sortopts sedexpr
sortby="$1"; shift
sortopts="$1"; shift
sedexpr="$1"; shift
run_strace -c -S "$sortby" date > /dev/null
sed -ne "$sedexpr" < "$LOG" > "$OUT"
[ -s "$OUT" ] ||
fail_ "$STRACE $args output mismatch"
LC_ALL=C sort -c $sortopts "$OUT" ||
fail_ "$STRACE $args output not sorted properly"
}
c='[[:space:]]\+\([^[:space:]]\+\)'
test_c calls '-n -r' '/^[[:space:]]\+[0-9]/ s/^'"$c$c$c$c"'[[:space:]].*/\4/p'
test_c name '' '/^[[:space:]]\+[0-9]/ s/^'"$c$c$c$c"'\([[:space:]]\+[0-9]\+\)\?'"$c"'$/\6/p'
rm -f "$OUT"