| 1 |
set test "setjmp" |
| 2 |
set ::result_string {hit longjmp_target} |
| 3 |
|
| 4 |
foreach variant [list "" "-DSIGJMP" "-DUNDERJMP"] { |
| 5 |
foreach flags [list "" "-O" "-O -D_FORTIFY_SOURCE=2"] { |
| 6 |
|
| 7 |
set this_test "$test $variant $flags" |
| 8 |
|
| 9 |
set testprog [regsub { } "setjmp.exe${variant}${flags}" ""] |
| 10 |
set test_flags "additional_flags=-g" |
| 11 |
foreach arg "$variant $flags" { |
| 12 |
set test_flags "$test_flags additional_flags=$arg" |
| 13 |
} |
| 14 |
|
| 15 |
set res [target_compile $srcdir/$subdir/$test.c $testprog executable \ |
| 16 |
"$test_flags"] |
| 17 |
if {$res != ""} { |
| 18 |
verbose "target_compile failed: $res" 2 |
| 19 |
fail "compiling $test.c $variant $flags" |
| 20 |
untested $this_test |
| 21 |
continue |
| 22 |
} else { |
| 23 |
pass "compiling $test.c $variant $flags" |
| 24 |
} |
| 25 |
|
| 26 |
if {[catch \ |
| 27 |
{exec stap -l "process(\"/lib*/libc.so.*\").mark(\"*jmp*\")" \ |
| 28 |
2>@1} res]} { |
| 29 |
if {[lindex $::errorCode 0] eq "CHILDSTATUS"} { |
| 30 |
set status [lindex $::errorCode 2] |
| 31 |
if {$status == 1} { |
| 32 |
verbose -log "stap -l check found no libc probes" 1 |
| 33 |
untested $this_test |
| 34 |
continue |
| 35 |
} |
| 36 |
} |
| 37 |
verbose -log "stap -l failed: $res" |
| 38 |
fail "stap -l check for libc probes" |
| 39 |
untested $this_test |
| 40 |
continue |
| 41 |
} else { |
| 42 |
verbose -log "stap -l yields: $res" |
| 43 |
if {$res == ""} { |
| 44 |
verbose -log "stap -l check found no libc probes" 1 |
| 45 |
untested $this_test |
| 46 |
continue |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
if {[installtest_p] && [utrace_p] && [uprobes_p]} { |
| 51 |
stap_run3 $this_test -w --ldd $srcdir/$subdir/$test.stp \ |
| 52 |
$testprog ./$testprog -c ./$testprog |
| 53 |
} else { |
| 54 |
untested $this_test |
| 55 |
} |
| 56 |
} |
| 57 |
} |
| 58 |
if { $verbose == 0 } { |
| 59 |
catch { eval [list exec /bin/rm -f] [glob "setjmp.exe*"] } |
| 60 |
} |