Debian Codegraph @

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

raw
1 set test "func_alias"
2
3 if {![utrace_p]} { untested $test; return }
4
5 proc run {subtest pp} {
6 global test
7 verbose -log "subtest $subtest"
8 verbose -log "Running stap -l $pp"
9 set match 0
10 spawn stap -l $pp
11 expect {
12 timeout { fail "$subtest (timeout)" }
13 -re "never" { untested $subtest }
14 -re "main@.*$test\\.c" {
15 if {$match == 0} { pass $subtest; incr match }
16 exp_continue
17 }
18 eof { if {$match == 0} { fail $subtest } }
19 }
20 catch { close }; catch { wait }
21 }
22
23 proc run_one_test {flags bits} {
24 global test srcdir subdir
25
26 verbose -log "testing $bits-bit $test"
27 set source "$srcdir/$subdir/$test.c"
28 set target "[pwd]/$test.x$bits"
29 set flags "additional_flags=-g $flags"
30 set res [target_compile $source $target executable $flags]
31 if { $res != "" } {
32 verbose -log "$target failed: $res"
33 untested "$bits-bit $test"
34 return
35 }
36 run "$bits-bit $test direct" "process(\"$target\").function(\"$test\")"
37 run "$bits-bit $test wildcard" "process(\"$target\").function(\"$test*\")"
38 exec rm -f $target
39 }
40
41 for {set i 0} {$i < [arch_compile_flags]} {incr i} {
42 run_one_test [arch_compile_flag $i] [arch_compile_flag_bits $i]
43 }