Debian Codegraph @

doc/SystemTap_Beginners_Guide/testsuite/systemtap.base/temp-directory.exp

raw
1 # Check keep temporary directory
2 set test "keep temporary directory"
3
4 # Script we'll use while testing:
5 set script "probe begin{exit();}"
6
7 set dir ""
8 spawn stap -k -p1 -e $script
9 expect {
10 -re {Keeping temporary directory \"((/[0-9a-zA-Z]*)+)\"\r\n} {
11 set dir $expect_out(1,string); exp_continue
12 }
13 eof { }
14 }
15 catch {close}; catch {wait}
16
17 if { $dir != "" && [file isdirectory $dir] == 1 } {
18 catch {exec rm -rf $dir}
19 pass "$test (pass1 only)"
20 } else {
21 fail "$test (pass1 only)"
22 }
23
24 if {![installtest_p]} { untested "$test (full run)"; return }
25
26 set dir ""
27 spawn stap -k -e $script
28 expect {
29 -re {Keeping temporary directory \"((/[0-9a-zA-Z]*)+)\"\r\n} {
30 set dir $expect_out(1,string); exp_continue
31 }
32 eof { }
33 }
34 catch {close}; catch {wait}
35
36 if { $dir != "" && [file isdirectory $dir] == 1 } {
37 catch {exec rm -rf $dir}
38 pass "$test (full run)"
39 } else {
40 fail "$test (full run)"
41 }
42