Debian Codegraph @

doc/SystemTap_Beginners_Guide/testsuite/systemtap.base/task_paths.exp

raw
1 set test "task_paths"
2 set stapio_path $env(PKGLIBDIR)/stapio
3
4 # Only run on make installcheck
5 if {! [installtest_p]} { untested "$test"; return }
6
7 # Run the test script on 'whoami'
8 spawn stap $srcdir/$subdir/$test.stp -c whoami
9 verbose -log "stap $srcdir/$subdir/$test.stp -c whoami"
10
11 set pwd "[pwd]"
12 set found_cwd 0
13 set found_stapio 0
14 set found_whoami 0
15 set found_error 0
16 expect {
17 -timeout 180
18 -re "^current cwd: $pwd\r\n" { incr found_cwd; exp_continue }
19 -re "^current exe: $stapio_path\r\n" { incr found_stapio; exp_continue }
20 -re "^target cwd: $pwd\r\n" { incr found_cwd; exp_continue }
21 -re "^target exe: $stapio_path\r\n" { incr found_stapio; exp_continue }
22 -re {^ERROR: [^\r\n]+\r\n} { incr found_error;
23 exp_continue }
24 -re {^current exe: /[^\r\n]+/whoami\r\n} { incr found_whoami; exp_continue }
25
26 -re {^[^\r\n]+\r\n} {
27 # ignore everything else
28 exp_continue }
29 eof { }
30 timeout { fail "$test (timeout)" }
31 }
32 catch {close}; catch {wait}
33
34 # On older kernels, we can't get the cwd.
35 if {$found_cwd == 0 && ![min_kernel_vers_p 2.6.25]} {
36 setup_kfail NO_CWD *-*-*
37 }
38
39 if {$found_cwd == 2 && $found_stapio == 1 && $found_error == 2
40 && $found_whoami == 1} {
41 pass "$test"
42 } else {
43 fail "$test ($found_cwd, $found_stapio, $found_error, $found_whoami)"
44 }
45
46 return