1 if {![installtest_p]} {
2 for {set i 0} { $i < 16} {incr i} {
8 spawn stap -u -c {echo "hello world"} -we {probe begin {}}
11 "hello world" {pass "cmd_parse1"}
12 timeout {fail "cmd_parse1: unexpected timeout"}
13 eof {fail "cmd_parse1: unexpected EOF"}
15 catch { close }; catch { wait }
17 spawn stap -u -c {echo "hello "\"world\"} -we {probe begin {}}
20 "hello \"world\"" {pass "cmd_parse2"}
21 timeout {fail "cmd_parse2: unexpected timeout"}
22 eof {fail "cmd_parse2: unexpected EOF"}
24 catch { close }; catch { wait }
26 spawn stap -u -c {sh -c '(a="hello world"; echo $a)'} -we {probe begin {}}
29 "hello world" {pass "cmd_parse3"}
30 timeout {fail "cmd_parse3: unexpected timeout"}
31 eof {fail "cmd_parse3: unexpected EOF"}
33 catch { close }; catch { wait }
35 spawn stap -u -c {sh -c '(a="hello "\"world\"; echo $a)'} -we {probe begin {}}
38 "hello \"world\"" {pass "cmd_parse4"}
39 timeout {fail "cmd_parse4: unexpected timeout"}
40 eof {fail "cmd_parse4: unexpected EOF"}
42 catch { close }; catch { wait }
44 spawn stap -u -c {sh -c '(a="hello "world; echo $a)'} -we {probe begin {}}
47 "hello world" {pass "cmd_parse5"}
48 timeout {fail "cmd_parse5: unexpected timeout"}
49 eof {fail "cmd_parse5: unexpected EOF"}
51 catch { close }; catch { wait }
53 spawn stap -u -c {bash -c '((a=42+7)); echo "The answer is $a"'} -we {probe begin {}}
56 "The answer is 49" {pass "cmd_parse6"}
57 timeout {fail "cmd_parse6: unexpected timeout"}
58 eof {fail "cmd_parse6: unexpected EOF"}
60 catch { close }; catch { wait }
62 spawn stap -u -c {sh -c '(echo "Hello World" 1>&2) > /dev/null'} -we {probe begin {}}
65 "Hello World" {pass "cmd_parse7"}
66 timeout {fail "cmd_parse7: unexpected timeout"}
67 eof {fail "cmd_parse7: unexpected EOF"}
69 catch { close }; catch { wait }
71 # slow test case; requires kernel tracepoint query modules
75 -re {^vm[^\r\n]*\r\n} {pass "cmd_parse8"}
76 -re "^Warning: make exited with status: 2\r\n" {exp_continue}
77 timeout {fail "cmd_parse8: unexpected timeout"}
78 eof {fail "cmd_parse8: unexpected EOF"}
80 catch { close }; catch { wait }
82 spawn stap -e {probe begin { printf("%d %s\n", argc, argv[$1]) exit() }} 1
85 "1 1" { pass cmd_parse9 }
86 timeout { fail "cmd_parse9 timeout" }
87 eof { fail "cmd_parse9 eof" }
89 catch { close }; catch { wait }
91 spawn stap -e {probe begin { printf("%d %s\n", argc, argv[$1]) exit() }} 5 a b c d
94 "5 d" { pass cmd_parse10 }
95 timeout { fail "cmd_parse10 timeout" }
96 eof { fail "cmd_parse10 eof" }
98 catch { close }; catch { wait }
100 spawn stap -e {probe begin { printf("%d %s\n", argc, argv[$1]) exit() }} 10 a b c d
103 "5 " { pass cmd_parse11 }
104 timeout { fail "cmd_parse11 timeout" }
105 eof { fail "cmd_parse11 eof" }
107 catch { close }; catch { wait }
109 spawn stap -e {probe begin { printf("%d %s\n", argc, argv[0]) exit() }}
112 "0 " { pass cmd_parse12 }
113 timeout { fail "cmd_parse12 timeout" }
114 eof { fail "cmd_parse12 eof" }
116 catch { close }; catch { wait }
118 spawn stap -L syscall.a*
121 -re {(syscall\.a[_a-zA-Z0-9]*(\ [_a-zA-Z0-9\$]+:[^:]+?)+\r\n)+} { pass "cmd_parse13" }
122 timeout {fail "cmd_parse13: unexpected timeout"}
123 eof {fail "cmd_parse13: unexpected EOF"}
125 catch { close }; catch { wait }
127 if {![catch { exec sh -c "stap -v -v --vp 01020 -h 2>&1 | grep -q 'add per-pass verbosity .23242.'" }]} {
133 set uname [exec uname -r]
134 set triplet [split $uname {.-}]
135 if {[lindex $triplet 0] == 2 &&
136 [lindex $triplet 1] == 6 &&
137 [lindex $triplet 2] < 29} {
138 # verbose -log "kfail, see commit e0ccd3\n";
139 setup_kfail 4186 "*-*-*"
141 spawn sh -c "stap -m do_not_cache_me -B kernelrelease -p4 -e 'probe begin {exit()}'"
142 # the \r below is meant to match the "kernelrelease" output, as distinct from
143 # any possible auxiliary make verbosity.
146 -gl "$uname\r" { pass "cmd_parse15" }
147 timeout { fail "cmd_parse15: timeout" }
148 eof { fail "cmd_parse15: eof" }
150 catch { close }; catch { wait }
152 set uname [exec uname -i]
154 set uname [normalize_arch $uname]
156 spawn sh -c "stap -m do_not_cache_me -a $uname -p4 -e 'probe begin {exit()}'"
157 # the \r below is meant to match the "kernelrelease" output, as distinct from
158 # any possible auxiliary make verbosity.
161 -re "do_not_cache_me.ko\r" { pass "cmd_parse16" }
162 timeout { fail "cmd_parse16: timeout" }
163 eof { fail "cmd_parse16: eof" }
165 catch { close }; catch { wait }
167 # NB: when adding extra tests here, increment the ![installtest_p]
168 # loop count too at the top.
170 catch {exec rm -f do_not_cache_me.ko}