]> sourceware.org Git - systemtap.git/blobdiff - testsuite/systemtap.base/cmd_parse.exp
PR11353: enable probe elision optimization
[systemtap.git] / testsuite / systemtap.base / cmd_parse.exp
index cbce045555004e8dc4a6400f8a7a48a3e2e5ec5f..82c44608862ef044cf28eb706f04d11b156d5958 100644 (file)
 if {![installtest_p]} {
-    for {set i 0} { $i < 8} {incr i} {
+    for {set i 0} { $i < 16} {incr i} {
         untested cmd_parse$i
     }
     return
 }
 
-# stap -c 'echo "hello world"' -e 'probe begin {}'
-spawn stap -c {echo "hello world"} -e {probe begin {}}
+spawn stap -u -c {echo "hello world"} -we {probe begin {}}
 expect {
     -timeout 60
     "hello world" {pass "cmd_parse1"}
     timeout {fail "cmd_parse1: unexpected timeout"}
     eof {fail "cmd_parse1: unexpected EOF"}
 }
-wait
+catch { close }; catch { wait }
 
-# stap -c 'echo "hello "\"world\"' -e 'probe begin {}'
-spawn stap -c {echo "hello "\"world\"} -e {probe begin {}}
+spawn stap -u -c {echo "hello "\"world\"} -we {probe begin {}}
 expect {
     -timeout 60
     "hello \"world\"" {pass "cmd_parse2"}
     timeout {fail "cmd_parse2: unexpected timeout"}
     eof {fail "cmd_parse2: unexpected EOF"}
 }
-wait
+catch { close }; catch { wait }
 
-#stap -c '(a="hello world"; echo $a)' -e 'probe begin {}'
-spawn stap -c {(a="hello world"; echo $a)} -e {probe begin {}}
+spawn stap -u -c {sh -c '(a="hello world"; echo $a)'} -we {probe begin {}}
 expect {
     -timeout 60
     "hello world" {pass "cmd_parse3"}
     timeout {fail "cmd_parse3: unexpected timeout"}
     eof {fail "cmd_parse3: unexpected EOF"}
 }
-wait
+catch { close }; catch { wait }
 
-#stap -c '(a="hello "\"world\"; echo $a)' -e 'probe begin {}'
-spawn stap -c {(a="hello "\"world\"; echo $a)} -e {probe begin {}}
+spawn stap -u -c {sh -c '(a="hello "\"world\"; echo $a)'} -we {probe begin {}}
 expect {
     -timeout 60
     "hello \"world\"" {pass "cmd_parse4"}
     timeout {fail "cmd_parse4: unexpected timeout"}
     eof {fail "cmd_parse4: unexpected EOF"}
 }
-wait
+catch { close }; catch { wait }
 
-#stap -c '(a="hello "world; echo $a)' -e 'probe begin {}'
-spawn stap -c {(a="hello "world; echo $a)} -e {probe begin {}}
+spawn stap -u -c {sh -c '(a="hello "world; echo $a)'} -we {probe begin {}}
 expect {
     -timeout 60
     "hello world" {pass "cmd_parse5"}
     timeout {fail "cmd_parse5: unexpected timeout"}
     eof {fail "cmd_parse5: unexpected EOF"}
 }
-wait
+catch { close }; catch { wait }
 
-#stap -c '(((a=42+7)); echo "The answer is $a")' -e 'probe begin {}'
-# NB: not  ((a=42+7)) - must not assume bash
-spawn stap -c {(a=49; echo "The answer is $a")} -e {probe begin {}}
+spawn stap -u -c {bash -c '((a=42+7)); echo "The answer is $a"'} -we {probe begin {}}
 expect {
     -timeout 60
     "The answer is 49" {pass "cmd_parse6"}
     timeout {fail "cmd_parse6: unexpected timeout"}
     eof {fail "cmd_parse6: unexpected EOF"}
 }
-wait
+catch { close }; catch { wait }
 
-#stap -c '(echo "Hello World" 1>&2) > /dev/null' -e 'probe begin {}'
-spawn stap -c {(echo "Hello World" 1>&2) > /dev/null} -e {probe begin {}}
+spawn stap -u -c {sh -c '(echo "Hello World" 1>&2) > /dev/null'} -we {probe begin {}}
 expect {
     -timeout 60
     "Hello World" {pass "cmd_parse7"}
     timeout {fail "cmd_parse7: unexpected timeout"}
     eof {fail "cmd_parse7: unexpected EOF"}
 }
-wait
+catch { close }; catch { wait }
 
+# slow test case; requires kernel tracepoint query modules
 spawn stap -l {vm.*}
 expect {
-    -timeout 60
-    -re "vm.*" {pass "cmd_parse8"}
+    -timeout 240
+    -re {^vm[^\r\n]*\r\n} {pass "cmd_parse8"}
+    -re "^Warning: make exited with status: 2\r\n" {exp_continue}
     timeout {fail "cmd_parse8: unexpected timeout"}
     eof {fail "cmd_parse8: unexpected EOF"}
 }
-wait
+catch { close }; catch { wait }
+
+spawn stap -e {probe begin { printf("%d %s\n", argc, argv[$1]) exit() }} 1
+expect {
+    -timeout 60
+    "1 1" { pass cmd_parse9 }
+    timeout { fail "cmd_parse9 timeout" }
+    eof { fail "cmd_parse9 eof" }
+}
+catch { close }; catch { wait }
+
+spawn stap -e {probe begin { printf("%d %s\n", argc, argv[$1]) exit() }} 5 a b c d
+expect {
+    -timeout 60
+    "5 d" { pass cmd_parse10 }
+    timeout { fail "cmd_parse10 timeout" }
+    eof { fail "cmd_parse10 eof" }
+}
+catch { close }; catch { wait }
+
+spawn stap -e {probe begin { printf("%d %s\n", argc, argv[$1]) exit() }} 10 a b c d
+expect {
+    -timeout 60
+    "5 " { pass cmd_parse11 }
+    timeout { fail "cmd_parse11 timeout" }
+    eof { fail "cmd_parse11 eof" }
+}
+catch { close }; catch { wait }
+
+spawn stap -e {probe begin { printf("%d %s\n", argc, argv[0]) exit() }}
+expect {
+    -timeout 60
+    "0 " { pass cmd_parse12 }
+    timeout { fail "cmd_parse12 timeout" }
+    eof { fail "cmd_parse12 eof" }
+}
+catch { close }; catch { wait }
+
+spawn stap -L syscall.a*
+expect {
+    -timeout 60
+    -re {(syscall\.a[_a-zA-Z0-9]*(\ [_a-zA-Z0-9\$]+:[^:]+?)+\r\n)+} { pass "cmd_parse13" }
+    timeout {fail "cmd_parse13: unexpected timeout"}
+    eof {fail "cmd_parse13: unexpected EOF"}
+}
+catch { close }; catch { wait }
+
+if {![catch { exec sh -c "stap -v -v --vp 01020 -h 2>&1 | grep -q 'add per-pass verbosity .23242.'" }]} {
+    pass "cmd_parse14"
+} else {
+    fail "cmd_parse14"
+}
+
+set uname [exec uname -r]
+set triplet [split $uname {.-}]
+if {[lindex $triplet 0] == 2 &&
+    [lindex $triplet 1] == 6 &&
+    [lindex $triplet 2] < 29} {
+  # verbose -log "kfail, see commit e0ccd3\n";
+  setup_kfail 4186 "*-*-*"
+}
+spawn sh -c "stap -m do_not_cache_me -B kernelrelease -p4 -e 'probe begin {exit()}'"
+# the \r below is meant to match the "kernelrelease" output, as distinct from
+# any possible auxiliary make verbosity.
+expect {
+    -timeout 60
+    -gl "$uname\r" { pass "cmd_parse15" }
+    timeout { fail "cmd_parse15: timeout" }
+    eof { fail "cmd_parse15: eof" }
+}
+catch { close }; catch { wait }
+
+set uname [exec uname -i]
+# normalize arch
+set uname [normalize_arch $uname]
+
+spawn sh -c "stap -m do_not_cache_me -a $uname -p4 -e 'probe begin {exit()}'"
+# the \r below is meant to match the "kernelrelease" output, as distinct from
+# any possible auxiliary make verbosity.
+expect {
+    -timeout 60
+    -re "do_not_cache_me.ko\r" { pass "cmd_parse16" }
+    timeout { fail "cmd_parse16: timeout" }
+    eof { fail "cmd_parse16: eof" }
+}
+catch { close }; catch { wait }
+
+# NB: when adding extra tests here, increment the ![installtest_p]
+# loop count too at the top.
+
+catch {exec rm -f do_not_cache_me.ko}
This page took 0.02911 seconds and 5 git commands to generate.