| 1 |
if {![installtest_p]} { |
| 2 |
for {set i 0} { $i < 16} {incr i} { |
| 3 |
untested cmd_parse$i |
| 4 |
} |
| 5 |
return |
| 6 |
} |
| 7 |
|
| 8 |
spawn stap -u -c {echo "hello world"} -we {probe begin {}} |
| 9 |
expect { |
| 10 |
-timeout 60 |
| 11 |
"hello world" {pass "cmd_parse1"} |
| 12 |
timeout {fail "cmd_parse1: unexpected timeout"} |
| 13 |
eof {fail "cmd_parse1: unexpected EOF"} |
| 14 |
} |
| 15 |
catch { close }; catch { wait } |
| 16 |
|
| 17 |
spawn stap -u -c {echo "hello "\"world\"} -we {probe begin {}} |
| 18 |
expect { |
| 19 |
-timeout 60 |
| 20 |
"hello \"world\"" {pass "cmd_parse2"} |
| 21 |
timeout {fail "cmd_parse2: unexpected timeout"} |
| 22 |
eof {fail "cmd_parse2: unexpected EOF"} |
| 23 |
} |
| 24 |
catch { close }; catch { wait } |
| 25 |
|
| 26 |
spawn stap -u -c {sh -c '(a="hello world"; echo $a)'} -we {probe begin {}} |
| 27 |
expect { |
| 28 |
-timeout 60 |
| 29 |
"hello world" {pass "cmd_parse3"} |
| 30 |
timeout {fail "cmd_parse3: unexpected timeout"} |
| 31 |
eof {fail "cmd_parse3: unexpected EOF"} |
| 32 |
} |
| 33 |
catch { close }; catch { wait } |
| 34 |
|
| 35 |
spawn stap -u -c {sh -c '(a="hello "\"world\"; echo $a)'} -we {probe begin {}} |
| 36 |
expect { |
| 37 |
-timeout 60 |
| 38 |
"hello \"world\"" {pass "cmd_parse4"} |
| 39 |
timeout {fail "cmd_parse4: unexpected timeout"} |
| 40 |
eof {fail "cmd_parse4: unexpected EOF"} |
| 41 |
} |
| 42 |
catch { close }; catch { wait } |
| 43 |
|
| 44 |
spawn stap -u -c {sh -c '(a="hello "world; echo $a)'} -we {probe begin {}} |
| 45 |
expect { |
| 46 |
-timeout 60 |
| 47 |
"hello world" {pass "cmd_parse5"} |
| 48 |
timeout {fail "cmd_parse5: unexpected timeout"} |
| 49 |
eof {fail "cmd_parse5: unexpected EOF"} |
| 50 |
} |
| 51 |
catch { close }; catch { wait } |
| 52 |
|
| 53 |
spawn stap -u -c {bash -c '((a=42+7)); echo "The answer is $a"'} -we {probe begin {}} |
| 54 |
expect { |
| 55 |
-timeout 60 |
| 56 |
"The answer is 49" {pass "cmd_parse6"} |
| 57 |
timeout {fail "cmd_parse6: unexpected timeout"} |
| 58 |
eof {fail "cmd_parse6: unexpected EOF"} |
| 59 |
} |
| 60 |
catch { close }; catch { wait } |
| 61 |
|
| 62 |
spawn stap -u -c {sh -c '(echo "Hello World" 1>&2) > /dev/null'} -we {probe begin {}} |
| 63 |
expect { |
| 64 |
-timeout 60 |
| 65 |
"Hello World" {pass "cmd_parse7"} |
| 66 |
timeout {fail "cmd_parse7: unexpected timeout"} |
| 67 |
eof {fail "cmd_parse7: unexpected EOF"} |
| 68 |
} |
| 69 |
catch { close }; catch { wait } |
| 70 |
|
| 71 |
# slow test case; requires kernel tracepoint query modules |
| 72 |
spawn stap -l {vm.*} |
| 73 |
expect { |
| 74 |
-timeout 240 |
| 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"} |
| 79 |
} |
| 80 |
catch { close }; catch { wait } |
| 81 |
|
| 82 |
spawn stap -e {probe begin { printf("%d %s\n", argc, argv[$1]) exit() }} 1 |
| 83 |
expect { |
| 84 |
-timeout 60 |
| 85 |
"1 1" { pass cmd_parse9 } |
| 86 |
timeout { fail "cmd_parse9 timeout" } |
| 87 |
eof { fail "cmd_parse9 eof" } |
| 88 |
} |
| 89 |
catch { close }; catch { wait } |
| 90 |
|
| 91 |
spawn stap -e {probe begin { printf("%d %s\n", argc, argv[$1]) exit() }} 5 a b c d |
| 92 |
expect { |
| 93 |
-timeout 60 |
| 94 |
"5 d" { pass cmd_parse10 } |
| 95 |
timeout { fail "cmd_parse10 timeout" } |
| 96 |
eof { fail "cmd_parse10 eof" } |
| 97 |
} |
| 98 |
catch { close }; catch { wait } |
| 99 |
|
| 100 |
spawn stap -e {probe begin { printf("%d %s\n", argc, argv[$1]) exit() }} 10 a b c d |
| 101 |
expect { |
| 102 |
-timeout 60 |
| 103 |
"5 " { pass cmd_parse11 } |
| 104 |
timeout { fail "cmd_parse11 timeout" } |
| 105 |
eof { fail "cmd_parse11 eof" } |
| 106 |
} |
| 107 |
catch { close }; catch { wait } |
| 108 |
|
| 109 |
spawn stap -e {probe begin { printf("%d %s\n", argc, argv[0]) exit() }} |
| 110 |
expect { |
| 111 |
-timeout 60 |
| 112 |
"0 " { pass cmd_parse12 } |
| 113 |
timeout { fail "cmd_parse12 timeout" } |
| 114 |
eof { fail "cmd_parse12 eof" } |
| 115 |
} |
| 116 |
catch { close }; catch { wait } |
| 117 |
|
| 118 |
spawn stap -L syscall.a* |
| 119 |
expect { |
| 120 |
-timeout 60 |
| 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"} |
| 124 |
} |
| 125 |
catch { close }; catch { wait } |
| 126 |
|
| 127 |
if {![catch { exec sh -c "stap -v -v --vp 01020 -h 2>&1 | grep -q 'add per-pass verbosity .23242.'" }]} { |
| 128 |
pass "cmd_parse14" |
| 129 |
} else { |
| 130 |
fail "cmd_parse14" |
| 131 |
} |
| 132 |
|
| 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 "*-*-*" |
| 140 |
} |
| 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. |
| 144 |
expect { |
| 145 |
-timeout 60 |
| 146 |
-gl "$uname\r" { pass "cmd_parse15" } |
| 147 |
timeout { fail "cmd_parse15: timeout" } |
| 148 |
eof { fail "cmd_parse15: eof" } |
| 149 |
} |
| 150 |
catch { close }; catch { wait } |
| 151 |
|
| 152 |
set uname [exec uname -i] |
| 153 |
# normalize arch |
| 154 |
set uname [normalize_arch $uname] |
| 155 |
|
| 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. |
| 159 |
expect { |
| 160 |
-timeout 60 |
| 161 |
-re "do_not_cache_me.ko\r" { pass "cmd_parse16" } |
| 162 |
timeout { fail "cmd_parse16: timeout" } |
| 163 |
eof { fail "cmd_parse16: eof" } |
| 164 |
} |
| 165 |
catch { close }; catch { wait } |
| 166 |
|
| 167 |
# NB: when adding extra tests here, increment the ![installtest_p] |
| 168 |
# loop count too at the top. |
| 169 |
|
| 170 |
catch {exec rm -f do_not_cache_me.ko} |