]> granicus.if.org Git - strace/blobdiff - tests/qual_syscall.test
tests: extend TEST_NETLINK_OBJECT macro
[strace] / tests / qual_syscall.test
index 0b4fa42e8aae8f916c1ece4ce483f36dad783da8..1524405a316b6ac7d7a2d6abc591eb49f26e5ade 100755 (executable)
@@ -1,19 +1,26 @@
 #!/bin/sh
 
-# Ensure that strace -e trace=set works.
+# Check how strace -e abbrev=set, -e raw=set, -e trace=set,
+# and -e verbose=set work.
 
 . "${srcdir=.}/init.sh"
 
-run_prog ./umovestr
-pattern_abbrev_verbose='execve("\./umovestr", \["\./umovestr"\], \[/\* [[:digit:]]* vars \*/\]) = 0'
+run_prog ../umovestr
+pattern_abbrev_verbose='execve("\.\./umovestr", \["\.\./umovestr"\], 0x[[:xdigit:]]* /\* [[:digit:]]* vars \*/) = 0'
+pattern_nonabbrev_verbose='execve("\.\./umovestr", \["\.\./umovestr"\], \[".*\"\(\.\.\.\)\?\]) = 0'
+pattern_nonverbose='execve("\.\./umovestr", 0x[[:xdigit:]]*, 0x[[:xdigit:]]*) = 0'
+pattern_raw='execve(0x[[:xdigit:]]*, 0x[[:xdigit:]]*, 0x[[:xdigit:]]*) = 0'
 
 check_output_mismatch()
 {
        local pattern
        pattern="$1"; shift
-       run_strace "$@" ./umovestr
-       LC_ALL=C grep -x "$pattern" "$LOG" > /dev/null ||
+       run_strace "$@" ../umovestr
+       LC_ALL=C grep -x "$pattern" "$LOG" > /dev/null || {
+               printf '%s\n%s\n' \
+                       'Failed patterns of expected output:' "$pattern"
                dump_log_and_fail_with "$STRACE $args output mismatch"
+       }
 }
 
 check_output_mismatch "$pattern_abbrev_verbose" -e execve
@@ -21,12 +28,36 @@ LC_ALL=C grep -v -x "$pattern_abbrev_verbose" "$LOG" |
 LC_ALL=C grep '^[[:alnum:]_]*(' > /dev/null &&
        dump_log_and_fail_with "$STRACE $args unexpected output"
 
-check_output_mismatch "$pattern_abbrev_verbose" -e trace=process
+check_output_mismatch "$pattern_abbrev_verbose" -e trace=%process
 LC_ALL=C grep '^chdir' "$LOG" > /dev/null &&
        dump_log_and_fail_with "$STRACE $args unexpected output"
 
-run_strace -e 42 ./umovestr
-LC_ALL=C grep '^[[:alnum:]_]*(' > /dev/null &&
+run_strace -e 42 ../umovestr
+LC_ALL=C grep '^[[:alnum:]_]*(' "$LOG" > /dev/null &&
+       dump_log_and_fail_with "$STRACE $args unexpected output"
+
+run_strace -e/ -e42 ../umovestr
+LC_ALL=C grep '^[[:alnum:]_]*(' "$LOG" > /dev/null &&
        dump_log_and_fail_with "$STRACE $args unexpected output"
 
+for a in execve \!chdir /. all \!none \
+        file process \!desc \!ipc \!memory \!network \!signal; do
+       check_output_mismatch \
+               "$pattern_abbrev_verbose" -e abbrev="$a" -e execve
+       check_output_mismatch \
+               "$pattern_raw" -a22 -e raw="$a" -e execve
+       check_output_mismatch \
+               "$pattern_abbrev_verbose" -e verbose="$a" -e execve
+done
+
+for a in \!execve chdir 42 \!all none \
+        \!file \!process desc ipc memory network signal; do
+       check_output_mismatch \
+               "$pattern_nonabbrev_verbose" -e abbrev="$a" -e execve
+       check_output_mismatch \
+               "$pattern_abbrev_verbose" -e raw="$a" -e execve
+       check_output_mismatch \
+               "$pattern_nonverbose" -a31 -e verbose="$a" -e execve
+done
+
 exit 0