diff options
author | Stan Cox <scox@redhat.com> | 2010-02-21 22:36:28 -0500 |
---|---|---|
committer | Stan Cox <scox@redhat.com> | 2010-02-21 22:36:28 -0500 |
commit | 7abde14bde6410e5138e968be7c7b95b78759c17 (patch) | |
tree | 7aa5bfba366efb87ff1278d145cbb68ffce7e420 | |
parent | dac77b805e77cf00b25395ece1e2a1b5f75761da (diff) | |
download | systemtap-steved-7abde14bde6410e5138e968be7c7b95b78759c17.tar.gz systemtap-steved-7abde14bde6410e5138e968be7c7b95b78759c17.tar.xz systemtap-steved-7abde14bde6410e5138e968be7c7b95b78759c17.zip |
Tweak shared attach sdt test.
* sdt_misc.exp: Make all semaphore references from the .so
-rw-r--r-- | testsuite/systemtap.base/sdt_misc.exp | 110 |
1 files changed, 70 insertions, 40 deletions
diff --git a/testsuite/systemtap.base/sdt_misc.exp b/testsuite/systemtap.base/sdt_misc.exp index 0cb50826..920cdd97 100644 --- a/testsuite/systemtap.base/sdt_misc.exp +++ b/testsuite/systemtap.base/sdt_misc.exp @@ -15,12 +15,34 @@ set fp [open $sup_srcpath "w"] puts $fp " #include <stdlib.h> #include <stdio.h> -#include \"sdt_misc_.h\" #ifndef ONLY_MAIN +#include \"sdt_misc_.h\" + +sem_display () +{ + printf(\"%s epilogue %s=%d\\n\", (test_probe_0_semaphore ? \"FAIL\" : \"PASS\"), \"test_probe_0_semaphore\", test_probe_0_semaphore); + printf(\"%s epilogue %s=%d\\n\", (test_probe_2_semaphore ? \"FAIL\" : \"PASS\"), \"test_probe_2_semaphore\", test_probe_2_semaphore); + printf(\"%s epilogue %s=%d\\n\", (test_probe_3_semaphore ? \"FAIL\" : \"PASS\"), \"test_probe_3_semaphore\", test_probe_3_semaphore); + printf(\"%s epilogue %s=%d\\n\", (test_probe_4_semaphore ? \"FAIL\" : \"PASS\"), \"test_probe_4_semaphore\", test_probe_4_semaphore); +} + +#ifdef LOOP +loop_check() +{ + return test_probe_0_semaphore; +} +#endif + void bar (int i) { +#ifdef LOOP + while (!loop_check()) + { + } +#endif + SDT_MISC_TEST_PROBE_2(i); if (i == 0) i = 1000; @@ -52,16 +74,9 @@ buz (int parm) #endif #ifndef NO_MAIN -loop_check() -{ - return test_probe_0_semaphore; -} void int_handler(int sig) { - printf(\"%s epilogue %s=%d\\n\", (test_probe_0_semaphore ? \"FAIL\" : \"PASS\"), \"test_probe_0_semaphore\", test_probe_0_semaphore); - printf(\"%s epilogue %s=%d\\n\", (test_probe_2_semaphore ? \"FAIL\" : \"PASS\"), \"test_probe_2_semaphore\", test_probe_2_semaphore); - printf(\"%s epilogue %s=%d\\n\", (test_probe_3_semaphore ? \"FAIL\" : \"PASS\"), \"test_probe_3_semaphore\", test_probe_3_semaphore); - printf(\"%s epilogue %s=%d\\n\", (test_probe_4_semaphore ? \"FAIL\" : \"PASS\"), \"test_probe_4_semaphore\", test_probe_4_semaphore); + sem_display(); exit(1); } @@ -70,17 +85,17 @@ void alrm_handler(int sig) exit (1); } +#ifdef LOOP + #include <signal.h> +#endif + int main () { #ifdef LOOP - #include <signal.h> signal (SIGINT, &int_handler); signal (SIGALRM, &alrm_handler); alarm (30); - while (!loop_check()) - { - } #endif bar(2); baz(3,(char*)\"abc\"); @@ -186,9 +201,9 @@ set pbtype_mssgs {{uprobe} {kprobe}} for {set i 0} {$i < [llength $pbtype_flags]} {incr i} { set pbtype_flag [lindex $pbtype_flags $i] set pbtype_mssg [lindex $pbtype_mssgs $i] -set sup_exepath "[pwd]/sdt_misc-$pbtype_mssg.x" +set sup_exepath "[pwd]/sdt_misc_$pbtype_mssg.x" -set sup_flags "additional_flags=-I$srcdir/../includes" +set sup_flags "additional_flags=-I$srcdir/../includes/sys" set sup_flags "$sup_flags additional_flags=-I$sdtdir" set sup_flags "$sup_flags additional_flags=-g" set sup_flags "$sup_flags additional_flags=$sup_opath" @@ -241,7 +256,7 @@ if {$ok == 5} { # 2. Test attaching to a running process set loop_flags "$sup_flags additional_flags=-DLOOP" -set loop_exepath "[pwd]/sdt_misc-${pbtype_mssg}_loop.x" +set loop_exepath "[pwd]/sdt_misc_${pbtype_mssg}_loop.x" set res [target_compile $sup_srcpath $loop_exepath executable $loop_flags] if { $res != "" } { verbose "target_compile failed: $res" 2 @@ -271,7 +286,11 @@ expect { if {$ok == 5} { pass "$test $pbtype_mssg attach" } else { - xfail "$test ($ok) $pbtype_mssg attach" + if {$pbtype_mssg == "kprobe"} { + xfail "$test ($ok) $pbtype_mssg attach" + } else { + fail "$test ($ok) $pbtype_mssg attach" + } } set ok 0 @@ -286,7 +305,11 @@ expect { if {$ok == 4 && $ko == 0} { pass "$test $pbtype_mssg epilogue" } else { - xfail "$test ($ok) $pbtype_mssg epilogue" + if {$pbtype_mssg == "kprobe"} { + xfail "$test ($ok) $pbtype_mssg epilogue" + } else { + fail "$test ($ok) $pbtype_mssg epilogue" + } } # 3. Test passing various C types to .mark probes @@ -332,11 +355,11 @@ if { $ok != 0} { set sup_flags "$sup_flags additional_flags=-shared" set sup_flags "$sup_flags additional_flags=-fPIC" set sup_flags "$sup_flags additional_flags=-DNO_MAIN" -set sup_sopath "[pwd]/libsdt-$pbtype_mssg.so" -set sup_exepath "[pwd]/sdt_misc-$pbtype_mssg-shared.x" +set sup_sopath "[pwd]/libsdt_$pbtype_mssg.so" +set sup_exepath "[pwd]/sdt_misc_${pbtype_mssg}_shared.x" set res0 [target_compile $sup_srcpath $sup_sopath executable $sup_flags ] set sup0_flags "additional_flags=-g additional_flags=-Wl,-rpath,[pwd]" -set sup0_flags "$sup0_flags additional_flags=-L[pwd] additional_flags=-lsdt-$pbtype_mssg" +set sup0_flags "$sup0_flags additional_flags=-L[pwd] additional_flags=-lsdt_${pbtype_mssg}" set sup0_flags "$sup0_flags additional_flags=-DONLY_MAIN" set res [target_compile $sup_srcpath $sup_exepath executable $sup0_flags ] if { $res0 != "" || $res != "" } { @@ -351,13 +374,8 @@ if { $res0 != "" || $res != "" } { } set ok 0 -if { $pbtype_mssg != "kprobe" } { - verbose -log "spawn $stap_path -c $sup_exepath $sup_stppath $sup_exepath $sup_sopath" - spawn $stap_path -c $sup_exepath $sup_stppath $sup_exepath $sup_sopath -} else { - verbose -log "spawn $stap_path -c $sup_exepath $sup_stppath $sup_sopath" - spawn $stap_path -c $sup_exepath $sup_stppath $sup_sopath -} +verbose -log "spawn $stap_path -c $sup_exepath $sup_stppath $sup_exepath $sup_sopath" +spawn $stap_path -c $sup_exepath $sup_stppath $sup_exepath $sup_sopath expect { -timeout 180 -re {In test_probe_2 probe 0x2} { incr ok; exp_continue } @@ -373,21 +391,27 @@ wait if {$ok == 5} { pass "$test shared $pbtype_mssg" } else { - fail "$test ($ok) shared $pbtype_mssg" + if {$pbtype_mssg == "kprobe"} { + xfail "$test ($ok) shared $pbtype_mssg" + } else { + fail "$test ($ok) shared $pbtype_mssg" + } } # 5. Test attaching to a running process with markers in a shared object -if { $pbtype_mssg != "kprobe" } { -set loop_flags "additional_flags=-I$srcdir/../includes" +set supl_flags "$sup_flags additional_flags=-DLOOP" +set supl_sopath "[pwd]/libsdt_${pbtype_mssg}_loop.so" +set res0 [target_compile $sup_srcpath $supl_sopath executable $supl_flags ] +set loop_flags "additional_flags=-I$srcdir/../includes/sys" set loop_flags "$loop_flags additional_flags=-I$sdtdir" set loop_flags "$loop_flags additional_flags=-g" set loop_flags "$loop_flags additional_flags=-I. $pbtype_flag" set loop_flags "$loop_flags additional_flags=-DLOOP" set loop_flags "$loop_flags additional_flags=-DONLY_MAIN" set loop_flags "$loop_flags additional_flags=-Wl,-rpath,[pwd]" -set loop_flags "$loop_flags additional_flags=-L[pwd] additional_flags=-lsdt-$pbtype_mssg" -set loop_exepath "[pwd]/sdt_misc-${pbtype_mssg}_loop-shared.x" +set loop_flags "$loop_flags additional_flags=-L[pwd] additional_flags=-lsdt_${pbtype_mssg}_loop" +set loop_exepath "[pwd]/sdt_misc_${pbtype_mssg}_loop_shared.x" set res [target_compile $sup_srcpath $loop_exepath executable $loop_flags] if { $res != "" } { verbose "target_compile failed: $res" 2 @@ -402,7 +426,7 @@ verbose -log "$loop_exepath >| ,semclean 2>&1 & TEST=\$! ; \ $stap_path $sup_stppath $loop_exepath $sup_sopath >| ,semout ; \ /usr/bin/kill -SIGINT \$TEST" system "$loop_exepath >,semclean 2>&1 & TEST=\$! ; \ - $stap_path $sup_stppath $loop_exepath $sup_sopath >| ,semout ; \ + $stap_path $sup_stppath $loop_exepath $supl_sopath >| ,semout ; \ /usr/bin/kill -SIGINT \$TEST" set ok 0 set ko 0 @@ -417,7 +441,11 @@ expect { if {$ok == 5} { pass "$test $pbtype_mssg shared attach" } else { - xfail "$test ($ok) $pbtype_mssg shared attach" + if {$pbtype_mssg == "kprobe"} { + xfail "$test ($ok) $pbtype_mssg shared attach" + } else { + fail "$test ($ok) $pbtype_mssg shared attach" + } } set ok 0 @@ -433,10 +461,12 @@ expect { if {$ok == 4 && $ko == 0} { pass "$test $pbtype_mssg shared shared epilogue" } else { - xfail "$test ($ok) $pbtype_mssg shared epilogue" + if {$pbtype_mssg == "kprobe"} { + xfail "$test ($ok) $pbtype_mssg shared epilogue" + } else { + fail "$test ($ok) $pbtype_mssg shared epilogue" + } } -# ! kprobe -} # 6. Test .mark probe wildcard matching @@ -456,11 +486,11 @@ if { $ok == 45 } { } if { $verbose == 0 } { - catch {exec rm -f libsdt-$pbtype_mssg.so sdt_misc-$pbtype_mssg.x sdt_misc-$pbtype_mssg-shared.x } + catch {exec rm -f libsdt_${pbtype_mssg}.so libsdt_${pbtype_mssg}_shared.so sdt_misc_${pbtype_mssg}.x sdt_misc_${pbtype_mssg}_shared.x } } # for {set i 0} } if { $verbose == 0 } { - catch {exec rm -f sdt_misc_.c sdt_misc.c sdt_misc_.d sdt_misc_.h sdt_misc_.o sdt_misc.stp sdt_types.x sdt_misc-kprobe_loop-shared.x sdt_misc-kprobe_loop.x sdt_misc-uprobe_loop-shared.x sdt_misc-uprobe_loop.x ,semclean ,semout} + catch {exec rm -f sdt_misc_.c sdt_misc.c sdt_misc_.d sdt_misc_.h sdt_misc_.o sdt_misc.stp sdt_types.x sdt_misc_kprobe_loop_shared.x sdt_misc_kprobe_loop.x sdt_misc_uprobe_loop_shared.x sdt_misc_uprobe_loop.x ,semclean ,semout} } |