From 1475a76e96b29977fe8271f81adb398904017d6f Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Tue, 6 Aug 2019 13:38:20 +0000 Subject: [PATCH] tests: extend -S option check * tests/strace-S.test: Check default sorting method and "-S time". --- tests/strace-S.test | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/strace-S.test b/tests/strace-S.test index 4b5be6d9..8ced679b 100755 --- a/tests/strace-S.test +++ b/tests/strace-S.test @@ -18,7 +18,7 @@ test_c() sortopts="$1"; shift sedexpr="$1"; shift - run_strace -c -w -S "$sortby" ../readv > /dev/null + run_strace -c -w ${sortby:+-S} $sortby ../readv > /dev/null sed -r -n -e "$sedexpr" < "$LOG" > "$OUT" [ -s "$OUT" ] || @@ -31,5 +31,15 @@ test_c() } 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' +for s in '' time; do + test_c "$s" '-n -r' \ + 's/^[[:space:]]+([0-9]+)[.,]([0-9]+)[[:space:]].*/\1\t\2/p' +done +for s in calls; do + test_c "$s" '-n -r' \ + '/^[[:space:]]+[0-9]/ s/^'"$c$c$c$c"'[[:space:]].*/\4/p' +done +for s in name; do + test_c "$s" '' \ + '/^[[:space:]]+[0-9]/ s/^'"$c$c$c$c"'([[:space:]]+[0-9]+)?'"$c"'$/\6/p' +done -- 2.40.0