strace/tests/strace-S.test
Eugene Syromyatnikov f0865403a2 count: refactor statistics calculation/output
In preparation to extension.

* count.c (enum count_summary_columns): New enumeration type.
(struct call_counts): Add time_avg field.
(DEF_COLUMNS): New macro.
(columns, visible): New variables.
(num_chars): New function.
(call_summary_pers): Calculate aggregate data first, then output table
based on columns configuration.
* tests/count-f.expected: Update expected output.
* tests/strace-C.expected: Likewise.
* tests/strace-S.test: Likewise.
2018-09-04 19:18:48 +02:00

31 lines
692 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 -r -n -e "$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"'[[:space:]]*$/\6/p'