summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.base/badkprobe.exp
blob: b44dacdfe07ece36b28a042d3d9e11684c65913f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
set test "bad kprobe registration"
set script {
    probe $1 {}
    probe timer.ms(100) { exit() }
    probe end { println("cleanup ok") }
}

if {! [installtest_p]} { untested $test; return }

set bad_kprobes {
    kernel.statement(-1).absolute
    kprobe.statement(-1).absolute
    kprobe.function("no_such_function")
    kprobe.function("no_such_function").return
}

foreach bk $bad_kprobes {
    set test "bad kprobe registration: $bk"
    spawn stap -g -w -e "$script" "$bk"
    expect {
        -timeout 60
        -re "^WARNING: probe .*registration error.*\r\ncleanup ok\r\n" { pass $test }
        eof { fail "$test (eof)" }
        timeout { fail "$test (timeout)" }
    }
    catch {close}
    catch {wait}
}

foreach bk $bad_kprobes {
    set test "bad optional kprobe registration: $bk"
    spawn stap -g -w -e "$script" "$bk ?"
    expect {
        -timeout 60
        -re "^cleanup ok\r\n" { pass $test }
        eof { fail "$test (eof)" }
        timeout { fail "$test (timeout)" }
    }
    catch {close}
    catch {wait}
}