From f4d4e917467665003110d412819ed2433a887fcc Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Tue, 8 Sep 2009 18:12:27 -0400 Subject: Test user markers set in a shared object. * sdt_misc: Add -shared section. --- testsuite/systemtap.base/sdt_misc.exp | 58 +++++++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 3 deletions(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/sdt_misc.exp b/testsuite/systemtap.base/sdt_misc.exp index 27f148d0..096ea126 100644 --- a/testsuite/systemtap.base/sdt_misc.exp +++ b/testsuite/systemtap.base/sdt_misc.exp @@ -1,10 +1,11 @@ -set test "static_user_markers" +set test "sdt_misc" # Test miscellaneous features of .mark probes # Compile a C program to use as the user-space probing target set sup_srcpath "[pwd]/static_user_markers.c" set sup_exepath "[pwd]/static_user_markers.x" +set sup_sopath "[pwd]/libsdt.so" set supcplus_exepath "[pwd]/static_user_markers_cplus.x" set fp [open $sup_srcpath "w"] puts $fp " @@ -44,6 +45,7 @@ buz (int parm) DTRACE_PROBE1(static_user_markers,test_probe_4,&bstruct); } +#ifndef NO_MAIN int main () { @@ -51,6 +53,7 @@ main () baz(3,(char*)\"abc\"); buz(4); } +#endif " close $fp @@ -217,6 +220,56 @@ if { $ok != 0} { pass "$test types $pbtype_mssg" } +# Test probe in shared object + +set sup_srcmainpath "[pwd]/static_user_markers_.c" +set fp [open $sup_srcmainpath "w"] +puts $fp " +int +main () +{ + bar(2); + baz(3,(char*)\"abc\"); + buz(4); +} +" +close $fp + +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 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" +set res [target_compile $sup_srcmainpath $sup_exepath executable $sup0_flags ] +if { $res0 != "" || $res != "" } { + verbose "target_compile failed: $res0 $res" 2 + fail "$test compiling -g -shared $pbtype_mssg" + if { $verbose == 0 } { + catch {exec rm -f $sup_srcpath $sup_srcmainpath} + } + return +} else { + pass "$test compiling -g -shared $pbtype_mssg" +} + +verbose -log "stap -c $sup_exepath -e probe process(\"$sup_sopath\").mark(\"test_probe_2\") {printf(\"In %s probe %#x\\n\", \$\$name, \$arg1)}" +spawn stap -c $sup_exepath -e "probe process(\"$sup_sopath\").mark(\"test_probe_2\") {printf(\"In %s probe %#x\\n\", \$\$name, \$arg1)}" +expect { + -timeout 180 + -re {In test_probe_2 probe 0x2} { incr ok; exp_continue } + timeout { fail "$test (timeout)" } + eof { } +} + +wait + +if {$ok == 2} { + pass "$test shared $pbtype_mssg" +} else { + fail "$test shared ($ok) $pbtype_mssg" +} + # Test .mark probe wildcard matching set ok 0 @@ -238,6 +291,5 @@ if { $ok == 45 } { } if { $verbose == 0 } { -catch {exec rm -f $sup_srcpath $sup_exepath $supcplus_exepath $sup_dpath $sup_hpath $sup_stppath sdt_types.x} +catch {exec rm -f $sup_srcpath $sup_exepath $sup_sopath $supcplus_exepath $sup_dpath $sup_hpath $sup_opath $sup_stppath $sdt_types.x $sup_srcmainpath} } - -- cgit From 6ff3e5250db10f8e6a875bc1ddecf19f8181739c Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sun, 13 Sep 2009 23:37:28 +0200 Subject: Make tracepoints.exp test more efficient by running as one giant script. When there are lots of tracepoints in the kernel running a script for each one individually can take several minutes. So run them all in one giant script at the same time. Also increase timeout for the stap -l collection step since with an empty cache that might take more than the default 10 seconds. * testsuite/systemtap.base/tracepoints.exp: Increase default timeout. Collect all script fragments and run them as one. --- testsuite/systemtap.base/tracepoints.exp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/tracepoints.exp b/testsuite/systemtap.base/tracepoints.exp index a4e38c05..b9014208 100644 --- a/testsuite/systemtap.base/tracepoints.exp +++ b/testsuite/systemtap.base/tracepoints.exp @@ -2,6 +2,7 @@ set tracepoints {} spawn stap -l {kernel.trace("*")} expect { + -timeout 60 -re {^kernel.trace[^\r\n]*\r\n} { append tracepoints $expect_out(0,string) exp_continue @@ -11,13 +12,26 @@ expect { } catch {close}; catch { wait } +# Use this to test each tracepoint individually. +#foreach tp $tracepoints { +# set test "tracepoint $tp -p4" +# if {[catch {exec stap -w -p4 -e "probe $tp { println($\$name, $\$vars) }"} res]} { +# fail "$test $res" +# } else { +# pass "$test" +# } +#} + +# This tests all tracepoints all at once (much faster than the above) +set script "probe begin {}" foreach tp $tracepoints { - set test "tracepoint $tp -p4" - if {[catch {exec stap -w -p4 -e "probe $tp { println($\$name, $\$vars) }"} res]} { - fail "$test $res" - } else { - pass "$test" - } + set script "$script probe $tp { println($\$name, $\$vars) }" +} +send_log "Trying stap -w -p4 -e $script\n" +if {[catch {exec stap -w -p4 -e "$script"} res]} { + fail "tracepoints $res" +} else { + pass "tracepoints" } set test "tracepoints" -- cgit From 38070723b06baf781ef18e2516e33e6bdbe18d8f Mon Sep 17 00:00:00 2001 From: Wenji Huang Date: Mon, 14 Sep 2009 10:05:08 +0800 Subject: PR10608: mark test cases untested once compilation failed * testsuite/systemtap.syscall/syscall.exp: Simplify logic things. * testsuite/systemtap.syscall/test.tcl: Check compilation result. * testsuite/systemtap.base/utrace_syscall_args.exp: Change fail to untested. --- testsuite/systemtap.base/utrace_syscall_args.exp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/utrace_syscall_args.exp b/testsuite/systemtap.base/utrace_syscall_args.exp index 98bc457e..e3c90191 100644 --- a/testsuite/systemtap.base/utrace_syscall_args.exp +++ b/testsuite/systemtap.base/utrace_syscall_args.exp @@ -37,7 +37,8 @@ if {$do_64_bit_pass} { set res [target_compile $srcpath $exepath executable $flags] if { $res != "" } { verbose "target_compile for $exepath failed: $res" 2 - fail "$testname: unable to compile $srcpath" + send_log "$testname: unable to compile $srcpath\n" + untested $testname return } @@ -72,7 +73,8 @@ if {$do_32_bit_pass} { set res [target_compile $srcpath $exepath executable $flags] if { $res != "" } { verbose "target_compile for $exepath failed: $res" 2 - fail "$testname: unable to compile $srcpath" + send_log "$testname: unable to compile $srcpath\n" + untested $testname return } -- cgit From d833f810e4ffaf5c9c16eebc7f10b9d14e53e508 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 16 Sep 2009 12:59:50 +0200 Subject: Make labels -l .label test independent of list output order. * testsuite/systemtap.base/labels.exp (-l .label): List all output lines individually in expect regex. --- testsuite/systemtap.base/labels.exp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/labels.exp b/testsuite/systemtap.base/labels.exp index 79e3f483..f759beef 100644 --- a/testsuite/systemtap.base/labels.exp +++ b/testsuite/systemtap.base/labels.exp @@ -93,12 +93,19 @@ wait set ok 0 expect { -timeout 180 - -re {process.*function.*labels.c:5...label..init_an_int.*process.*function.*labels.c:16...label..init_an_int.*process.*function.*labels.c:18...label..init_an_int_again} { incr ok; exp_continue } + -re {^process[^\r\n]*function[^\r\n]*labels.c:5...label..init_an_int..\r\n} + { incr ok; exp_continue } + -re {^process[^\r\n]*function[^\r\n]*labels.c:16...label..init_an_int..\r\n} + { incr ok; exp_continue } + -re {^process[^\r\n]*function[^\r\n]*labels.c:18...label..init_an_int_again..\r\n} + { incr ok; exp_continue } + -re {^process[^\r\n]*function[^\r\n]*labels.c:21...label..ptr_inited..\r\n} + { incr ok; exp_continue } timeout { fail "$test (timeout)" } eof { } } -if {$ok == 1} { pass "$test -l .label" } { fail "$test -l .label $ok" } +if {$ok == 4} { pass "$test -l .label" } { fail "$test -l .label $ok" } # label in an executable -- cgit