From: David Smith Date: Fri, 20 Nov 2015 16:53:51 +0000 (-0600) Subject: Fixed PR19275 by updating stap_run. X-Git-Tag: release-3.0~270 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=b5a1bb4b7e8d35f20fa79a743350b6aa195af950;p=systemtap.git Fixed PR19275 by updating stap_run. * testsuite/lib/stap_run.exp: The stap_run() function now fails if it receives any unexpected output. The 'all_pass_string' was modified to be only one copy of "systemtap test success" instead of allowing of multiple copies. * testsuite/systemtap.base/array_slicing.exp: Handle stap_run changes. Also, fixed the test names so that they aren't '$test_name'. * testsuite/systemtap.base/at_var_tracepoint.exp: Update for stap_run changes. * testsuite/systemtap.base/at_var_tracepoint.stp: Ditto. * testsuite/systemtap.base/be_order.stp: Ditto. * testsuite/systemtap.base/div0.exp: Ditto. * testsuite/systemtap.base/error_fn.exp: Ditto. * testsuite/systemtap.base/global_init.stp: Ditto. * testsuite/systemtap.base/global_var_kernel.exp: Ditto. * testsuite/systemtap.base/global_vars.stp: Ditto. * testsuite/systemtap.base/if.exp: Ditto. * testsuite/systemtap.base/if.stp: Ditto. * testsuite/systemtap.base/kprobes.exp: Ditto. * testsuite/systemtap.base/logical_and.stp: Ditto. * testsuite/systemtap.base/maxactive.exp: Ditto. * testsuite/systemtap.base/pp.exp: Ditto. * testsuite/systemtap.base/print.exp: Ditto. * testsuite/systemtap.base/proc_by_pid.exp: Ditto. * testsuite/systemtap.base/process_by_pid.exp: Ditto. * testsuite/systemtap.base/procfs_maxsize.exp: Ditto. * testsuite/systemtap.base/procfs_umask.exp: Ditto. * testsuite/systemtap.base/stmt_counting.exp: Ditto. * testsuite/systemtap.base/stmt_counting_functions.stp: Ditto. * testsuite/systemtap.base/stmt_counting_straight.stp: Ditto. * testsuite/systemtap.base/timers.exp: Ditto. * testsuite/systemtap.base/tri.stp: Ditto. * testsuite/systemtap.context/context_ns.exp: Ditto. * testsuite/systemtap.context/pid_ns.stp: Ditto. * testsuite/systemtap.context/usymfileline.exp: Ditto. * testsuite/systemtap.printf/memory1.exp: Ditto. * testsuite/systemtap.stress/current.exp: Ditto. --- diff --git a/testsuite/lib/stap_run.exp b/testsuite/lib/stap_run.exp index dab8e06c1..c5aa59014 100644 --- a/testsuite/lib/stap_run.exp +++ b/testsuite/lib/stap_run.exp @@ -90,8 +90,14 @@ proc stap_run { TEST_NAME {LOAD_GEN_FUNCTION ""} {OUTPUT_CHECK_STRING ""} args } -re $warning_regexp { set probe_errors $expect_out(1,string) set skipped_probes $expect_out(2,string)} + default { + fail "$TEST_NAME unexpected output (after passing output)" + } } } + default { + fail "$TEST_NAME unexpected output" + } timeout { fail "$TEST_NAME shutdown (timeout)" kill -INT -[exp_pid] @@ -166,4 +172,4 @@ print_system_info # BZ692445 was fixed by removing the '$' at the end of # all_pass_string. Yet another expect regular expression oddity. The # '\r\n' is good enough at finding the EOL. -set all_pass_string "(systemtap test success\r\n)+" +set all_pass_string "systemtap test success\r\n" diff --git a/testsuite/systemtap.base/array_slicing.exp b/testsuite/systemtap.base/array_slicing.exp index d7822cbe8..73cce3cb6 100644 --- a/testsuite/systemtap.base/array_slicing.exp +++ b/testsuite/systemtap.base/array_slicing.exp @@ -1,6 +1,7 @@ set test_name array_slicing -# basic version of the script to be used. values need to be subbed in for each test +# basic version of the script to be used. values need to be subbed in +# for each test set script { \ global val; \ probe begin { \ @@ -12,22 +13,24 @@ set script { \ } # this is set up to act like a normal for loop -stap_run {$test_name foreach (... val[*, *])} "" "11 end" -e $script 2 {"hello"} 1 1 {"hey"} 1 * * +stap_run "$test_name foreach (... val\[*, *\])" "" "11 end" -e $script 2 {"hello"} 1 1 {"hey"} 1 * * # testing foreach( a=[b,c] in val[int, int] ) -stap_run {$test_name foreach (... val[int, int])} "" "2 end" -e $script 2 2 2 3 3 3 2 2 +stap_run "$test_name foreach (... val\[int, int\])" "" "2 end" -e $script 2 2 2 3 3 3 2 2 # testing foreach( a=[b,c] in val[string, string] ), where there is a match -stap_run {$test_name foreach (... val[string, string])} "" "1 end" -e $script {"asdf"} {"jkl"} 1 {"fdsa"} {"lkj"} 2 {"asdf"} {"jkl"} +stap_run "$test_name foreach (... val\[string, string\])" "" "1 end" -e $script {"asdf"} {"jkl"} 1 {"fdsa"} {"lkj"} 2 {"asdf"} {"jkl"} # testing foreach( a=[b,c] in val[variable, *] ), where there is a match -stap_run {$test_name foreach (... val[variable, *])} "" "4 end" -e $script 9 1 4 8 9 9 {val[8,9]} * +stap_run "$test_name foreach (... val\[variable, *\])" "" "4 end" -e $script 9 1 4 8 9 9 {val[8,9]} * -# testing foreach( a=[b,c] in val[string, variable/string] ), where there is a match -stap_run {$test_name foreach (... val[variable, string])} "" "asdf end" -e $script {"hi"} {"hello"} {"asdf"} {"hi"} {"hi"} {"hello"} {"hi"} {val["hi","hi"]} +# testing foreach( a=[b,c] in val[string, variable/string] ), where +# there is a match +stap_run "$test_name foreach (... val\[variable, string\])" "" "asdf end" -e $script {"hi"} {"hello"} {"asdf"} {"hi"} {"hi"} {"hello"} {"hi"} {val["hi","hi"]} # testing foreach(... val[c,d]){c++;d++} -# in this case, expecting the c++ and d++ to not affect the c and d in the array slice +# in this case, expecting the c++ and d++ to not affect the c and d in +# the array slice set script { \ global val, c=1, d=3; \ probe begin { \ @@ -36,7 +39,7 @@ set script { \ foreach ([a,b] in val[c,d]){print(val[a,b]);c++;d++} \ } \ } -stap_run {$test_name foreach (... val[c,d]) {c++;d++;}} "" "5" -e $script +stap_run "$test_name foreach (... val\[c,d\]) {c++;d++;}" "" "5" -e $script # testing foreach(.. val[expression, *]) set script { \ @@ -47,7 +50,7 @@ set script { \ foreach ([a,b] in val[(c==d ? d : c), *]){print(val[a,b])} \ } \ } -stap_run {$test_name foreach (... val[expression,*])} "" "5" -e $script +stap_run "$test_name foreach (... val\[expression,*\])" "" "5" -e $script # testing sorting in foreach loops set script { \ @@ -63,7 +66,7 @@ set script { \ foreach ([a,b] in stats[*,1] @sum-) print(@sum(stats[a,b])); \ } \ } -stap_run {$test_name foreach sorting} "" "1234554321985" -e $script +stap_run "$test_name foreach sorting" "" "1234554321985" -e $script # testing array slicing with delete statements @@ -78,16 +81,16 @@ set script { \ } # testing delete val[*,*] -stap_run {$test_name delete val[*,*]} "" "00" -e $script * * +stap_run "$test_name delete val\[*,*\]" "" "00" -e $script * * # testing delete val[*, string] -stap_run {$test_name delete val[*, string]} "" "06" -e $script * {"hello"} +stap_run "$test_name delete val\[*, string\]" "" "06" -e $script * {"hello"} # testing delete val[int,*] -stap_run {$test_name delete val[int, *]} "" "90" -e $script 300 * +stap_run "$test_name delete val\[int, *\]" "" "90" -e $script 300 * # testing delete val[expression,*] -stap_run {$test_name delete val[epression, *]} "" "90" -e $script {(val[9,"hello"] == val[300,"there"] ? 9 : 300)} * +stap_run "$test_name delete val\[epression, *\]" "" "90" -e $script {(val[9,"hello"] == val[300,"there"] ? 9 : 300)} * # testing delete statements on pmaps set script { \ @@ -100,7 +103,7 @@ set script { \ print (@count(stats[1, 1])); print(@count(stats[2,2])); \ } \ } -stap_run {$test_name delete pmaps} "" "01" -e $script +stap_run "$test_name delete pmaps" "" "01" -e $script # testing membership, [*, *] in foo set script { \ @@ -112,16 +115,16 @@ set script { \ } \ } # testing membership [*,*] -stap_run {$test_name membership [*,*] in val} "" "in" -e $script * * +stap_run "$test_name membership \[*,*\] in val" "" "in" -e $script * * # testing membership [*, string] -stap_run {$test_name membership [*, string] in val} "" "in" -e $script * {"hello"} +stap_run "$test_name membership \[*, string\] in val" "" "in" -e $script * {"hello"} # testing membership [int,*] -stap_run {$test_name membership [int, *] in val} "" "not in" -e $script 309 * +stap_run "$test_name membership \[int, *\] in val" "" "not in" -e $script 309 * # testing membership [expression,*] -stap_run {$test_name membership [expression,*] in val} "" "not in" -e $script {(val[9, "hello"] == val[300, "there"]? 9 : 900)} * +stap_run "$test_name membership \[expression,*\] in val" "" "not in" -e $script {(val[9, "hello"] == val[300, "there"]? 9 : 900)} * # testing membership with pmaps set script { global stats \ @@ -131,14 +134,15 @@ set script { global stats \ print([1, *] in stats); print([2, *] in stats) \ } \ } -stap_run {$test_name membership pmaps} "" "10" -e $script +stap_run "$test_name membership pmaps" "" "10" -e $script -# testing membership with pmaps, to make sure it doesn't re-aggregate in the loop +# testing membership with pmaps, to make sure it doesn't re-aggregate +# in the loop set script { global stats \ probe begin {stats[1,1] <<< 2; exit();} \ probe end { \ print("systemtap starting probe\nsystemtap ending probe\n"); \ - foreach([x,y] in stats) println([1,*] in stats) \ + foreach([x,y] in stats) print([1,*] in stats) \ } \ } -stap_run {$test_name membership pmaps (2)} "" "1" -e $script +stap_run "$test_name membership pmaps (2)" "" "1" -e $script diff --git a/testsuite/systemtap.base/at_var_tracepoint.exp b/testsuite/systemtap.base/at_var_tracepoint.exp index 5dc683741..2cccab6a1 100644 --- a/testsuite/systemtap.base/at_var_tracepoint.exp +++ b/testsuite/systemtap.base/at_var_tracepoint.exp @@ -2,7 +2,7 @@ set test "at_var_tracepoint" set testpath "$srcdir/$subdir" # Check @var() is usable in the kernel tracepoint probes. -set output_string "sys_tz = {.tz_minuteswest=-?\\d+, .tz_dsttime=\\d+}" +set output_string "sys_tz = {.tz_minuteswest=-?\\d+, .tz_dsttime=\\d+}\r\n" # Only run on make installcheck if {! [installtest_p]} { untested "$test"; return } diff --git a/testsuite/systemtap.base/at_var_tracepoint.stp b/testsuite/systemtap.base/at_var_tracepoint.stp index 4f6a31d87..6f3b40a8f 100644 --- a/testsuite/systemtap.base/at_var_tracepoint.stp +++ b/testsuite/systemtap.base/at_var_tracepoint.stp @@ -1,9 +1,20 @@ # Test global vars are usable in the kernel tracepoint probes. +global sys_tz_str + +probe begin +{ + log("systemtap starting probe") +} + probe kernel.trace("sched_switch") { - log("systemtap starting probe"); - log("systemtap ending probe"); - printf("sys_tz = %s\n", @var("sys_tz@time.c")$$); - exit(); + sys_tz_str = @var("sys_tz@time.c")$$ + exit() +} + +probe end +{ + log("systemtap ending probe") + printf("sys_tz = %s\n", sys_tz_str) } diff --git a/testsuite/systemtap.base/be_order.stp b/testsuite/systemtap.base/be_order.stp index 57effb1f5..0e3fa70d2 100644 --- a/testsuite/systemtap.base/be_order.stp +++ b/testsuite/systemtap.base/be_order.stp @@ -22,16 +22,22 @@ probe end(-1) { endstr .= "w" } probe end(0) { endstr .= "x" } probe end(9223372036854775807) { endstr .= "z" + rc = 0 if (beginstr == "abccde") - println("systemtap test success") + rc += 1 else printf("systemtap test failure - beginstr:%s != abccde\n", beginstr) if (endstr == "vwxxyz") - println("systemtap test success") + rc += 1 else printf("systemtap test failure - endstr:%s != vwxxyz\n", endstr) + + if (rc == 2) + println("systemtap test success") + else + printf("systemtap test failure (%d passes)\n", rc) } probe end(-9223372036854775808) { endstr .= "v" } diff --git a/testsuite/systemtap.base/div0.exp b/testsuite/systemtap.base/div0.exp index a98c32332..00a0f251b 100644 --- a/testsuite/systemtap.base/div0.exp +++ b/testsuite/systemtap.base/div0.exp @@ -2,7 +2,7 @@ set test "div0" -set output_string "(.*)division by 0 near(.*)" +set output_string {ERROR: division by 0 near[^\r\n]+\r\n} foreach runtime [get_runtime_list] { if {$runtime != ""} { diff --git a/testsuite/systemtap.base/error_fn.exp b/testsuite/systemtap.base/error_fn.exp index f4d7deb84..766f66bc8 100644 --- a/testsuite/systemtap.base/error_fn.exp +++ b/testsuite/systemtap.base/error_fn.exp @@ -5,10 +5,10 @@ set test "error_fn" foreach runtime [get_runtime_list] { if {$runtime != ""} { - stap_run $srcdir/$subdir/$test.stp no_load ".*synthetic error.*" \ + stap_run $srcdir/$subdir/$test.stp no_load "ERROR: synthetic error\r\n" \ --runtime=$runtime } else { - stap_run $srcdir/$subdir/$test.stp no_load ".*synthetic error.*" + stap_run $srcdir/$subdir/$test.stp no_load "ERROR: synthetic error\r\n" } } diff --git a/testsuite/systemtap.base/global_init.stp b/testsuite/systemtap.base/global_init.stp index 304788464..c43c3fe8d 100644 --- a/testsuite/systemtap.base/global_init.stp +++ b/testsuite/systemtap.base/global_init.stp @@ -18,14 +18,20 @@ probe begin(-9223372036854775808) { } probe end { + rc = 0 if (gnum_saved == 42) - println("systemtap test success") + rc += 1 else printf("systemtap test failure - gnum_saved:%d != 42\n", gnum_saved) if (gstr_saved == "foobar") - println("systemtap test success") + rc += 1 else printf("systemtap test failure - gstr_saved:%s != foobar\n", gstr_saved) + + if (rc == 2) + println("systemtap test success") + else + printf("systemtap test failure (%d passes)\n", rc) } diff --git a/testsuite/systemtap.base/global_var_kernel.exp b/testsuite/systemtap.base/global_var_kernel.exp index a8e501073..f16345062 100644 --- a/testsuite/systemtap.base/global_var_kernel.exp +++ b/testsuite/systemtap.base/global_var_kernel.exp @@ -3,7 +3,7 @@ set testpath "$srcdir/$subdir" # Check the righ "kernel/time.c" is picked up (both in the syscall probe # context and the stap function context. -set output_string "sys_tz = {.tz_minuteswest=-?\\d+, .tz_dsttime=\\d+}\r\nf: {.tz_minuteswest=-?\\d+, .tz_dsttime=\\d+}" +set output_string "sys_tz = {.tz_minuteswest=-?\\d+, .tz_dsttime=\\d+}\r\nf: {.tz_minuteswest=-?\\d+, .tz_dsttime=\\d+}\r\n" # Only run on make installcheck if {! [installtest_p]} { untested "$test"; return } diff --git a/testsuite/systemtap.base/global_vars.stp b/testsuite/systemtap.base/global_vars.stp index 737e25562..a5a813a99 100644 --- a/testsuite/systemtap.base/global_vars.stp +++ b/testsuite/systemtap.base/global_vars.stp @@ -24,34 +24,40 @@ probe begin(-9223372036854775808) { } probe end { + rc = 0 if (c == 42) - println("systemtap test success") + rc += 1 else printf("systemtap test failure - c:%d != 42\n", c) if (d == (c + g)) - println("systemtap test success") + rc += 1 else printf("systemtap test failure - d:%d != %d\n", d, (c+g)) if (a == d) - println("systemtap test success") + rc += 1 else printf("systemtap test failure - a:%d != %d\n", a, d) if (f == c) - println("systemtap test success") + rc += 1 else printf("systemtap test failure - f:%d != %d\n", f, c) if (e[0] == "a") - println("systemtap test success") + rc += 1 else printf("systemtap test failure - e:%s != a\n", e[0]) if (gstr_saved == "foobar") - println("systemtap test success") + rc += 1 else printf("systemtap test failure - gstr_saved:%s != foobar\n", gstr_saved) + + if (rc == 6) + println("systemtap test success") + else + printf("systemtap test failure (%d passes)\n", rc) } diff --git a/testsuite/systemtap.base/if.exp b/testsuite/systemtap.base/if.exp index fa9df0aa2..076287348 100644 --- a/testsuite/systemtap.base/if.exp +++ b/testsuite/systemtap.base/if.exp @@ -3,14 +3,11 @@ set test "if" -# Note that we're looking for the all_pass_string twice, since the -# test case prints it twice. - foreach runtime [get_runtime_list] { if {$runtime != ""} { - stap_run $srcdir/$subdir/$test.stp no_load "${all_pass_string}${all_pass_string}" \ + 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}${all_pass_string}" + stap_run $srcdir/$subdir/$test.stp no_load $all_pass_string } } diff --git a/testsuite/systemtap.base/if.stp b/testsuite/systemtap.base/if.stp index fa4da54d0..f34537143 100644 --- a/testsuite/systemtap.base/if.stp +++ b/testsuite/systemtap.base/if.stp @@ -8,15 +8,21 @@ probe begin { println("systemtap starting probe") } probe end { + rc = 0 println("systemtap ending probe") if (1) { - println("systemtap test success"); + rc += 1 } else { println("systemtap test failure"); } if (0) { println("systemtap test failure"); } else { - println("systemtap test success"); + rc += 1 } + + if (rc == 2) + println("systemtap test success") + else + printf("systemtap test failure (%d passes)\n", rc) } diff --git a/testsuite/systemtap.base/kprobes.exp b/testsuite/systemtap.base/kprobes.exp index 635930f8c..307dc5e12 100644 --- a/testsuite/systemtap.base/kprobes.exp +++ b/testsuite/systemtap.base/kprobes.exp @@ -1,2 +1,2 @@ set test "kprobes" -stap_run $srcdir/$subdir/$test.stp no_load "probe point hit" +stap_run $srcdir/$subdir/$test.stp no_load "probe point hit\r\n" diff --git a/testsuite/systemtap.base/logical_and.stp b/testsuite/systemtap.base/logical_and.stp index 3f4961b46..516644249 100644 --- a/testsuite/systemtap.base/logical_and.stp +++ b/testsuite/systemtap.base/logical_and.stp @@ -17,25 +17,31 @@ probe begin probe end { + rc = 0 println("systemtap ending probe") if (x1_0 && x3_0 ) { println("systemtap test failure"); } else { - println("systemtap test success"); + rc += 1 } if (x2_1 && x3_0 ) { println("systemtap test failure"); } else { - println("systemtap test success"); + rc += 1 } if (x1_0 && x4_1 ) { println("systemtap test failure"); } else { - println("systemtap test success"); + rc += 1 } if (x2_1 && x4_1 ) { - println("systemtap test success"); + rc += 1 } else { println("systemtap test failure"); } + + if (rc == 4) + println("systemtap test success") + else + printf("systemtap test failure (%d passes)\n", rc) } diff --git a/testsuite/systemtap.base/maxactive.exp b/testsuite/systemtap.base/maxactive.exp index 1994661dd..3b2eb4767 100644 --- a/testsuite/systemtap.base/maxactive.exp +++ b/testsuite/systemtap.base/maxactive.exp @@ -18,12 +18,13 @@ set script1 { kernel.function("do_select").return { foo++ } probe timer.ms(1000) { exit(); } - probe begin { log("systemtap starting probe"); log("systemtap ending probe");} + probe begin { log("systemtap starting probe") } + probe end { log("systemtap ending probe"); printf("foo = %d\n", foo) } } # Run script1 and save the number of skipped probes (which will most # likely be 0). -stap_run "MAXACTIVE01" sleep_one_sec "" -e $script1 +stap_run "MAXACTIVE01" sleep_one_sec {foo = \d+\r\n} -e $script1 set skipped1 $skipped_probes # Script2. For 1 second, probe the return of "vfs_read" and @@ -35,11 +36,12 @@ set script2 { kernel.function("do_select").return.maxactive(1) { foo++ } probe timer.ms(1000) { exit(); } - probe begin { log("systemtap starting probe"); log("systemtap ending probe");} + probe begin { log("systemtap starting probe") } + probe end { log("systemtap ending probe"); printf("foo = %d\n", foo) } } # Run script2 and save the number of skipped probes. -set output_string "(WARNING: Number of errors: 0, skipped probes: \\d+\r\n)?" +set output_string {foo = \d+\r\n(WARNING: Number of errors: 0, skipped probes: \d+\r\n)?} stap_run "MAXACTIVE02" sleep_one_sec $output_string -e $script2 set skipped2 $skipped_probes diff --git a/testsuite/systemtap.base/pp.exp b/testsuite/systemtap.base/pp.exp index 2aa47fb75..3eeb0ff93 100644 --- a/testsuite/systemtap.base/pp.exp +++ b/testsuite/systemtap.base/pp.exp @@ -2,6 +2,8 @@ proc opener {} { # the test uses syscall.open -- make sure it happens exec cat /dev/null + exec cat /dev/null + wait_n_secs 1 return 0; } diff --git a/testsuite/systemtap.base/print.exp b/testsuite/systemtap.base/print.exp index 52f92cc0b..b0387f43e 100644 --- a/testsuite/systemtap.base/print.exp +++ b/testsuite/systemtap.base/print.exp @@ -2,11 +2,12 @@ set test "print" +set output_string "(${all_pass_string}){9}" foreach runtime [get_runtime_list] { if {$runtime != ""} { - stap_run $srcdir/$subdir/$test.stp no_load $all_pass_string \ + stap_run $srcdir/$subdir/$test.stp no_load $output_string \ --runtime=$runtime } else { - stap_run $srcdir/$subdir/$test.stp no_load $all_pass_string + stap_run $srcdir/$subdir/$test.stp no_load $output_string } } diff --git a/testsuite/systemtap.base/proc_by_pid.exp b/testsuite/systemtap.base/proc_by_pid.exp index 23f1e34cf..2e266f9ec 100644 --- a/testsuite/systemtap.base/proc_by_pid.exp +++ b/testsuite/systemtap.base/proc_by_pid.exp @@ -17,7 +17,7 @@ if {$compile_result != ""} { } # Expected output -set output_string "Encountered \[0-4\] functions, and \[0-2\] marks" +set output_string "Encountered \[0-4\] functions, and \[0-2\] marks\r\n" # Running the test program and script foreach runtime [get_runtime_list] { diff --git a/testsuite/systemtap.base/process_by_pid.exp b/testsuite/systemtap.base/process_by_pid.exp index 1aabf0556..f15bce102 100644 --- a/testsuite/systemtap.base/process_by_pid.exp +++ b/testsuite/systemtap.base/process_by_pid.exp @@ -14,7 +14,7 @@ proc sleep_twenty_secs {} { } # expected output -set output_string "pass" +set output_string "pass\r\n" # running multiple instances of the test program # the idea behind this is that in the stap script, it will check the pid it is diff --git a/testsuite/systemtap.base/procfs_maxsize.exp b/testsuite/systemtap.base/procfs_maxsize.exp index 4d89f1006..027c8c312 100644 --- a/testsuite/systemtap.base/procfs_maxsize.exp +++ b/testsuite/systemtap.base/procfs_maxsize.exp @@ -342,5 +342,5 @@ exec /bin/rm -f ${test}.ko # Buffer is exactly large enough to hold contents set test "PROCFS_BUFFER9" -stap_run $test proc_read_write_46 "" -DSTP_PROCFS_BUFSIZE=46 -e $script5 -m $test +stap_run $test proc_read_write_46 "\r\n" -DSTP_PROCFS_BUFSIZE=46 -e $script5 -m $test exec /bin/rm -f ${test}.ko diff --git a/testsuite/systemtap.base/procfs_umask.exp b/testsuite/systemtap.base/procfs_umask.exp index dd4ef2f52..3706db3b7 100644 --- a/testsuite/systemtap.base/procfs_umask.exp +++ b/testsuite/systemtap.base/procfs_umask.exp @@ -64,7 +64,7 @@ set systemtap_script { } # test procfs umask probes -set output_string "Testing permissions\r\n" +set output_string "Testing permissions\r\nvalue=\"600\r\n\"\r\n" stap_run $test check_perm_val $output_string -e $systemtap_script -m $test exec /bin/rm -f ${test}.ko diff --git a/testsuite/systemtap.base/stmt_counting.exp b/testsuite/systemtap.base/stmt_counting.exp index c4638907f..f67a0ef05 100644 --- a/testsuite/systemtap.base/stmt_counting.exp +++ b/testsuite/systemtap.base/stmt_counting.exp @@ -3,7 +3,7 @@ set test_names {"stmt_counting_recursion" "stmt_counting_loops" "stmt_counting_s foreach test_name $test_names { set test_val 6 # Expected output - set output_string "pass" + set output_string "pass\r\n" if {! [installtest_p]} { untested $test_name return diff --git a/testsuite/systemtap.base/stmt_counting_functions.stp b/testsuite/systemtap.base/stmt_counting_functions.stp index 6cd485a8f..ddead449a 100644 --- a/testsuite/systemtap.base/stmt_counting_functions.stp +++ b/testsuite/systemtap.base/stmt_counting_functions.stp @@ -16,9 +16,9 @@ probe begin { printf("systemtap ending probe\n"); if (num = (num + $1)) - printf("passed the test\n"); + printf("pass\n"); else - printf("failed the test\n"); + printf("fail\n"); exit(); } diff --git a/testsuite/systemtap.base/stmt_counting_straight.stp b/testsuite/systemtap.base/stmt_counting_straight.stp index 948cb7051..c1f9d0df3 100644 --- a/testsuite/systemtap.base/stmt_counting_straight.stp +++ b/testsuite/systemtap.base/stmt_counting_straight.stp @@ -18,9 +18,9 @@ probe begin { printf("systemtap ending probe\n"); if (num == 5) - printf("passed the test\n"); + printf("pass\n"); else - printf("failed the test\n"); + printf("fail\n"); exit(); } diff --git a/testsuite/systemtap.base/timers.exp b/testsuite/systemtap.base/timers.exp index 70ed3413a..30041aa44 100644 --- a/testsuite/systemtap.base/timers.exp +++ b/testsuite/systemtap.base/timers.exp @@ -11,6 +11,6 @@ proc sleep_ten_secs {} { #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. -set output_string "(\\w+ = \\d+\r\n){7}${all_pass_string}(WARNING.*skipped.*)?" +set output_string "(\\w+ = \\d+\r\n){7}(${all_pass_string}){4}(WARNING.*skipped.*)?" stap_run $srcdir/$subdir/$test.stp sleep_ten_secs $output_string diff --git a/testsuite/systemtap.base/tri.stp b/testsuite/systemtap.base/tri.stp index 92b788015..b7a5a8c87 100644 --- a/testsuite/systemtap.base/tri.stp +++ b/testsuite/systemtap.base/tri.stp @@ -14,6 +14,7 @@ probe begin probe end { + rc = 0 println("systemtap ending probe") x4 = x1 ? 9: 10; x5 = x2 ? 99: 100; @@ -21,16 +22,21 @@ probe end if (x4 != 10 ) { println("systemtap test failure"); } else { - println("systemtap test success"); + rc += 1 } if (x5 != 99 ) { println("systemtap test failure"); } else { - println("systemtap test success"); + rc += 1 } if (x6 != 999 ) { println("systemtap test failure"); } else { - println("systemtap test success"); + rc += 1 } + + if (rc == 3) + println("systemtap test success") + else + printf("systemtap test failure (%d passes)\n", rc) } diff --git a/testsuite/systemtap.context/context_ns.exp b/testsuite/systemtap.context/context_ns.exp index 62334c5c1..bb1353153 100644 --- a/testsuite/systemtap.context/context_ns.exp +++ b/testsuite/systemtap.context/context_ns.exp @@ -6,7 +6,7 @@ if {! [installtest_p]} { # can't really test user_ns right now since we don't know other uids set ns_tests { pid_ns } -set output_string "END" +set output_string "END\r\n" # before we can even run the test, check that unshare is available # probably only available in kernels >= 2.6.16 @@ -21,6 +21,12 @@ if {![min_kernel_vers_p 3.7]} { return } +# Note we have to be root to run "unshare". +set effective_uid [exec /usr/bin/id -u] +if {$effective_uid != 0} { + untested "$test_name (must be root)" + return +} # use unshare to generate new namespaces to use # the returned pid is not the new proc's pid (as seen in the root ns) diff --git a/testsuite/systemtap.context/pid_ns.stp b/testsuite/systemtap.context/pid_ns.stp index 3d6ac4978..cb782cc02 100644 --- a/testsuite/systemtap.context/pid_ns.stp +++ b/testsuite/systemtap.context/pid_ns.stp @@ -15,13 +15,15 @@ probe process("sleep").begin{ // all that we can really do is make a comparison between the original // and the namespace aware versions. // need to check all the conditionals otherwise this test case will fail when it should just be untested - if (check_for_pid_ns() && !hit_pp){ - hit_pp = 1; - if (pid() == ns_pid()) println("FAIL: pid() matches ns_pid()");; - if (tid() == ns_tid()) println("FAIL: tid() matches ns_tid()"); - if (ppid() == ns_ppid()) println("FAIL: ppid() matches ns_ppid()"); - if (sid() == ns_sid()) println("FAIL: sid() matches ns_sid()"); - if (pgrp() == ns_pgrp()) println("FAIL: pgrp() matches ns_pgrp()"); + if (check_for_pid_ns()) { + if (!hit_pp) { + hit_pp = 1; + if (pid() == ns_pid()) println("FAIL: pid() matches ns_pid()");; + if (tid() == ns_tid()) println("FAIL: tid() matches ns_tid()"); + if (ppid() == ns_ppid()) println("FAIL: ppid() matches ns_ppid()"); + if (sid() == ns_sid()) println("FAIL: sid() matches ns_sid()"); + if (pgrp() == ns_pgrp()) println("FAIL: pgrp() matches ns_pgrp()"); + } } else { // this test case is kind of skipped. this should be checked in the tcl file println("FAIL: not configured for pid namespaces"); diff --git a/testsuite/systemtap.context/usymfileline.exp b/testsuite/systemtap.context/usymfileline.exp index c03d47933..556539f56 100644 --- a/testsuite/systemtap.context/usymfileline.exp +++ b/testsuite/systemtap.context/usymfileline.exp @@ -31,12 +31,12 @@ probe process("usymfileline").function("test_method") {\ } set tests {usymfileline usymline usymfile} -set expectedoutput {".*usymfileline.cxx:\[4-5]" "\[4-5]" ".*usymfileline.cxx"} +set expectedoutput {".*usymfileline.cxx:\[4-5]\r\n" "\[4-5]\r\n" ".*usymfileline.cxx\r\n"} foreach test $tests eoutput $expectedoutput { set testscript [string map "TAPSETFUNCTION $test" $script] # test with an invalid address. the expected output is the same for all cases - stap_run "$test ()" no_load "0x0" -e $testscript 0 -c ./usymfileline + stap_run "$test ()" no_load "0x0\r\n" -e $testscript 0 -c ./usymfileline # test with uaddr() stap_run "$test ()" no_load $eoutput -e $testscript uaddr() -c ./usymfileline } @@ -56,7 +56,7 @@ probe process("usymfileline").statement("*@*:*"){\ }\ probe end { if (failed == 0) println("passed") }\ } -stap_run "pp == usymfileline" no_load "passed" -e $script -c ./usymfileline +stap_run "pp == usymfileline" no_load "passed\r\n" -e $script -c ./usymfileline eval exec objcopy -R .debug_line $testname @@ -72,7 +72,7 @@ probe process("usymfileline").begin {\ foreach test $tests { set testscript [string map "TAPSETFUNCTION $test" $script] # test with uaddr(). check that it can still fail gracefully. - stap_run "$test (no debug_line)" no_load "0x\[0-9,a-f]*" -e $testscript uaddr() -c ./usymfileline + stap_run "$test (no debug_line)" no_load "0x\[0-9,a-f]*\r\n" -e $testscript uaddr() -c ./usymfileline } exec rm -f ./$testname diff --git a/testsuite/systemtap.printf/memory1.exp b/testsuite/systemtap.printf/memory1.exp index a247faa1c..c21f4264d 100644 --- a/testsuite/systemtap.printf/memory1.exp +++ b/testsuite/systemtap.printf/memory1.exp @@ -1,5 +1,5 @@ set test "memory1" -set ::result_string {Test passed} +set ::result_string {Test passed\r\n} if {![installtest_p]} { untested $test diff --git a/testsuite/systemtap.stress/current.exp b/testsuite/systemtap.stress/current.exp index 313b67aec..186baa36d 100644 --- a/testsuite/systemtap.stress/current.exp +++ b/testsuite/systemtap.stress/current.exp @@ -19,6 +19,6 @@ proc current_load {} { return 0 } -set output_string "(\\w+ = \\d+\r\n){5}${all_pass_string}(WARNING.*skipped.*)?" +set output_string "(\\w+ = \\d+\r\n){5}(${all_pass_string}){2}(WARNING.*skipped.*)?" stap_run $srcdir/$subdir/$test.stp current_load $output_string -g -w