| 1 |
set test "bad kprobe registration" |
| 2 |
set script { |
| 3 |
probe $1 { k++ } global k |
| 4 |
probe timer.ms(100) { exit() } |
| 5 |
probe end { println("cleanup ok") } |
| 6 |
} |
| 7 |
|
| 8 |
if {! [installtest_p]} { untested $test; return } |
| 9 |
|
| 10 |
set bad_kprobes { |
| 11 |
kernel.statement(-1).absolute |
| 12 |
kprobe.statement(-1).absolute |
| 13 |
} |
| 14 |
|
| 15 |
foreach bk $bad_kprobes { |
| 16 |
set test "bad kprobe registration: $bk" |
| 17 |
spawn stap -g -e "$script" "$bk" |
| 18 |
expect { |
| 19 |
-timeout 60 |
| 20 |
-re "^WARNING: probe .*registration error.*\r\ncleanup ok\r\n" { pass $test } |
| 21 |
eof { fail "$test (eof)" } |
| 22 |
timeout { fail "$test (timeout)" } |
| 23 |
} |
| 24 |
catch {close} |
| 25 |
catch {wait} |
| 26 |
} |
| 27 |
|
| 28 |
foreach bk $bad_kprobes { |
| 29 |
set test "bad optional kprobe registration: $bk" |
| 30 |
spawn stap -g -w -e "$script" "$bk ?" |
| 31 |
expect { |
| 32 |
-timeout 60 |
| 33 |
-re "^cleanup ok\r\n" { pass $test } |
| 34 |
eof { fail "$test (eof)" } |
| 35 |
timeout { fail "$test (timeout)" } |
| 36 |
} |
| 37 |
catch {close} |
| 38 |
catch {wait} |
| 39 |
} |