From 952ce18c9672046c052fc77d5da8f98e8ae75735 Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Wed, 1 Apr 2009 15:48:24 -0400 Subject: Use alloca trick to keep argN active on GCC 4.1. * includes/sys/sdt.h (STAP_UNINLINE): New. (STAP_UNINLINE_LABEL): New. static_uprobes.exp: Match using charset instead of .* --- testsuite/systemtap.base/static_uprobes.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/static_uprobes.exp b/testsuite/systemtap.base/static_uprobes.exp index 820626b8..d6b6e1e3 100644 --- a/testsuite/systemtap.base/static_uprobes.exp +++ b/testsuite/systemtap.base/static_uprobes.exp @@ -196,7 +196,7 @@ set ok 0 spawn stap -l "process(\"./sdt_types.x\").mark(\"*\")" expect { -timeout 180 - -re {mark\(\".*\"\)} { incr ok; exp_continue } + -re {mark\(\"[a-z_]+\"\)} { incr ok; exp_continue } timeout { fail "$test C (timeout)" } eof { } } -- cgit From 055f682bed95348cabb20868d62c4e575b84d02a Mon Sep 17 00:00:00 2001 From: Maynard Johnson Date: Wed, 1 Apr 2009 11:22:53 -0500 Subject: Add insn.block testcase to itrace.exp in testsuite Earlier today, I posted a runtime patch for the insn.block probe point. Once that patch is committed, the insn.block probe can be safely tested on any architecture. The attached patch adds such a testcase to the testsuite. Regards, -Maynard --- testsuite/systemtap.base/itrace.exp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/itrace.exp b/testsuite/systemtap.base/itrace.exp index e215bfe7..d330a337 100644 --- a/testsuite/systemtap.base/itrace.exp +++ b/testsuite/systemtap.base/itrace.exp @@ -48,6 +48,27 @@ set itrace2_script { } set itrace2_script_output "itraced = 5\r\n" +set itrace3_script { + global branches = 0 + probe begin + { + printf("systemtap starting probe\n") + printf("ATTENTION: if arch_has_block_step is not defined for this arch, this testcase will fail\n") + } + probe process("%s").insn.block + { + branches += 1 + if (branches == 5) + exit() + } + + + probe end { printf("systemtap ending probe\n") + printf("itraced block mode = %%d\n", branches) + } +} +set itrace3_script_output "itraced block mode = 5\r\n" + # Set up our own copy of /bin/ls, to make testing for a particular # executable easy. We can't use 'ln' here, since we might be creating @@ -99,5 +120,15 @@ if {$utrace_support_found == 0} { stap_run $TEST_NAME run_ls_5_sec $itrace2_script_output -e $script } +set TEST_NAME "itrace3" +if {$utrace_support_found == 0} { + untested "$TEST_NAME : no kernel utrace support found" +} elseif {![installtest_p]} { + untested $TEST_NAME +} else { + set script [format $itrace3_script $exepath] + stap_run $TEST_NAME run_ls_5_sec $itrace3_script_output -e $script +} + # Cleanup exec rm -f $exepath -- cgit From 1fd65aa57e608b544122b4aacdfae9cce6cb89dc Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 1 Apr 2009 17:01:53 -0700 Subject: Move testcase itrace3's warning into expect As it was, the ATTENTION was causing expect mismatches even when the test worked fine. The warning is served just as well from the expect script before starting the test. --- testsuite/systemtap.base/itrace.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/itrace.exp b/testsuite/systemtap.base/itrace.exp index d330a337..504253fe 100644 --- a/testsuite/systemtap.base/itrace.exp +++ b/testsuite/systemtap.base/itrace.exp @@ -53,7 +53,6 @@ set itrace3_script { probe begin { printf("systemtap starting probe\n") - printf("ATTENTION: if arch_has_block_step is not defined for this arch, this testcase will fail\n") } probe process("%s").insn.block { @@ -126,6 +125,7 @@ if {$utrace_support_found == 0} { } elseif {![installtest_p]} { untested $TEST_NAME } else { + send_log "ATTENTION: if arch_has_block_step is not defined for this arch, this testcase will fail\n" set script [format $itrace3_script $exepath] stap_run $TEST_NAME run_ls_5_sec $itrace3_script_output -e $script } -- cgit From 83ff01c2f669c66100a5cf7531dda9410a8ff6ce Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Wed, 1 Apr 2009 20:33:51 -0400 Subject: introduce [utrace_p] as dejagnu check for utrace presence in kernel * testsuite/lib/systemtap.exp: Define here. * testsuite/systemtap.*/*.exp: Use it here. Eliminate duplicated utrace_support_present logic. --- testsuite/systemtap.base/bz5274.exp | 9 +------- testsuite/systemtap.base/bz6850.exp | 9 +------- testsuite/systemtap.base/itrace.exp | 11 ++-------- testsuite/systemtap.base/labels.exp | 10 +-------- testsuite/systemtap.base/static_uprobes.exp | 10 +-------- testsuite/systemtap.base/uprobes.exp | 9 +------- testsuite/systemtap.base/uprobes_lib.exp | 15 ++++++++----- testsuite/systemtap.base/utrace_p4.exp | 34 +++++++++++------------------ testsuite/systemtap.base/utrace_p5.exp | 21 ++++++------------ 9 files changed, 37 insertions(+), 91 deletions(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/bz5274.exp b/testsuite/systemtap.base/bz5274.exp index 92441e9e..2f76a43f 100755 --- a/testsuite/systemtap.base/bz5274.exp +++ b/testsuite/systemtap.base/bz5274.exp @@ -17,14 +17,7 @@ if {! [installtest_p]} { return } -# Try to find utrace_attach symbol in /proc/kallsyms -# copy from utrace_p5.exp -set utrace_support_found 0 -set path "/proc/kallsyms" -if {! [catch {exec grep -q utrace_attach $path} dummy]} { - set utrace_support_found 1 -} -if {$utrace_support_found == 0} { +if {![utrace_p]} { catch {exec rm -f $test} untested "$test -p5" return diff --git a/testsuite/systemtap.base/bz6850.exp b/testsuite/systemtap.base/bz6850.exp index b96ed95c..32ecdaf5 100644 --- a/testsuite/systemtap.base/bz6850.exp +++ b/testsuite/systemtap.base/bz6850.exp @@ -3,14 +3,7 @@ set test bz6850 catch {exec gcc -g -o bz6850 $srcdir/$subdir/bz6850.c} err if {$err == "" && [file exists bz6850]} then { pass "$test compile" } else { fail "$test compile" } -# Try to find utrace_attach symbol in /proc/kallsyms -# copy from utrace_p5.exp -set utrace_support_found 0 -set path "/proc/kallsyms" -if {! [catch {exec grep -q utrace_attach $path} dummy]} { - set utrace_support_found 1 -} -if {$utrace_support_found == 0} { +if {![utrace_p]} { catch {exec rm -f $test} untested "$test -p4" untested "$test -p5" diff --git a/testsuite/systemtap.base/itrace.exp b/testsuite/systemtap.base/itrace.exp index 504253fe..c7da39c8 100644 --- a/testsuite/systemtap.base/itrace.exp +++ b/testsuite/systemtap.base/itrace.exp @@ -2,7 +2,6 @@ # Initialize variables -set utrace_support_found 0 set exepath "[pwd]/ls_[pid]" set itrace1_script { @@ -92,14 +91,8 @@ proc run_ls_5_sec {} { } -# Try to find utrace_attach symbol in /proc/kallsyms -set path "/proc/kallsyms" -if {! [catch {exec grep -q utrace_attach $path} dummy]} { - set utrace_support_found 1 -} - set TEST_NAME "itrace1" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } elseif {![installtest_p]} { untested $TEST_NAME @@ -110,7 +103,7 @@ if {$utrace_support_found == 0} { set TEST_NAME "itrace2" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } elseif {![installtest_p]} { untested $TEST_NAME diff --git a/testsuite/systemtap.base/labels.exp b/testsuite/systemtap.base/labels.exp index 6db81c54..2f79a502 100644 --- a/testsuite/systemtap.base/labels.exp +++ b/testsuite/systemtap.base/labels.exp @@ -1,14 +1,6 @@ set test "labels" if {![installtest_p]} {untested $test; return} - -# Try to find utrace_attach symbol in /proc/kallsyms -# copy from utrace_p5.exp -set utrace_support_found 0 -set path "/proc/kallsyms" -if {! [catch {exec grep -q utrace_attach $path} dummy]} { - set utrace_support_found 1 -} -if {$utrace_support_found == 0} { untested "$test"; return } +if {![utrace_p]} { untested $test; return } # Compile a C program to use as the user-space probing target set label_srcpath "[pwd]/labels.c" diff --git a/testsuite/systemtap.base/static_uprobes.exp b/testsuite/systemtap.base/static_uprobes.exp index d6b6e1e3..07ff83e9 100644 --- a/testsuite/systemtap.base/static_uprobes.exp +++ b/testsuite/systemtap.base/static_uprobes.exp @@ -124,15 +124,7 @@ if { $res != "" } { } if {![installtest_p]} {untested $test; return} - -# Try to find utrace_attach symbol in /proc/kallsyms -# copy from utrace_p5.exp -set utrace_support_found 0 -set path "/proc/kallsyms" -if {! [catch {exec grep -q utrace_attach $path} dummy]} { - set utrace_support_found 1 -} -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$test" catch {exec rm -f $sup_srcpath} return diff --git a/testsuite/systemtap.base/uprobes.exp b/testsuite/systemtap.base/uprobes.exp index 89250e7b..6344cbf0 100644 --- a/testsuite/systemtap.base/uprobes.exp +++ b/testsuite/systemtap.base/uprobes.exp @@ -18,14 +18,7 @@ if [file exists $path] then { pass "$test prep" } else { fail "$test prep" } catch {exec gcc -g -o jennie jennie.c} err if {$err == "" && [file exists jennie]} then { pass "$test compile" } else { fail "$test compile" } -# Try to find utrace_attach symbol in /proc/kallsyms -# copy from utrace_p5.exp -set utrace_support_found 0 -set path "/proc/kallsyms" -if {! [catch {exec grep -q utrace_attach $path} dummy]} { - set utrace_support_found 1 -} -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$test -p4"; untested "$test -p5" catch {exec rm -f jennie.c jennie} return diff --git a/testsuite/systemtap.base/uprobes_lib.exp b/testsuite/systemtap.base/uprobes_lib.exp index ae1b72e8..63ef957a 100644 --- a/testsuite/systemtap.base/uprobes_lib.exp +++ b/testsuite/systemtap.base/uprobes_lib.exp @@ -10,21 +10,23 @@ set testflags "additional_flags=-g additional_flags=-O" set testlibflags "$testflags additional_flags=-fPIC additional_flags=-shared" set maintestflags "$testflags additional_flags=-L$testlibdir additional_flags=-l$testlibname additional_flags=-Wl,-rpath,$testlibdir" -# Only run on make installcheck -if {! [installtest_p]} { untested "$test"; return } - # Compile our test program and library. set res [target_compile $testsrclib $testso executable $testlibflags] if { $res != "" } { verbose "target_compile for $testso failed: $res" 2 - fail "unable to compile $testsrclib" + fail "$test compile $testsrclib" return +} else { + pass "$test compile $testsrclib" } + set res [target_compile $testsrc $testexe executable $maintestflags] if { $res != "" } { verbose "target_compile failed: $res" 2 - fail "unable to compile $testsrc" + fail "$test compile $testsrc" return +} else { + pass "$test compile $testsrc" } # XXX main_func needs another/extra test. Disabled for now. @@ -33,6 +35,9 @@ if { $res != "" } { # lib_func} set ::result_string {lib_func} +# Only run on make installcheck +if {! [installtest_p]} { untested "$test"; return } +if {! [utrace_p]} { untested $test; return } stap_run2 $srcdir/$subdir/$test.stp -c $testexe #exec rm -f $testexe $testso diff --git a/testsuite/systemtap.base/utrace_p4.exp b/testsuite/systemtap.base/utrace_p4.exp index 1467d9c8..8d323a8a 100644 --- a/testsuite/systemtap.base/utrace_p4.exp +++ b/testsuite/systemtap.base/utrace_p4.exp @@ -7,8 +7,6 @@ # utrace doesn't exist in the kernel, marks the tests as 'untested'. # Initialize variables -set utrace_support_found 0 - set begin_script {"probe process(\"/bin/ls\").begin { print(\"ls begin\") }"} set end_script {"probe process(\"/bin/ls\").end { print(\"ls end\") }"} set syscall_script {"probe process(\"/bin/ls\").syscall { printf(\"|%d\", \$syscall) }"} @@ -24,18 +22,12 @@ set pid_syscall_return_script {"probe process(123).syscall.return { printf(\"|%d set pid_thread_begin_script {"probe process(123).thread.begin { print(\"123 thread.begin\") }"} set pid_thread_end_script {"probe process(123).thread.end { print(\"123 thread.end\") }"} -# Try to find utrace_attach symbol in /proc/kallsyms -set path "/proc/kallsyms" -if {! [catch {exec grep -q utrace_attach $path} dummy]} { - set utrace_support_found 1 -} - # # Do some utrace compile tests. # set TEST_NAME "UTRACE_P4_01" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } else { # Try compiling a begin script using a path @@ -43,7 +35,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P4_01_pid" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } else { # Try compiling a begin script using a pid @@ -51,7 +43,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P4_02" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } else { # Try compiling a end script using a path @@ -59,7 +51,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P4_02_pid" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } else { # Try compiling a end script using a pid @@ -67,7 +59,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P4_03" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } else { # Try compiling a syscall script using a path @@ -75,7 +67,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P4_03_pid" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } else { # Try compiling a syscall script using a pid @@ -83,7 +75,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P4_04" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } else { # Try compiling a syscall return script using a path @@ -91,7 +83,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P4_04_pid" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } else { # Try compiling a syscall return script using a pid @@ -99,7 +91,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P4_05" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } else { # Try compiling an thread.begin script using a path @@ -107,7 +99,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P4_05_pid" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } else { # Try compiling an thread.begin script using a pid @@ -115,7 +107,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P4_06" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } else { # Try compiling an thread.end script using a path @@ -123,7 +115,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P4_06_pid" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } else { # Try compiling an thread.end script using a pid @@ -131,7 +123,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P4_07" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } else { # Try compiling an system-wide begin script diff --git a/testsuite/systemtap.base/utrace_p5.exp b/testsuite/systemtap.base/utrace_p5.exp index 33281350..3d432dc3 100644 --- a/testsuite/systemtap.base/utrace_p5.exp +++ b/testsuite/systemtap.base/utrace_p5.exp @@ -1,7 +1,6 @@ # Utrace run (pass 5) tests. # Initialize variables -set utrace_support_found 0 set exepath "[pwd]/cat_[pid]" set multi_srcpath "$srcdir/systemtap.base/utrace_p5_multi.c" set multi_exepath "[pwd]/utrace_p5_multi_[pid]" @@ -90,12 +89,6 @@ set bz6841_script { } set bz6841_script_output ".+ issues syscall \\d+ times\r\n" -# Try to find utrace_attach symbol in /proc/kallsyms -set path "/proc/kallsyms" -if {! [catch {exec grep -q utrace_attach $path} dummy]} { - set utrace_support_found 1 -} - # Set up our own copy of /bin/cat, to make testing for a particular # executable easy. We can't use 'ln' here, since we might be creating # a cross-device link. We can't use 'ln -s' here, since the kernel @@ -138,7 +131,7 @@ proc run_utrace_p5_multi {} { } set TEST_NAME "UTRACE_P5_01" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } elseif {![installtest_p]} { untested "$TEST_NAME" @@ -148,7 +141,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P5_02" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } elseif {![installtest_p]} { untested "$TEST_NAME" @@ -158,7 +151,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P5_03" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } elseif {![installtest_p]} { untested "$TEST_NAME" @@ -168,7 +161,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P5_04" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } elseif {![installtest_p]} { untested "$TEST_NAME" @@ -178,7 +171,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P5_05" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } elseif {![installtest_p]} { untested "$TEST_NAME" @@ -189,7 +182,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P5_06" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } elseif {![installtest_p]} { untested "$TEST_NAME" @@ -200,7 +193,7 @@ if {$utrace_support_found == 0} { } set TEST_NAME "UTRACE_P5_07" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } elseif {![installtest_p]} { untested "$TEST_NAME" -- cgit From ab16aae80b49823e96b31e7ab47fcdb3a199412f Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 2 Apr 2009 14:48:37 +0200 Subject: PR9995: Test for [installtest_p] && [utrace_p]. --- testsuite/systemtap.base/sdt.exp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/sdt.exp b/testsuite/systemtap.base/sdt.exp index 46fa5a28..c3aed91e 100644 --- a/testsuite/systemtap.base/sdt.exp +++ b/testsuite/systemtap.base/sdt.exp @@ -36,7 +36,7 @@ if { $res != "" } { pass "compiling $test.c $extra_flag" } -if {[installtest_p]} { +if {[installtest_p] && [utrace_p]} { stap_run3 "$test $extra_flag" $srcdir/$subdir/$test.stp $testprog -c ./$testprog } else { untested "$test $extra_flag" @@ -61,7 +61,7 @@ if { $res != "" } { pass "compiling $test.c c++ $extra_flag" } -if {[installtest_p]} { +if {[installtest_p] && [utrace_p]} { stap_run3 "$test c++ $extra_flag" $srcdir/$subdir/$test.stp $testprog -c ./$testprog } else { untested "$test c++ $extra_flag" -- cgit From 15a78144473940a4e7c685cc57ba09a92f2293c6 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 2 Apr 2009 16:26:50 +0200 Subject: itrace.exp: s/utrace_support_found/utrace_p/ --- testsuite/systemtap.base/itrace.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/itrace.exp b/testsuite/systemtap.base/itrace.exp index c7da39c8..5da0dfaf 100644 --- a/testsuite/systemtap.base/itrace.exp +++ b/testsuite/systemtap.base/itrace.exp @@ -113,7 +113,7 @@ if {![utrace_p]} { } set TEST_NAME "itrace3" -if {$utrace_support_found == 0} { +if {![utrace_p]} { untested "$TEST_NAME : no kernel utrace support found" } elseif {![installtest_p]} { untested $TEST_NAME -- cgit