strace/tests/strace-S.test
Dmitry V. Levin f56323f1cc tests/strace-S.test: fix testing 64-bit strace using a 32-bit userspace
* tests/strace-S.test: Measure wall clock time instead of system time.
Use local "./readv" instead of system "date" as a sample executable.

Reported-by: Steve McIntyre <steve@einval.com>
2016-06-06 18:07:04 +00:00

33 lines
698 B
Bash
Executable File

#!/bin/sh
# Check -S option.
. "${srcdir=.}/init.sh"
run_prog ./readv > /dev/null
test_c()
{
local sortby sortopts sedexpr
sortby="$1"; shift
sortopts="$1"; shift
sedexpr="$1"; shift
run_strace -c -w -S "$sortby" ./readv > /dev/null
sed -ne "$sedexpr" < "$LOG" > "$OUT"
[ -s "$OUT" ] ||
fail_ "$STRACE $args output mismatch"
LC_ALL=C sort -c $sortopts "$OUT" || {
echo 'Actual output:'
cat < "$LOG"
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"