blob: 6344cbf0ad91c65d65324c373440bff607986ac0 (
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
42
43
44
45
46
47
48
49
50
|
set test uprobes
# Compile a little C program to use as the user-space probing victim
set path "jennie.c"
set fp [open $path "w"]
puts $fp "int main (int argc, char *argv[])"
puts $fp "{"
puts $fp "if (argc > 1) main (argc - 1, argv);"
puts $fp "return 0;"
puts $fp "}"
close $fp
# too easy
if [file exists $path] then { pass "$test prep" } else { fail "$test prep" }
catch {exec gcc -g -o jennie jennie.c} err
if {$err == "" && [file exists jennie]} then { pass "$test compile" } else { fail "$test compile" }
if {![utrace_p]} {
untested "$test -p4"; untested "$test -p5"
catch {exec rm -f jennie.c jennie}
return
}
set rc [stap_run_batch $srcdir/$subdir/uprobes.stp]
if {$rc == 0} then { pass "$test -p4" } else { fail "$test -p4" }
if {! [installtest_p]} {
untested "$test -p5";
catch {exec rm -f jennie.c jennie}
return
}
# Pick up the stap being tested.
set stapexe [exec /usr/bin/which stap]
spawn sudo $stapexe $srcdir/$subdir/uprobes.stp -w -c "./jennie 1 2 3 4"
set ok 0
expect {
-re {^process[^\r\n]*jennie[^\r\n]*main[^\r\n]*argc=0x[1-5][^\r\n]*\r\n} { incr ok; exp_continue }
-re {^process[^\r\n]*jennie[^\r\n]*main[^\r\n]*return=0x0[^\r\n]*\r\n} { incr ok; exp_continue }
-timeout 30
timeout { }
eof { }
}
if {$ok == 10} then { pass "$test -p5" } else { fail "$test -p5 ($ok)" }
catch {wait; close}
catch {exec rm -f jennie.c jennie}
|