From a36becbcb452d60edd20324cf03bbe7b437fe071 Mon Sep 17 00:00:00 2001 From: David Smith Date: Wed, 6 Feb 2013 09:28:59 -0600 Subject: [PATCH] PR14574 partial fix: Add dyninst testcase support. * testsuite/systemtap.base/rand.exp: Add dyninst support. * testsuite/systemtap.base/sdt.exp: Ditto. * testsuite/systemtap.base/sdt_misc.exp: Ditto. * testsuite/systemtap.base/sdt_va_args.exp: Ditto. * testsuite/systemtap.base/simple.exp: Ditto. * testsuite/systemtap.base/stmt_rel_user.exp: Ditto. * testsuite/systemtap.base/suppress-time-limit.exp: Ditto. * testsuite/systemtap.base/tri.exp: Ditto. * testsuite/systemtap.base/trycatch.exp: Ditto. --- testsuite/systemtap.base/rand.exp | 8 +- testsuite/systemtap.base/sdt.exp | 62 +- testsuite/systemtap.base/sdt_misc.exp | 542 +++++++++++------- testsuite/systemtap.base/sdt_va_args.exp | 17 +- testsuite/systemtap.base/simple.exp | 8 +- testsuite/systemtap.base/stmt_rel_user.exp | 102 ++-- .../systemtap.base/suppress-time-limit.exp | 95 +-- testsuite/systemtap.base/tri.exp | 9 +- testsuite/systemtap.base/trycatch.exp | 81 +-- 9 files changed, 560 insertions(+), 364 deletions(-) diff --git a/testsuite/systemtap.base/rand.exp b/testsuite/systemtap.base/rand.exp index 9b372e18a..90b43e6f6 100644 --- a/testsuite/systemtap.base/rand.exp +++ b/testsuite/systemtap.base/rand.exp @@ -1,3 +1,9 @@ set test "rand" set ::result_string {PASS} -stap_run2 $srcdir/$subdir/$test.stp +foreach runtime [get_runtime_list] { + if {$runtime != ""} { + stap_run2 $srcdir/$subdir/$test.stp --runtime=$runtime + } else { + stap_run2 $srcdir/$subdir/$test.stp + } +} diff --git a/testsuite/systemtap.base/sdt.exp b/testsuite/systemtap.base/sdt.exp index 52f21f4cb..9bf548851 100644 --- a/testsuite/systemtap.base/sdt.exp +++ b/testsuite/systemtap.base/sdt.exp @@ -33,26 +33,42 @@ set pbtype_flags {{""} {additional_flags=-DSTAP_SDT_V2}} set pbtype_mssgs {{uprobe} {V2_uprobe}} proc sdt_stap_run { TEST_NAME TEST_FILE FAIL args } { - set cmd [concat stap $TEST_FILE $args] - send_log "executing: $cmd\n" - catch {eval exec $cmd} res - - set n 0 - set expected [split $::result_string "\n"] - foreach line [split $res "\n"] { - if {![string equal $line [lindex $expected $n]]} { - $FAIL "$TEST_NAME" - send_log "line [expr $n + 1]: expected \"[lindex $expected $n]\"\n" - send_log "Got \"$line\"\n" - return + foreach runtime [get_runtime_list] { + set full_test_name $TEST_NAME + if {$runtime != ""} { + lappend full_test_name "($runtime)" + set cmd [concat stap --runtime=$runtime $TEST_FILE $args] + } elseif {[uprobes_p]} { + set cmd [concat stap $TEST_FILE $args] + } else { + untested $full_test_name + continue + } + send_log "executing: $cmd\n" + catch {eval exec $cmd} res + + set skip 0 + set n 0 + set expected [split $::result_string "\n"] + foreach line [split $res "\n"] { + if {![string equal $line [lindex $expected $n]]} { + $FAIL "$full_test_name" + send_log "line [expr $n + 1]: expected \"[lindex $expected $n]\"\n" + send_log "Got \"$line\"\n" + set skip 1 + break + } + incr n + } + if {$skip != 0} { + continue + } + if {[expr $n == [llength $expected]]} { + pass "$full_test_name" + } else { + $FAIL "$full_test_name" + send_log "too few lines of output, got $n, expected [llength $expected]\n" } - incr n - } - if {[expr $n == [llength $expected]]} { - pass "$TEST_NAME" - } else { - $FAIL "$TEST_NAME" - send_log "too few lines of output, got $n, expected [llength $expected]\n" } } @@ -93,8 +109,9 @@ if { $res != "" } { pass "compiling $test.c $extra_mssg $type_pedantic_mssg $pbtype_mssg" } -if {[installtest_p] && [utrace_p] && [uprobes_p]} { - if {[regexp "^(ppc64|s390x)$" $::tcl_platform(machine)] && [regexp "^(-O)" $extra_mssg]} { +if {[installtest_p]} { + if {[regexp "^(ppc64|s390x)$" $::tcl_platform(machine)] \ + && [regexp "^(-O)" $extra_mssg]} { # register name and constant is ambiguous in ppc/s390 asm syntax # thus constant folding can throw the result off set FAIL xfail @@ -105,7 +122,8 @@ if {[installtest_p] && [utrace_p] && [uprobes_p]} { if { $pbtype_mssg == "uprobe" } { append ::result_string $result_string12 } - sdt_stap_run "$test $extra_mssg $type_pedantic_mssg $pbtype_mssg" -w $FAIL $srcdir/$subdir/$test.stp $testprog -c ./$testprog + sdt_stap_run "$test $extra_mssg $type_pedantic_mssg $pbtype_mssg" \ + -w $FAIL $srcdir/$subdir/$test.stp $testprog -c ./$testprog } else { untested "$test $extra_mssg $type_pedantic_mssg $pbtype_mssg" } diff --git a/testsuite/systemtap.base/sdt_misc.exp b/testsuite/systemtap.base/sdt_misc.exp index 09a9770c9..57331ab61 100644 --- a/testsuite/systemtap.base/sdt_misc.exp +++ b/testsuite/systemtap.base/sdt_misc.exp @@ -87,43 +87,48 @@ for {set i 0} {$i < [llength $pbtype_flags]} {incr i} { if {![installtest_p]} { untested $test cleanup_handler $verbose - return} - if {![uprobes_p]} { - untested $test - cleanup_handler $verbose - return} - if {![utrace_p]} { - untested "$test" - cleanup_handler $verbose return } # 1. Test executable built with dtrace generated header file - set ok 0 - - verbose -log "spawn $stap_path -c $sup_exepath $srcdir/$subdir/sdt_misc.stp $sup_exepath" - spawn $stap_path -c $sup_exepath $srcdir/$subdir/sdt_misc.stp $sup_exepath - expect { - -timeout 180 - -re {In test_probe_2 probe 0x2} { incr ok; exp_continue } - -re {In test_probe_0 probe 0x3} { incr ok; exp_continue } - -re {In test_probe_3 probe 0x3 0x[0-9a-f][0-9a-f]} { - incr ok; exp_continue } - -re {In test_probe_4 dtrace probe 0x[0-9a-f]} { incr ok; exp_continue } - -re {In test_probe_1 probe 0x0} { incr ok; exp_continue } - timeout { fail "$test (timeout)" } - eof { } - } - catch {close}; catch {wait} + foreach runtime [get_runtime_list] { + set test_xtra "" + if {$runtime != ""} { + set test_xtra " ($runtime)" + verbose -log "spawn $stap_path --runtime=$runtime -c $sup_exepath $srcdir/$subdir/sdt_misc.stp $sup_exepath" + spawn $stap_path --runtime=$runtime -c $sup_exepath \ + $srcdir/$subdir/sdt_misc.stp $sup_exepath + } elseif {[uprobes_p]} { + verbose -log "spawn $stap_path -c $sup_exepath $srcdir/$subdir/sdt_misc.stp $sup_exepath" + spawn $stap_path -c $sup_exepath $srcdir/$subdir/sdt_misc.stp \ + $sup_exepath + } else { + untested "$test ${pbtype_mssg}" + continue + } + set ok 0 + expect { + -timeout 180 + -re {In test_probe_2 probe 0x2} { incr ok; exp_continue } + -re {In test_probe_0 probe 0x3} { incr ok; exp_continue } + -re {In test_probe_3 probe 0x3 0x[0-9a-f][0-9a-f]} { + incr ok; exp_continue } + -re {In test_probe_4 dtrace probe 0x[0-9a-f]} { incr ok; exp_continue } + -re {In test_probe_1 probe 0x0} { incr ok; exp_continue } + timeout { fail "$test (timeout)" } + eof { } + } + catch {close}; catch {wait} - if {$ok == 6} { - pass "$test $pbtype_mssg" - } else { - if {[istarget "arm-*-*"] && $pbtype_mssg == "V2_uprobe"} { - xfail "$test ($ok) $pbtype_mssg" + if {$ok == 6} { + pass "$test ${pbtype_mssg}${test_xtra}" } else { - fail "$test ($ok) $pbtype_mssg" + if {[istarget "arm-*-*"] && $pbtype_mssg == "V2_uprobe"} { + xfail "$test ($ok) ${pbtype_mssg}${test_xtra}" + } else { + fail "$test ($ok) ${pbtype_mssg}${test_xtra}" + } } } @@ -142,53 +147,71 @@ for {set i 0} {$i < [llength $pbtype_flags]} {incr i} { pass "$test compiling $pbtype_mssg -DLOOP" } - # This is perhaps a wee bit clumsy - verbose -log "$loop_exepath >| ,semclean 2>&1 & TEST=\$! ; \ - $stap_path $srcdir/$subdir/sdt_misc.stp $loop_exepath >| ,semout ; \ - /usr/bin/kill -SIGINT \$TEST" - system "$loop_exepath >,semclean 2>&1 & TEST=\$! ; \ - $stap_path $srcdir/$subdir/sdt_misc.stp $loop_exepath >| ,semout ; \ - /usr/bin/kill -SIGINT \$TEST" - - set ok 0 - set ko 0 - spawn cat ,semout - expect { - -re {In test_probe_2 probe 0x2} { incr ok; exp_continue } - -re {In test_probe_0 probe 0x3} { incr ok; exp_continue } - -re {In test_probe_3 probe 0x3 0x[0-9a-f][0-9a-f]} { - incr ok; exp_continue } - -re {In test_probe_4 dtrace probe 0x[0-9a-f]} { incr ok; exp_continue } - -re {In test_probe_1 probe 0x0} { incr ok; exp_continue } - eof { } - } - catch {close}; catch {wait} - - if {$ok == 6} { - pass "$test $pbtype_mssg attach" - } else { - if {[istarget "arm-*-*"] && $pbtype_mssg == "V2_uprobe"} { - xfail "$test ($ok) $pbtype_mssg attach" + foreach runtime [get_runtime_list] { + set test_xtra "" + if {$runtime != ""} { + set test_xtra " ($runtime)" + # This is perhaps a wee bit clumsy + verbose -log "$loop_exepath >| ,semclean 2>&1 & TEST=\$! ; \ + $stap_path --runtime=$runtime $srcdir/$subdir/sdt_misc.stp $loop_exepath >| ,semout ; \ + /usr/bin/kill -SIGINT \$TEST" + system "$loop_exepath >,semclean 2>&1 & TEST=\$! ; \ + $stap_path --runtime=$runtime $srcdir/$subdir/sdt_misc.stp $loop_exepath >| ,semout ; \ + /usr/bin/kill -SIGINT \$TEST" + } elseif {[uprobes_p]} { + # This is perhaps a wee bit clumsy + verbose -log "$loop_exepath >| ,semclean 2>&1 & TEST=\$! ; \ + $stap_path $srcdir/$subdir/sdt_misc.stp $loop_exepath >| ,semout ; \ + /usr/bin/kill -SIGINT \$TEST" + system "$loop_exepath >,semclean 2>&1 & TEST=\$! ; \ + $stap_path $srcdir/$subdir/sdt_misc.stp $loop_exepath >| ,semout ; \ + /usr/bin/kill -SIGINT \$TEST" } else { - fail "$test ($ok) $pbtype_mssg attach" + untested "$test $pbtype_mssg attach" + continue + } + + set ok 0 + set ko 0 + spawn cat ,semout + expect { + -re {In test_probe_2 probe 0x2} { incr ok; exp_continue } + -re {In test_probe_0 probe 0x3} { incr ok; exp_continue } + -re {In test_probe_3 probe 0x3 0x[0-9a-f][0-9a-f]} { + incr ok; exp_continue } + -re {In test_probe_4 dtrace probe 0x[0-9a-f]} { + incr ok; exp_continue } + -re {In test_probe_1 probe 0x0} { incr ok; exp_continue } + eof { } + } + catch {close}; catch {wait} + + if {$ok == 6} { + pass "$test ${pbtype_mssg}${test_xtra} attach" + } else { + if {[istarget "arm-*-*"] && $pbtype_mssg == "V2_uprobe"} { + xfail "$test ($ok) ${pbtype_mssg}${test_xtra} attach" + } else { + fail "$test ($ok) ${pbtype_mssg}${test_xtra} attach" + } + } + + set ok 0 + spawn cat ,semclean + expect { + -timeout 180 + -re {PASS} { incr ok; exp_continue } + -re {FAIL} { incr ko; exp_continue } + timeout { fail "$test (timeout)" } + eof { } + } + catch {close}; catch {wait} + + if {$ok == 4 && $ko == 0} { + pass "$test ${pbtype_mssg}${test_xtra} epilogue" + } else { + fail "$test ($ok) ${pbtype_mssg}${test_xtra} epilogue" } - } - - set ok 0 - spawn cat ,semclean - expect { - -timeout 180 - -re {PASS} { incr ok; exp_continue } - -re {FAIL} { incr ko; exp_continue } - timeout { fail "$test (timeout)" } - eof { } - } - catch {close}; catch {wait} - - if {$ok == 4 && $ko == 0} { - pass "$test $pbtype_mssg epilogue" - } else { - fail "$test ($ok) $pbtype_mssg epilogue" } # 3. Test passing various C types to .mark probes @@ -231,13 +254,13 @@ for {set i 0} {$i < [llength $pbtype_flags]} {incr i} { set type_flags "$type_flags additional_flags=-m64" } set test_suffix "$pbtype_mssg $extra_type_mssg $type_pedantic_mssg" - + # On ARM these tests are known to fail with timeout for V1 # and V2 probes. Skip them altogether to speed execution. if {[istarget "arm-*-*"] \ - && ($pbtype_mssg == "V1_uprobe" \ - || $pbtype_mssg == "V2_kprobe" \ - || $pbtype_mssg == "V2_uprobe")} { + && ($pbtype_mssg == "V1_uprobe" \ + || $pbtype_mssg == "V2_kprobe" \ + || $pbtype_mssg == "V2_uprobe")} { xfail "$test types $test_suffix" continue } @@ -259,34 +282,49 @@ for {set i 0} {$i < [llength $pbtype_flags]} {incr i} { pass "$test compiling types $test_suffix" } - set ok 0 - set notok 0 - set fail "types" - set uns_notok 0 - verbose -log "spawn $stap_path -g -c ./sdt_types.x $srcdir/$subdir/sdt_types.stp ./sdt_types.x # $pbtype_mssg $extra_type_mssg" - spawn $stap_path -g -c ./sdt_types.x $srcdir/$subdir/sdt_types.stp ./sdt_types.x - expect { - -timeout 180 - # i386 unsigned may xfail because of sign extension - # but fail anything else - -re {FAIL: [a-z_]+var} { regexp " .*$" $expect_out(0,string) s; - if {[regexp "unsigned" $s] && [istarget "i*86-*-*"]} { - incr uns_notok } - incr notok; set fail "$fail $s"; exp_continue } - -re {PASS: [a-z_]+var} { incr ok; exp_continue } - timeout { fail "$test (timeout) $test_suffix" } - eof { } - } - catch {close}; catch {wait} - - if { $notok != 0 || $ok == 0} { - if { [lindex $type_xfail $j] || $notok == $uns_notok} { - xfail "$test types $fail $test_suffix" + foreach runtime [get_runtime_list] { + set test_xtra "" + if {$runtime != ""} { + set test_xtra " ($runtime)" + verbose -log "spawn $stap_path --runtime=$runtime -g -c ./sdt_types.x $srcdir/$subdir/sdt_types.stp ./sdt_types.x # $pbtype_mssg $extra_type_mssg" + spawn $stap_path --runtime=$runtime -g -c ./sdt_types.x $srcdir/$subdir/sdt_types.stp ./sdt_types.x + } elseif {[uprobes_p]} { + verbose -log "spawn $stap_path -g -c ./sdt_types.x $srcdir/$subdir/sdt_types.stp ./sdt_types.x # $pbtype_mssg $extra_type_mssg" + spawn $stap_path -g -c ./sdt_types.x $srcdir/$subdir/sdt_types.stp ./sdt_types.x } else { - fail "$test types $fail $test_suffix" + untested "$test types $test_suffix" + continue + } + set test_suffix "${pbtype_mssg}${test_xtra} $extra_type_mssg $type_pedantic_mssg" + + set ok 0 + set notok 0 + set fail "types" + set uns_notok 0 + expect { + -timeout 180 + # i386 unsigned may xfail because of sign extension + # but fail anything else + -re {FAIL: [a-z_]+var} { + regexp " .*$" $expect_out(0,string) s + if {[regexp "unsigned" $s] && [istarget "i*86-*-*"]} { + incr uns_notok } + incr notok; set fail "$fail $s"; exp_continue } + -re {PASS: [a-z_]+var} { incr ok; exp_continue } + timeout { fail "$test types (timeout) $test_suffix" } + eof { } + } + catch {close}; catch {wait} + + if { $notok != 0 || $ok == 0} { + if { [lindex $type_xfail $j] || $notok == $uns_notok} { + xfail "$test types $fail $test_suffix" + } else { + fail "$test types $fail $test_suffix" + } + } else { + pass "$test types $test_suffix" } - } else { - pass "$test types $test_suffix" } } ; # end type_pedantics_idx } ; # end extra_type_flags @@ -314,29 +352,41 @@ for {set i 0} {$i < [llength $pbtype_flags]} {incr i} { pass "$test compiling -shared $pbtype_mssg" } - set ok 0 - verbose -log "spawn $stap_path -c $sup_exepath $srcdir/$subdir/sdt_misc.stp $sup_exepath $sup_sopath" - spawn $stap_path -c $sup_exepath $srcdir/$subdir/sdt_misc.stp $sup_exepath $sup_sopath - expect { - -timeout 180 - -re {In test_probe_2 probe 0x2} { incr ok; exp_continue } - -re {In test_probe_0 probe 0x3} { incr ok; exp_continue } - -re {In test_probe_3 probe 0x3 0x[0-9a-f][0-9a-f]} { - incr ok; exp_continue } - -re {In test_probe_4 dtrace probe 0x[0-9a-f]} { incr ok; exp_continue } - -re {In test_probe_1 probe 0x0} { incr ok; exp_continue } - timeout { fail "$test (timeout)" } - eof { } - } - catch {close}; catch {wait} + foreach runtime [get_runtime_list] { + set test_xtra "" + if {$runtime != ""} { + set test_xtra " ($runtime)" + verbose -log "spawn $stap_path --runtime=$runtime -c $sup_exepath $srcdir/$subdir/sdt_misc.stp $sup_exepath $sup_sopath" + spawn $stap_path --runtime=$runtime -c $sup_exepath $srcdir/$subdir/sdt_misc.stp $sup_exepath $sup_sopath + } elseif {[uprobes_p]} { + verbose -log "spawn $stap_path -c $sup_exepath $srcdir/$subdir/sdt_misc.stp $sup_exepath $sup_sopath" + spawn $stap_path -c $sup_exepath $srcdir/$subdir/sdt_misc.stp $sup_exepath $sup_sopath + } else { + untested "$test shared $pbtype_msg" + continue + } + set ok 0 + expect { + -timeout 180 + -re {In test_probe_2 probe 0x2} { incr ok; exp_continue } + -re {In test_probe_0 probe 0x3} { incr ok; exp_continue } + -re {In test_probe_3 probe 0x3 0x[0-9a-f][0-9a-f]} { + incr ok; exp_continue } + -re {In test_probe_4 dtrace probe 0x[0-9a-f]} { incr ok; exp_continue } + -re {In test_probe_1 probe 0x0} { incr ok; exp_continue } + timeout { fail "$test (timeout)" } + eof { } + } + catch {close}; catch {wait} - if {$ok == 6} { - pass "$test shared $pbtype_mssg" - } else { - if {[istarget "arm-*-*"] && $pbtype_mssg == "V2_uprobe"} { - xfail "$test ($ok) shared $pbtype_mssg" + if {$ok == 6} { + pass "$test shared ${pbtype_mssg}${test_xtra}" } else { - fail "$test ($ok) shared $pbtype_mssg" + if {[istarget "arm-*-*"] && $pbtype_mssg == "V2_uprobe"} { + xfail "$test ($ok) shared ${pbtype_mssg}${test_xtra}" + } else { + fail "$test ($ok) shared ${pbtype_mssg}${test_xtra}" + } } } @@ -365,55 +415,72 @@ for {set i 0} {$i < [llength $pbtype_flags]} {incr i} { pass "$test compiling $test_suffix" } - # This is perhaps a wee bit clumsy - verbose -log "$loop_exepath >| ,semclean 2>&1 & TEST=\$! ; \ - $stap_path $srcdir/$subdir/sdt_misc.stp $loop_exepath $supl_sopath >| ,semout ; \ - /usr/bin/kill -SIGINT \$TEST" - system "$loop_exepath >,semclean 2>&1 & TEST=\$! ; \ - $stap_path $srcdir/$subdir/sdt_misc.stp $loop_exepath $supl_sopath >| ,semout ; \ - /usr/bin/kill -SIGINT \$TEST" - - set ok 0 - set ko 0 - spawn cat ,semout - expect { - -re {In test_probe_2 probe 0x2} { incr ok; exp_continue } - -re {In test_probe_0 probe 0x3} { incr ok; exp_continue } - -re {In test_probe_3 probe 0x3 0x[0-9a-f][0-9a-f]} { - incr ok; exp_continue } - -re {In test_probe_4 dtrace probe 0x[0-9a-f]} { incr ok; exp_continue } - -re {In test_probe_1 probe 0x0} { incr ok; exp_continue } - eof { } - } - catch {close}; catch {wait} - - if {$ok == 6} { - pass "$test $pbtype_mssg shared attach" - } else { - if {[istarget "arm-*-*"] && $pbtype_mssg == "V2_uprobe"} { - xfail "$test ($ok) $pbtype_mssg shared attach" + foreach runtime [get_runtime_list] { + set test_xtra "" + if {$runtime != ""} { + set test_xtra " ($runtime)" + # With --runtime=dyninst these tests will fail since the + # dyninst runtime needs a target executable (either '-c + # exe' or '-x pid'). So, skip these tests to speed up test + # execution. + xfail "$test ${pbtype_mssg}${test_xtra} shared attach" + continue + } elseif {[uprobes_p]} { + # This is perhaps a wee bit clumsy + verbose -log "$loop_exepath >| ,semclean 2>&1 & TEST=\$! ; \ + $stap_path $srcdir/$subdir/sdt_misc.stp $loop_exepath $supl_sopath >| ,semout ; \ + /usr/bin/kill -SIGINT \$TEST" + system "$loop_exepath >,semclean 2>&1 & TEST=\$! ; \ + $stap_path $srcdir/$subdir/sdt_misc.stp $loop_exepath $supl_sopath >| ,semout ; \ + /usr/bin/kill -SIGINT \$TEST" } else { - fail "$test ($ok) $pbtype_mssg shared attach" + untested "$test $pbtype_mssg shared attach" + continue + } + + set ok 0 + set ko 0 + spawn cat ,semout + expect { + -re {In test_probe_2 probe 0x2} { incr ok; exp_continue } + -re {In test_probe_0 probe 0x3} { incr ok; exp_continue } + -re {In test_probe_3 probe 0x3 0x[0-9a-f][0-9a-f]} { + incr ok; exp_continue } + -re {In test_probe_4 dtrace probe 0x[0-9a-f]} { + incr ok; exp_continue } + -re {In test_probe_1 probe 0x0} { incr ok; exp_continue } + eof { } + } + catch {close}; catch {wait} + + if {$ok == 6} { + pass "$test ${pbtype_mssg}${test_xtra} shared attach" + } else { + if {[istarget "arm-*-*"] && $pbtype_mssg == "V2_uprobe"} { + xfail "$test ($ok) ${pbtype_mssg}${test_xtra} shared attach" + } else { + fail "$test ($ok) ${pbtype_mssg}${test_xtra} shared attach" + } + } + + set ok 0 + spawn cat ,semclean + expect { + -timeout 180 + -re {PASS} { incr ok; exp_continue } + -re {FAIL} { incr ko; exp_continue } + timeout { fail "$test (timeout)" } + eof { } + } + catch {close}; catch {wait} + + if {$ok == 4 && $ko == 0} { + pass "$test ${pbtype_mssg}${test_xtra} shared shared epilogue" + } else { + fail "$test ($ok) ${pbtype_mssg}${test_xtra} shared epilogue" } } - - set ok 0 - spawn cat ,semclean - expect { - -timeout 180 - -re {PASS} { incr ok; exp_continue } - -re {FAIL} { incr ko; exp_continue } - timeout { fail "$test (timeout)" } - eof { } - } - catch {close}; catch {wait} - - if {$ok == 4 && $ko == 0} { - pass "$test $pbtype_mssg shared shared epilogue" - } else { - fail "$test ($ok) $pbtype_mssg shared epilogue" - } - + # 6. Test .mark probe wildcard matching set ok 0 @@ -442,8 +509,8 @@ for {set i 0} {$i < [llength $pbtype_flags]} {incr i} { catch {close}; catch {wait} if { $ok == 51 || $ok == 48 \ - || (($ok == 43 || $ok == 40 ) && ([istarget "i.86-*-*"] \ - || [istarget "arm-*-*"]))} { + || (($ok == 43 || $ok == 40 ) && ([istarget "i.86-*-*"] \ + || [istarget "arm-*-*"]))} { pass "$test wildcard $pbtype_mssg" } else { fail "$test wildcard ($ok) $pbtype_mssg" @@ -451,7 +518,6 @@ for {set i 0} {$i < [llength $pbtype_flags]} {incr i} { # 7. Test types defined in sdt_misc_.d. This requires -g - set ok 0 set supbc_flags "$sup_flags additional_flags=-g additional_flags=-DNO_SLEEP" set supbc_exepath "[pwd]/sdt_misc_${pbtype_mssg}_types.x" set res [target_compile $srcdir/$subdir/sdt_misc.c $supbc_exepath \ @@ -465,26 +531,38 @@ for {set i 0} {$i < [llength $pbtype_flags]} {incr i} { pass "$test compiling -g $pbtype_mssg --types" } - verbose -log "spawn $stap_path -c $supbc_exepath -e \"probe process(\"$supbc_exepath\").mark(\"test_probe_4\") {printf(\"In %s dtrace probe %#x %#x\\n\", \$\$name, \$arg1->a, \$arg1->b)}\"" - spawn $stap_path -c $supbc_exepath -e "probe process(\"$supbc_exepath\").mark(\"test_probe_4\") {printf(\"In %s dtrace probe %#x %#x\\n\", \$\$name, \$arg1->a, \$arg1->b)}" - expect { - -timeout 180 - -re {In test_probe_4 dtrace probe 0x4 0x5} { incr ok; exp_continue } - timeout { fail "$test (timeout)" } - eof { } - } - catch {close}; catch {wait} + foreach runtime [get_runtime_list] { + set test_xtra "" + if {$runtime != ""} { + set test_xtra " ($runtime)" + verbose -log "spawn $stap_path --runtime=$runtime -c $supbc_exepath -e \"probe process(\"$supbc_exepath\").mark(\"test_probe_4\") {printf(\"In %s dtrace probe %#x %#x\\n\", \$\$name, \$arg1->a, \$arg1->b)}\"" + spawn $stap_path --runtime=$runtime -c $supbc_exepath -e "probe process(\"$supbc_exepath\").mark(\"test_probe_4\") {printf(\"In %s dtrace probe %#x %#x\\n\", \$\$name, \$arg1->a, \$arg1->b)}" + } elseif {[uprobes_p]} { + verbose -log "spawn $stap_path -c $supbc_exepath -e \"probe process(\"$supbc_exepath\").mark(\"test_probe_4\") {printf(\"In %s dtrace probe %#x %#x\\n\", \$\$name, \$arg1->a, \$arg1->b)}\"" + spawn $stap_path -c $supbc_exepath -e "probe process(\"$supbc_exepath\").mark(\"test_probe_4\") {printf(\"In %s dtrace probe %#x %#x\\n\", \$\$name, \$arg1->a, \$arg1->b)}" + } else { + untested "$test $pbtype_mssg --types" + continue + } + set ok 0 + expect { + -timeout 180 + -re {In test_probe_4 dtrace probe 0x4 0x5} { incr ok; exp_continue } + timeout { fail "$test (timeout)" } + eof { } + } + catch {close}; catch {wait} - if {$ok == 1} { - pass "$test $pbtype_mssg --types" - } else { - if {[istarget "arm-*-*"] && $pbtype_mssg == "V2_uprobe"} { - xfail "$test ($ok) $pbtype_mssg --types" + if {$ok == 1} { + pass "$test ${pbtype_mssg}${test_xtra} --types" } else { - fail "$test ($ok) $pbtype_mssg --types" + if {[istarget "arm-*-*"] && $pbtype_mssg == "V2_uprobe"} { + xfail "$test ($ok) ${pbtype_mssg}${test_xtra} --types" + } else { + fail "$test ($ok) ${pbtype_mssg}${test_xtra} --types" + } } } - } ; # end pbtype_flags # 8. Test V3 asm support @@ -502,44 +580,68 @@ if {[istarget "x86_64-*-*"] || [istarget "i*86-*-*"]} { 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 "asm" + expect { + -timeout 180 + -re {FAIL: [a-z0-9]} { regexp " .*$" $expect_out(0,string) s; + incr notok; set fail "$fail $s"; exp_continue } + -re {PASS: [a-z0-9]} { incr ok; 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)" + } + } +} ; # x86_64 | i.86 + +foreach runtime [get_runtime_list] { + set test_xtra "" + if {$runtime != ""} { + set test_xtra " ($runtime)" + verbose -log "spawn $stap_path --runtime=$runtime -c ./sdt_misc_V3_uprobe.x -e \"probe process(\"./sdt_misc_V3_uprobe.x\").mark(\"test_probe_5\") {printf(\"%s %s %s\\n\", \$\$provider, \$\$name, \$\$parms)}\"" + spawn $stap_path --runtime=$runtime -c ./sdt_misc_V3_uprobe.x -e "probe process(\"./sdt_misc_V3_uprobe.x\").mark(\"test_probe_3\") {printf(\"%s %s %s\\n\", \$\$provider, \$\$name, \$\$parms)}" + } elseif {[uprobes_p]} { + verbose -log "spawn $stap_path -c ./sdt_misc_V3_uprobe.x -e \"probe process(\"./sdt_misc_V3_uprobe.x\").mark(\"test_probe_5\") {printf(\"%s %s %s\\n\", \$\$provider, \$\$name, \$\$parms)}\"" + spawn $stap_path -c ./sdt_misc_V3_uprobe.x -e "probe process(\"./sdt_misc_V3_uprobe.x\").mark(\"test_probe_3\") {printf(\"%s %s %s\\n\", \$\$provider, \$\$name, \$\$parms)}" + } else { + untested "$test \$\$parms" + continue + } set ok 0 - set notok 0 - set fail "asm" - 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 expect { -timeout 180 - -re {FAIL: [a-z0-9]} { regexp " .*$" $expect_out(0,string) s; - incr notok; set fail "$fail $s"; exp_continue } - -re {PASS: [a-z0-9]} { incr ok; exp_continue } + -re {sdt_misc test_probe_3 \$arg1=0x3 \$arg2=0x[0-9a-f][0-9a-f]} { + incr ok; exp_continue } timeout { fail "$test (timeout)" } eof { } } catch {close}; catch {wait} - - if { $notok != 0 || $ok == 0} { - fail "$test asm ($ok) $fail" + + if {$ok == 1} { + pass "$test \$\$parms${test_xtra}" } else { - pass "$test asm ($ok)" + fail "$test ($ok) \$\$parms${test_xtra}" } -} ; # x86_64 | i.86 - -set ok 0 -verbose -log "spawn $stap_path -c ./sdt_misc_V3_uprobe.x -e \"probe process(\"./sdt_misc_V3_uprobe.x\").mark(\"test_probe_5\") {printf(\"%s %s %s\\n\", \$\$provider, \$\$name, \$\$parms)}\"" -spawn $stap_path -c ./sdt_misc_V3_uprobe.x -e "probe process(\"./sdt_misc_V3_uprobe.x\").mark(\"test_probe_3\") {printf(\"%s %s %s\\n\", \$\$provider, \$\$name, \$\$parms)}" -expect { - -timeout 180 - -re {sdt_misc test_probe_3 \$arg1=0x3 \$arg2=0x[0-9a-f][0-9a-f]} { - incr ok; exp_continue } - timeout { fail "$test (timeout)" } - eof { } -} -catch {close}; catch {wait} - -if {$ok == 1} { - pass "$test \$\$parms" -} else { - fail "$test ($ok) \$\$parms" } cleanup_handler $verbose diff --git a/testsuite/systemtap.base/sdt_va_args.exp b/testsuite/systemtap.base/sdt_va_args.exp index c7d7a8951..8d8a6fa30 100644 --- a/testsuite/systemtap.base/sdt_va_args.exp +++ b/testsuite/systemtap.base/sdt_va_args.exp @@ -54,10 +54,21 @@ if { $res != "" } { pass "compiling $test.c $extra_mssg" } -if {[installtest_p] && [utrace_p] && [uprobes_p]} { - stap_run3 "$test $extra_mssg" -w $srcdir/$subdir/sdt.stp $testprog -c ./$testprog +if {[installtest_p]} { + foreach runtime [get_runtime_list] { + if {$runtime != ""} { + stap_run3 "$test $extra_mssg ($runtime)" \ + --runtime=$runtime -w $srcdir/$subdir/sdt.stp \ + $testprog -c ./$testprog + } elseif {[uprobes_p]} { + stap_run3 "$test $extra_mssg" -w $srcdir/$subdir/sdt.stp \ + $testprog -c ./$testprog + } else { + untested "$test $extra_mssg" + } + } } else { - untested "$test $extra_mssg" + untested "$test $extra_mssg" } catch {exec rm -f $testprog} diff --git a/testsuite/systemtap.base/simple.exp b/testsuite/systemtap.base/simple.exp index 6f1794376..d83cf0231 100644 --- a/testsuite/systemtap.base/simple.exp +++ b/testsuite/systemtap.base/simple.exp @@ -6,4 +6,10 @@ set test "simple" #check to see whether get the marker indicating the probe is loaded and running #should check to see whether exited for some reason #should be error is something else is printed. -stap_run $srcdir/$subdir/$test.stp +foreach runtime [get_runtime_list] { + if {$runtime != ""} { + stap_run $srcdir/$subdir/$test.stp "" "" --runtime=$runtime + } else { + stap_run $srcdir/$subdir/$test.stp + } +} diff --git a/testsuite/systemtap.base/stmt_rel_user.exp b/testsuite/systemtap.base/stmt_rel_user.exp index 5484f0049..9a4f2eb08 100644 --- a/testsuite/systemtap.base/stmt_rel_user.exp +++ b/testsuite/systemtap.base/stmt_rel_user.exp @@ -1,46 +1,68 @@ set test "stmt_rel_user" +proc dyninst_kfails {index} { + # The dyninst runtime isn't multi-arch, it only works on the + # native architecture. PR14490. + if {! [all_compile_flag_native_p $index]} { + setup_kfail 14490 "*-*-*" + } +} + # Compile with inlining and check we can set a relative statement there for {set i 0} {$i < [all_compile_flags]} {incr i} { - set extra_flag [all_compile_flag $i] - set extra_name [all_compile_flag_name $i] - - set ok 0 - set rel_flags "additional_flags=-Wall additional_flags=-Werror" - set rel_flags "$rel_flags additional_flags=-Winline" - set rel_flags "$rel_flags additional_flags=-g" - set rel_flags "$rel_flags $extra_flag" - set res [target_compile $srcdir/$subdir/stmt_rel.c [pwd]/stmt_rel.x executable $rel_flags] - if { $res != "" } { - verbose "target_compile failed: $res" 2 - fail "$test-$extra_name compiling" - cleanup_handler $verbose - continue - } else { - pass "$test-$extra_name compiling" - } - - if {![installtest_p]} { untested "$test-$extra_name"; return } - if {![uprobes_p]} { untested "$test-$extra_name"; return } - - spawn stap -c ./stmt_rel.x -e "probe process(\"./stmt_rel.x\").statement(\"Move@stmt_rel.c+1\") {printf(\"Move %d\\n\",\$s1)}" - expect { - -timeout 180 - -re {Move [0-9]} { incr ok; exp_continue } - timeout { fail "$test-$extra_name (timeout)" } - eof { } - } - catch {close}; catch {wait} - - # PR13430 when optimizing we fail to set probes on all inlined lines. - if { [string first "O" $extra_name] != -1 } { - setup_kfail 13430 "*-*-*" - } + set extra_flag [all_compile_flag $i] + set extra_name [all_compile_flag_name $i] + + set rel_flags "additional_flags=-Wall additional_flags=-Werror" + set rel_flags "$rel_flags additional_flags=-Winline" + set rel_flags "$rel_flags additional_flags=-g" + set rel_flags "$rel_flags $extra_flag" + set res [target_compile $srcdir/$subdir/stmt_rel.c [pwd]/stmt_rel.x executable $rel_flags] + if { $res != "" } { + verbose "target_compile failed: $res" 2 + fail "$test-$extra_name compiling" + cleanup_handler $verbose + continue + } else { + pass "$test-$extra_name compiling" + } + + if {![installtest_p]} { untested "$test-$extra_name"; return } + + foreach runtime [get_runtime_list] { + if {$runtime != ""} { + set test_name "$test-$extra_name-$runtime" + if { [info procs ${runtime}_kfails] ne "" } { + ${runtime}_kfails $i + } + spawn stap --runtime=$runtime -c ./stmt_rel.x -e "probe process(\"./stmt_rel.x\").statement(\"Move@stmt_rel.c+1\") {printf(\"Move %d\\n\",\$s1)}" + } elseif {[uprobes_p]} { + set test_name "$test-$extra_name" + spawn stap -c ./stmt_rel.x -e "probe process(\"./stmt_rel.x\").statement(\"Move@stmt_rel.c+1\") {printf(\"Move %d\\n\",\$s1)}" + } else { + untested "$test-$extra_name" + continue + } - # A hanoi tower needs 2^n - 1 moves (n == 14 in the test program) - if { $ok == 16383 } { - pass "$test-$extra_name" - } else { - fail "$test-$extra_name ($ok)" - } + set ok 0 + expect { + -timeout 180 + -re {Move [0-9]} { incr ok; exp_continue } + timeout { fail "$test_name (timeout)" } + eof { } + } + catch {close}; catch {wait} + + # PR13430 when optimizing we fail to set probes on all inlined lines. + if { [string first "O" $extra_name] != -1 } { + setup_kfail 13430 "*-*-*" + } + + # A hanoi tower needs 2^n - 1 moves (n == 14 in the test program) + if { $ok == 16383 } { + pass "$test_name" + } else { + fail "$test_name ($ok)" + } + } } diff --git a/testsuite/systemtap.base/suppress-time-limit.exp b/testsuite/systemtap.base/suppress-time-limit.exp index 237b388a1..572649836 100644 --- a/testsuite/systemtap.base/suppress-time-limit.exp +++ b/testsuite/systemtap.base/suppress-time-limit.exp @@ -2,45 +2,58 @@ set test "suppress-time-limit" if {! [installtest_p]} { untested "$test"; return } -spawn stap -g --suppress-time-limits $srcdir/$subdir/$test.stp -set ok 0 -set ko 0 -# Testing that -g --suppress-time-limits works properly -# by looping 100000 time and confirming the number of iterations -# to what we expect. -# The default setting only allows for 10000, so we want to test -# against a value significantly larger than that. -expect { - -timeout 30 - -re {^100000\r\n} { incr ok; exp_continue } - timeout { fail "$test active (timeout)" } - eof { } -} -catch {close}; catch {wait} -# The actual comparing of active values to what we expect. -# For debugging purposes, output the value of the variables -# so we can see which value failed (if any) -if {$ok == 1} then { - pass "$test active ($ok)" -} else { - fail "$test active ($ok)" -} -# Testing the case which should fail, without the new option, -# and comparing the number of iterations to what we expect (ie 9997). -spawn stap $srcdir/$subdir/$test.stp -expect { - -timeout 30 - -re {^ERROR:[^\r\n]*\r\n} { incr ko; exp_continue } - -re {^9997\r\n} { incr ko; exp_continue } - eof { } - timeout { fail "$test passive (timeout)" } -} -catch {close}; catch {wait} -# The actual comparing of passive values to what we expect. -# For debugging purposes, output the value of the variables -# so we can see which value failed (if any) -if {$ko == 2} then { - pass "$test passive ($ko)" -} else { - fail "$test passive ($ko)" +foreach runtime [get_runtime_list] { + set test_extra "" + if {$runtime != ""} { + set test_extra " ($runtime)" + spawn stap --runtime=$runtime -g --suppress-time-limits \ + $srcdir/$subdir/$test.stp + } else { + spawn stap -g --suppress-time-limits $srcdir/$subdir/$test.stp + } + set ok 0 + set ko 0 + # Testing that -g --suppress-time-limits works properly + # by looping 100000 time and confirming the number of iterations + # to what we expect. + # The default setting only allows for 10000, so we want to test + # against a value significantly larger than that. + expect { + -timeout 30 + -re {^100000\r\n} { incr ok; exp_continue } + timeout { fail "$test active${test_extra} (timeout)" } + eof { } + } + catch {close}; catch {wait} + # The actual comparing of active values to what we expect. + # For debugging purposes, output the value of the variables + # so we can see which value failed (if any) + if {$ok == 1} then { + pass "$test active${test_extra} ($ok)" + } else { + fail "$test active${test_extra} ($ok)" + } + # Testing the case which should fail, without the new option, + # and comparing the number of iterations to what we expect (ie 9997). + if {$runtime != ""} { + spawn stap --runtime=$runtime $srcdir/$subdir/$test.stp + } else { + spawn stap $srcdir/$subdir/$test.stp + } + expect { + -timeout 30 + -re {^ERROR:[^\r\n]*\r\n} { incr ko; exp_continue } + -re {^9997\r\n} { incr ko; exp_continue } + eof { } + timeout { fail "$test passive${test_extra} (timeout)" } + } + catch {close}; catch {wait} + # The actual comparing of passive values to what we expect. + # For debugging purposes, output the value of the variables + # so we can see which value failed (if any) + if {$ko == 2} then { + pass "$test passive${test_extra} ($ko)" + } else { + fail "$test passive${test_extra} ($ko)" + } } diff --git a/testsuite/systemtap.base/tri.exp b/testsuite/systemtap.base/tri.exp index 6b326ea80..c9802841c 100644 --- a/testsuite/systemtap.base/tri.exp +++ b/testsuite/systemtap.base/tri.exp @@ -2,4 +2,11 @@ set test "tri" -stap_run $srcdir/$subdir/$test.stp no_load $all_pass_string +foreach runtime [get_runtime_list] { + if {$runtime != ""} { + stap_run $srcdir/$subdir/$test.stp no_load $all_pass_string \ + --runtime=$runtime + } else { + stap_run $srcdir/$subdir/$test.stp no_load $all_pass_string + } +} diff --git a/testsuite/systemtap.base/trycatch.exp b/testsuite/systemtap.base/trycatch.exp index 228e8fd86..c39f67eee 100644 --- a/testsuite/systemtap.base/trycatch.exp +++ b/testsuite/systemtap.base/trycatch.exp @@ -2,42 +2,53 @@ set test "trycatch" if {! [installtest_p]} { untested $test; return } -set ok 0 -set ko 0 -spawn stap $srcdir/buildok/fortyone.stp -expect { - -timeout 30 - -re {^ERROR: MAXACTION[^\r\n]*\r\n} { incr ok; exp_continue } - -re {^WARNING: Number of errors[^\r\n]*\r\n} { incr ok; exp_continue } - -re {^WARNING:[^\r\n]* exited with status:[^\r\n]*\r\n} {incr ok; exp_continue } - -re {^Pass 5: run failed[^\r\n]*\r\n} { incr ok; exp_continue } - -re {^OK[^\r\n]*\r\n} { incr ok; exp_continue } - -re {^KO[^\r\n]*\r\n} { incr ko; exp_continue } - timeout { fail "$test (timeout)" } - eof { } +foreach runtime [get_runtime_list] { + set test "trycatch" + set ok 0 + set ko 0 + if {$runtime != ""} { + lappend test "($runtime)" + spawn stap --runtime=$runtime $srcdir/buildok/fortyone.stp + } else { + spawn stap $srcdir/buildok/fortyone.stp + } + expect { + -timeout 30 + -re {^ERROR: MAXACTION[^\r\n]*\r\n} { incr ok; exp_continue } + -re {^WARNING: Number of errors[^\r\n]*\r\n} { incr ok; exp_continue } + -re {^WARNING:[^\r\n]* exited with status:[^\r\n]*\r\n} {incr ok; exp_continue } + -re {^Pass 5: run failed[^\r\n]*\r\n} { incr ok; exp_continue } + -re {^OK[^\r\n]*\r\n} { incr ok; exp_continue } + -re {^KO[^\r\n]*\r\n} { incr ko; exp_continue } + timeout { fail "$test (timeout)" } + eof { } + } + catch {close}; catch {wait} + if {$ok == 13 && $ko == 0} then {pass $test} else {fail "$test ($ok $ko)"} + + set test "trycatch -u" + set ok 0 + set ko 0 + if {$runtime != ""} { + lappend test "($runtime)" + spawn stap --runtime=$runtime -u $srcdir/buildok/fortyone.stp + } else { + spawn stap -u $srcdir/buildok/fortyone.stp + } + expect { + -timeout 30 + -re {^ERROR: MAXACTION[^\r\n]*\r\n} { incr ok; exp_continue } + -re {^WARNING: Number of errors[^\r\n]*\r\n} { incr ok; exp_continue } + -re {^WARNING:[^\r\n]* exited with status:[^\r\n]*\r\n} {incr ok; exp_continue } + -re {^Pass 5: run failed[^\r\n]*\r\n} { incr ok; exp_continue } + -re {^OK[^\r\n]*\r\n} { incr ok; exp_continue } + -re {^KO[^\r\n]*\r\n} { incr ko; exp_continue } + timeout { fail "$test (timeout)" } + eof { } + } + catch {close}; catch {wait} + if {$ok == 13 && $ko == 0} then {pass $test} else {fail "$test ($ok $ko)"} } -wait; catch { close } -if {$ok == 13 && $ko == 0} then {pass $test} else {fail "$test ($ok $ko)"} - - -set test "trycatch -u" - -set ok 0 -set ko 0 -spawn stap -u $srcdir/buildok/fortyone.stp -expect { - -timeout 30 - -re {^ERROR: MAXACTION[^\r\n]*\r\n} { incr ok; exp_continue } - -re {^WARNING: Number of errors[^\r\n]*\r\n} { incr ok; exp_continue } - -re {^WARNING:[^\r\n]* exited with status:[^\r\n]*\r\n} {incr ok; exp_continue } - -re {^Pass 5: run failed[^\r\n]*\r\n} { incr ok; exp_continue } - -re {^OK[^\r\n]*\r\n} { incr ok; exp_continue } - -re {^KO[^\r\n]*\r\n} { incr ko; exp_continue } - timeout { fail "$test (timeout)" } - eof { } -} -wait; catch { close } -if {$ok == 13 && $ko == 0} then {pass $test} else {fail "$test ($ok $ko)"} -- 2.43.5