| 1 |
# sdt_asm used to be part of sdt_misc, so keep |
| 2 |
# the same test name for result comparisons. |
| 3 |
set test "sdt_misc" |
| 4 |
|
| 5 |
if {! [installtest_p]} { untested "$test"; return } |
| 6 |
|
| 7 |
# Test V3 asm support |
| 8 |
|
| 9 |
proc cleanup_handler { verbose } { |
| 10 |
if { $verbose == 0 } { |
| 11 |
catch {exec rm -f sdt_asm.x} |
| 12 |
} |
| 13 |
} |
| 14 |
|
| 15 |
# Compile a C program to use as the user-space probing target |
| 16 |
set stap_path $env(SYSTEMTAP_PATH)/stap |
| 17 |
|
| 18 |
# 8. Test V3 asm support |
| 19 |
|
| 20 |
if {[istarget "x86_64-*-*"] || [istarget "i*86-*-*"]} { |
| 21 |
set asm_flags [sdt_includes] |
| 22 |
# avoid WARNING for @defined($no_such_var) |
| 23 |
set asm_flags "$asm_flags additional_flags=-g" |
| 24 |
set res [target_compile $srcdir/$subdir/sdt_asm.S sdt_asm.x \ |
| 25 |
executable $asm_flags] |
| 26 |
if { $res != "" } { |
| 27 |
verbose "target_compile failed: $res" 2 |
| 28 |
fail "$test compiling sdt_asm.S" |
| 29 |
} else { |
| 30 |
pass "$test compiling sdt_asm.S" |
| 31 |
} |
| 32 |
|
| 33 |
foreach runtime [get_runtime_list] { |
| 34 |
set test_xtra "" |
| 35 |
if {$runtime != ""} { |
| 36 |
set test_xtra " ($runtime)" |
| 37 |
verbose -log "spawn $stap_path --runtime=$runtime -c [pwd]/sdt_asm.x $srcdir/$subdir/sdt_asm.stp [pwd]/sdt_asm.x" |
| 38 |
spawn $stap_path --runtime=$runtime -c [pwd]/sdt_asm.x $srcdir/$subdir/sdt_asm.stp [pwd]/sdt_asm.x |
| 39 |
} elseif {[uprobes_p]} { |
| 40 |
verbose -log "spawn $stap_path -c [pwd]/sdt_asm.x $srcdir/$subdir/sdt_asm.stp [pwd]/sdt_asm.x" |
| 41 |
spawn $stap_path -c [pwd]/sdt_asm.x $srcdir/$subdir/sdt_asm.stp [pwd]/sdt_asm.x |
| 42 |
} else { |
| 43 |
untested "$test asm" |
| 44 |
continue |
| 45 |
} |
| 46 |
set ok 0 |
| 47 |
set notok 0 |
| 48 |
set fail "" |
| 49 |
expect { |
| 50 |
-timeout 180 |
| 51 |
-re {^sdt_asm PASS: [^\r]*\r\n} { incr ok; exp_continue } |
| 52 |
-indices -re {^sdt_asm FAIL: ([^\r ]*)[^\r]*\r\n} { |
| 53 |
set s $expect_out(1,string); |
| 54 |
incr notok; set fail "$fail $s"; exp_continue } |
| 55 |
-re {^[^\r]*\r\n} { incr notok; exp_continue } |
| 56 |
timeout { fail "$test (timeout)" } |
| 57 |
eof { } |
| 58 |
} |
| 59 |
catch {close}; catch {wait} |
| 60 |
|
| 61 |
if { $notok != 0 || $ok == 0} { |
| 62 |
fail "$test asm${test_xtra} ($ok) $fail" |
| 63 |
} else { |
| 64 |
pass "$test asm${test_xtra} ($ok)" |
| 65 |
} |
| 66 |
} |
| 67 |
} else { unsupported "$test asm" } ; # x86_64 | i.86 |
| 68 |
|
| 69 |
cleanup_handler $verbose |