]> granicus.if.org Git - strace/commitdiff
tests: extend -S option check
authorDmitry V. Levin <ldv@altlinux.org>
Tue, 6 Aug 2019 13:38:20 +0000 (13:38 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 6 Aug 2019 13:38:20 +0000 (13:38 +0000)
* tests/strace-S.test: Check default sorting method and "-S time".

tests/strace-S.test

index 4b5be6d904c2c67a5649536ae58932f17311237b..8ced679b24025163e975e299075987f18e9d0160 100755 (executable)
@@ -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