File: fib.exp

package info (click to toggle)
systemtap 3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 32,860 kB
  • ctags: 12,513
  • sloc: cpp: 58,610; ansic: 58,189; exp: 37,322; sh: 10,633; xml: 7,771; perl: 2,252; python: 2,066; tcl: 1,305; makefile: 969; lisp: 105; java: 100; awk: 94; asm: 91; sed: 16
file content (59 lines) | stat: -rw-r--r-- 1,866 bytes parent folder | download | duplicates (8)
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
51
52
53
54
55
56
57
58
59
# Tests backtrace in the classic Fibonacci program


set test "fib"

# Only run on make installcheck and utrace present.
if {! [installtest_p]} { untested "$test"; return }
if {! [utrace_p]} { untested "$test"; return }
if {! [uretprobes_p]} { untested "$test"; return }

set testpath  "$srcdir/$subdir"
set testsrc   "$testpath/fib.c"
set testexe   "[pwd]/$test"

# We want debug info and no optimization (is that totally necessary?)
set testflags "additional_flags=-g additional_flags=-O0"
set teststp   "$testpath/$test.stp"

# When possible explicitly set 64 bit mode if kernel is 64 bit. So, we
# grab the 1st set of compile flags.
set arch_flag [arch_compile_flag 0]
if { $arch_flag != "" } {
    set testflags "$testflags $arch_flag"
}

set res [target_compile $testsrc $testexe executable $testflags]
if { $res != "" } {
    verbose "target_compile failed: $res" 2
    fail "unable to compile $testsrc"
    return
}

spawn stap -c "$testexe 10" $teststp
set fibcalls 0
set maincalls 0
expect {
    -timeout 120
    -re {^fib[^\r\n]*[\r\n]} { incr fibcalls; exp_continue }
    -re {^main[^\r\n]*[\r\n]} { incr maincalls; exp_continue }
    -re {^[^\r\n]*[\r\n]} {exp_continue}
    timeout { fail "$test (timeout)" }
    eof { }
}
catch { close }; catch { wait }
if {$fibcalls == 18 && $maincalls == 2} { pass "$test ($fibcalls $maincalls)" } { fail "$test ($fibcalls $maincalls)" }

spawn stap -c "$testexe 10" -- $teststp --entry
set fibcalls 0
set maincalls 0
expect {
    -timeout 120
    -re {^fib[^\r\n]*[\r\n]} { incr fibcalls; exp_continue }
    -re {^main[^\r\n]*[\r\n]} { incr maincalls; exp_continue }
    -re {^[^\r\n]*[\r\n]} {exp_continue}
    timeout { fail "$test (timeout)" }
    eof { }
}
catch { close }; catch { wait }
if {$fibcalls == 55 && $maincalls == 10} { pass "$test ($fibcalls $maincalls)" } { fail "$test ($fibcalls $maincalls)" }