summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.apps/tcl.exp
blob: 4c4a43428b1ab0ce91015d9aa36ce55feba87e60 (plain)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
set test "tcl"

# Test sdt support in tcl.

global env

if {! [info exists env(SYSTEMTAP_TESTAPPS)] || (
    ! [string match "tcl" $env(SYSTEMTAP_TESTAPPS)] &&
    ! [string match "all" $env(SYSTEMTAP_TESTAPPS)])} {
    untested "$test sdt app"
    return
}

########## Create /tmp/stap-tcl.stp ########## 
set tclreleasemajor "8.6"
set tclrelease "8.6b1"
set tcldir "[pwd]/tcl/install/"
set testsuite "[pwd]"

verbose -log "Building tcl"
set test "tcl${tclreleasemajor} build"
set rc [catch {exec sh $srcdir/$subdir/stap-tcl.sh 2>@ stdout} out]
if {$rc != 0} {
    clone_output $out
    fail $test
    return
} else {
    pass $test
}

set test "stap-tcl.stp compilation"
verbose -log "spawn stap -DMAXSKIPPED=8024 -t -p4 $srcdir/$subdir/stap-tcl.stp tcl/install/bin/tclsh${tclreleasemajor} tcl/install/lib/libtcl${tclreleasemajor}.so"
set rc [catch {exec stap -DMAXSKIPPED=8024 -t -p4 $srcdir/$subdir/stap-tcl.stp tcl/install/bin/tclsh${tclreleasemajor} tcl/install/lib/libtcl${tclreleasemajor}.so} out]
clone_output $out
if {$rc != 0} {
    fail $test
    return
} else {
    pass $test
}

set test "stap-tcl.stp execution"
if {![installtest_p]} {
    untested $test
    return
}

set ok 0
set ko 0
set lines 0
verbose -log "spawn stap -DMAXSKIPPED=8024 -t -c \"tcl/install/bin/tclsh${tclreleasemajor} tcl/src/tests/all.tcl > tcl-test.out\" $srcdir/$subdir/stap-tcl.stp tcl/install/bin/tclsh${tclreleasemajor} tcl/install/lib/libtcl${tclreleasemajor}.so"
spawn stap -DMAXSKIPPED=8024 -t -c "tcl/install/bin/tclsh${tclreleasemajor} tcl/src/tests/all.tcl > tcl-test.out" $srcdir/$subdir/stap-tcl.stp tcl/install/bin/tclsh${tclreleasemajor} tcl/install/lib/libtcl${tclreleasemajor}.so
expect {
    -timeout 1000
    -re {^OK [^\r\n]*[\r\n]} { incr ok; exp_continue }
    -re {^KO [^\r\n]*[\r\n]} { incr ko; exp_continue }
    -re {^ERROR: Skipped[^\r\n]*[\r\n]} { incr xok; exp_continue }
    -re {^ERROR[^\r\n]*[\r\n]} { incr ko; exp_continue }
    -re {^[^\r\n]*[\r\n]} { incr lines; exp_continue }
    timeout { fail "$test (timeout)" }
    eof { }
}
catch {close}; catch {wait}

if {$ok == 14 && $ko == 0} {
    pass "$test ($ok $ko $lines)"
} else {
    fail "$test ($ok $ko $lines)"
}
if {$xok == 1} {
    xfail "$test (skipped probes)"
}