summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.base/bz5274.exp
blob: db0e0a46cd092a2f4aeb696f675fb612cc2cf55c (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
set test "./bz5274"
set tpath "$srcdir/$subdir/$test"
set arch [exec uname -m]

if {$arch == "ppc64"} {
	catch {exec gcc -o $test -g -m64 $srcdir/$subdir/$test.c} err
} else {
	catch {exec gcc -o $test -g $srcdir/$subdir/$test.c} err
}


if {$err == "" && [file exists $test]} then { pass "$test compile"
} else {fail "$test compile"}

if {! [installtest_p]} { untested "$test -p5"; return }

# Try to find utrace_attach symbol in /proc/kallsyms
# copy from utrace_p5.exp
set utrace_support_found 0
set path "/proc/kallsyms"
if {! [catch {exec grep -q utrace_attach $path} dummy]} {
    set utrace_support_found 1
}
if {$utrace_support_found == 0} { untested "$test -p5"; return }

if {[catch {exec stap $tpath.stp -c "$srcdir/$subdir/$test.sh"} res]} {
    untested "$test longjmp to a uretprobed function"
    puts "$res"
 #   catch {exec rm -f $test.out}
} else {
    if {[catch {exec cmp $test.out $srcdir/$subdir/$test.exp_out} res]} {
        fail "$test longjmp to a uretprobed function"
        puts "$res"
#        catch {exec rm -f $test.out}
    } else {
        pass "$test longjmp to a uretprobed function"
 #       catch {exec rm -f $test.out}
    }
}

if {[catch {exec stap $tpath.a.stp -c $srcdir/$subdir/$test.sh} res]} {
    untested "$test longjmp to a non-uretprobed function"
    puts "$res"
    catch {exec rm -f $test.out $test}
    return
} else {
    if {[catch {exec cmp $test.out $srcdir/$subdir/$test.exp_out} res]} {
        fail "$test longjmp to a non-uretprobed function"
        puts "$res"
        catch {exec rm -f $test.out $test}
        return
    } else {
        pass "$test longjmp to a non-uretprobed function"
        catch {exec rm -f $test.out $test}
    }
}