summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.samples/primes.exp
blob: f99f67cc202562ef0f981fc18477d0bdea4aaa0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
set test "primes"
if {![installtest_p]} { untested $test; return }

spawn stap $srcdir/$subdir/primes.stp
set ok 0
expect {
    -timeout 150
    -ex {odds[0] = 1} { incr ok; exp_continue }
    -ex {odds[1] = 3} { incr ok; exp_continue }
    -ex {odds[3] = 7} { incr ok; exp_continue }
    -ex {odds[4] = 9} { incr ok; exp_continue }
    -ex {evens[2] = 6} { incr ok; exp_continue }
    -ex {evens[1] = 4} { incr ok; exp_continue }
    -ex {evens[0] = 2} { incr ok; exp_continue }
    timeout { fail "$test (timeout)" }
    eof { }
}
#FIXME does not handle case of hanging primes.stp correctly
wait

if {$ok == 7} { pass "$test" } { fail "$test" }