strace/tests/strace-S.test
Dmitry V. Levin 469fd109cd Consistently use extended regular expressions where appropriate
When grep or sed is used with basic regular expressions containing
'(', ')', '{', '}', '|', '?', and '+' special characters, convert them
to extended regular expressions for better portability and readability.

* generate_mpers_am.sh: Convert grep and sed BREs to EREs.
* Makefile.am (ioctl_redefs%.h, m%_type_defs.h, m%_funcs.h,
mpers_printer_decl_pattern, printers.h, %_printer_decls.h,
%_printer_defs.h): Convert sed BREs to EREs.
* generate_sen.sh: Likewise.
* linux/mips/genstub.sh: Likewise.
* make-dsc: Likewise.
* mpers.sh: Likewise.
* xlat/gen.sh: Likewise.
* tests/Makefile.am (ksysent.h): Likewise.
* tests/ksysent.sed: Likewise.
* tests/pc.test: Likewise.
* tests/strace-S.test: Likewise.
* tests/strace-V.test: Likewise.
* tests/strace-k.test: Likewise.
2016-07-28 18:32:18 +00:00

33 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"'$/\6/p'
rm -f "$OUT"