# sdt_asm used to be part of sdt_misc, so keep # the same test name for result comparisons. set test "sdt_misc" if {! [installtest_p]} { untested "$test"; return } # Test V3 asm support proc cleanup_handler { verbose } { if { $verbose == 0 } { catch {exec rm -f sdt_asm.x} } } # Compile a C program to use as the user-space probing target set stap_path $env(SYSTEMTAP_PATH)/stap # 8. Test V3 asm support if {[istarget "x86_64-*-*"] || [istarget "i*86-*-*"]} { set asm_flags [sdt_includes] # avoid WARNING for @defined($no_such_var) set asm_flags "$asm_flags additional_flags=-g" set res [target_compile $srcdir/$subdir/sdt_asm.S sdt_asm.x \ executable $asm_flags] if { $res != "" } { verbose "target_compile failed: $res" 2 fail "$test compiling sdt_asm.S" } else { pass "$test compiling sdt_asm.S" } foreach runtime [get_runtime_list] { set test_xtra "" if {$runtime != ""} { set test_xtra " ($runtime)" verbose -log "spawn $stap_path --runtime=$runtime -c [pwd]/sdt_asm.x $srcdir/$subdir/sdt_asm.stp [pwd]/sdt_asm.x" spawn $stap_path --runtime=$runtime -c [pwd]/sdt_asm.x $srcdir/$subdir/sdt_asm.stp [pwd]/sdt_asm.x } elseif {[uprobes_p]} { verbose -log "spawn $stap_path -c [pwd]/sdt_asm.x $srcdir/$subdir/sdt_asm.stp [pwd]/sdt_asm.x" spawn $stap_path -c [pwd]/sdt_asm.x $srcdir/$subdir/sdt_asm.stp [pwd]/sdt_asm.x } else { untested "$test asm" continue } set ok 0 set notok 0 set fail "" expect { -timeout 180 -re {^sdt_asm PASS: [^\r]*\r\n} { incr ok; exp_continue } -indices -re {^sdt_asm FAIL: ([^\r ]*)[^\r]*\r\n} { set s $expect_out(1,string); incr notok; set fail "$fail $s"; exp_continue } -re {^[^\r]*\r\n} { incr notok; exp_continue } timeout { fail "$test (timeout)" } eof { } } catch {close}; catch {wait} if { $notok != 0 || $ok == 0} { fail "$test asm${test_xtra} ($ok) $fail" } else { pass "$test asm${test_xtra} ($ok)" } } } else { unsupported "$test asm" } ; # x86_64 | i.86 cleanup_handler $verbose