]> sourceware.org Git - systemtap.git/commitdiff
Fixed PR19275 by updating stap_run.
authorDavid Smith <dsmith@redhat.com>
Fri, 20 Nov 2015 16:53:51 +0000 (10:53 -0600)
committerDavid Smith <dsmith@redhat.com>
Fri, 20 Nov 2015 16:53:51 +0000 (10:53 -0600)
* 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.

31 files changed:
testsuite/lib/stap_run.exp
testsuite/systemtap.base/array_slicing.exp
testsuite/systemtap.base/at_var_tracepoint.exp
testsuite/systemtap.base/at_var_tracepoint.stp
testsuite/systemtap.base/be_order.stp
testsuite/systemtap.base/div0.exp
testsuite/systemtap.base/error_fn.exp
testsuite/systemtap.base/global_init.stp
testsuite/systemtap.base/global_var_kernel.exp
testsuite/systemtap.base/global_vars.stp
testsuite/systemtap.base/if.exp
testsuite/systemtap.base/if.stp
testsuite/systemtap.base/kprobes.exp
testsuite/systemtap.base/logical_and.stp
testsuite/systemtap.base/maxactive.exp
testsuite/systemtap.base/pp.exp
testsuite/systemtap.base/print.exp
testsuite/systemtap.base/proc_by_pid.exp
testsuite/systemtap.base/process_by_pid.exp
testsuite/systemtap.base/procfs_maxsize.exp
testsuite/systemtap.base/procfs_umask.exp
testsuite/systemtap.base/stmt_counting.exp
testsuite/systemtap.base/stmt_counting_functions.stp
testsuite/systemtap.base/stmt_counting_straight.stp
testsuite/systemtap.base/timers.exp
testsuite/systemtap.base/tri.stp
testsuite/systemtap.context/context_ns.exp
testsuite/systemtap.context/pid_ns.stp
testsuite/systemtap.context/usymfileline.exp
testsuite/systemtap.printf/memory1.exp
testsuite/systemtap.stress/current.exp

index dab8e06c1d82a3a150794f988d187658c2553d32..c5aa59014a2194e2f1edffd6ae74fd03aad92014 100644 (file)
@@ -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"
index d7822cbe815dc728a4fb445b65faf1b61835c37c..73cce3cb6372b73e2537475e5d50c5bcfa99c6a4 100644 (file)
@@ -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
index 5dc683741a238d162c4eca517f40331433e86e68..2cccab6a1a153bb7766b6f8eb3efb1c0fa3805fa 100644 (file)
@@ -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 }
index 4f6a31d87e22f4165fe9fd0190169a9d8d51568e..6f3b40a8fea5ef2df148010d8b266ec12c0b27f1 100644 (file)
@@ -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)
 }
index 57effb1f5b8573fae3aa4bb0a412bee8619efa22..0e3fa70d27f80270a3cf77fcb0b3bc122521a3c7 100644 (file)
@@ -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" }
 
index a98c323328b57078fef2ac280fb40afef6140729..00a0f251b75f07adde7d7144632f057f08251f3c 100644 (file)
@@ -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 != ""} {
index f4d7deb848c87b874a50e5d33a240d18cde4765e..766f66bc8e4f35712484f3a95575db7ecfe04d27 100644 (file)
@@ -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"
     }
 }
 
index 304788464a7a34fdc33dc9202a657b67a82c9c3c..c43c3fe8d9933417846bddb7303654c4b7d6c474 100644 (file)
@@ -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)
 }
 
index a8e5010731f747d1a3e2eef50f77f85bf98efc15..f16345062dd0d35ac46a27c244d73bd64e690b7e 100644 (file)
@@ -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 }
index 737e25562facece40a9bae36658ccbab5dece0fa..a5a813a9978767787a9beb49337580a7a720e98c 100644 (file)
@@ -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)
 }
 
index fa9df0aa297fed8fbc474e50ad6f15cdb6a78cbd..076287348a92e13ea0d78c8366456d43ef45b2c8 100644 (file)
@@ -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
     }
 }
index fa4da54d0b0952a583f2595a0fc1cf134d4bc2ee..f34537143bba2a15b2266b5398d00952406b0c61 100644 (file)
@@ -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)
 }
index 635930f8c679623ef86c6d71834bfd5111d31ea9..307dc5e12cee64f5c8b6de0cfd4eaec7c43a5d0f 100644 (file)
@@ -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"
index 3f4961b46210020d9b40cfc6b4b22f98dc43969b..5166442490ae5d1e585e4dd470fb663e39a93fc2 100644 (file)
@@ -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)
 }
index 1994661ddccbdab363764f09e08c783447eef218..3b2eb4767add0bb82f0ee5b54ef5c7f8ba81b190 100644 (file)
@@ -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
 
index 2aa47fb75e65e9f6f6f9d96e15ca7bad37331561..3eeb0ff93d31ae388b9f405d13b6e1ffefc8f693 100644 (file)
@@ -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;
 }
 
index 52f92cc0bd815638c56480f5a920e9c080527796..b0387f43ec5886f8e73e5c39f8ae2755af3fde67 100644 (file)
@@ -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
     }
 }
index 23f1e34cfdb206076f6375cabdfba8f1b18c8f40..2e266f9ecb36e8b0cfc43290158b5d08f7237a49 100644 (file)
@@ -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] {
index 1aabf055635149d7c0c2247fa27fe12a0106bcc7..f15bce102dab814fa6bab9dd29578470e650d5d8 100644 (file)
@@ -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
index 4d89f10067b94dce960220f80347a8b19931f6f4..027c8c312427c57d8752de041114c8886bdb7b95 100644 (file)
@@ -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
index dd4ef2f525d65283878a5c2df574172dc6b7fcb0..3706db3b77920681b381490ddb9ce043fd685c8d 100644 (file)
@@ -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
index c4638907fb4c0f6bcb29bc5238c5315e1cc5f93c..f67a0ef05baf21c8fe8ed2667d1b537d08b66192 100644 (file)
@@ -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      
index 6cd485a8f73bc9715c294f70a4de492cb639dd72..ddead449abf2a7c7033f18afb4f6b54354ad435b 100644 (file)
@@ -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();
 }
 
index 948cb705105c8e7564edf69b1060c67cd9310f00..c1f9d0df39319421748e1182b7b3ade0041cea94 100644 (file)
@@ -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();
 }
 
index 70ed3413a72cb018a9b010a9ffe8ddf52e170850..30041aa44a3dff18e201880ccd639babbde9ac00 100644 (file)
@@ -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
index 92b78801545321b8d698cdadcb536a131e30c04c..b7a5a8c8730dc195d3e01fa84be8a6e74eac702d 100644 (file)
@@ -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)
 }
index 62334c5c1d541268c1cf1a149545b667ff50cf24..bb1353153a555ebf0d6acbd47adbe0bf44515b60 100644 (file)
@@ -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)
index 3d6ac4978b4401aca27c295d26f43b8c247ce8fd..cb782cc02505b8ace191871d7497cd4bba644e83 100644 (file)
@@ -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");
index c03d47933e0894e3760ca2909948ae4de585b6dc..556539f566afcd8e8d4b4849597b152c317e498a 100644 (file)
@@ -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
index a247faa1ce1456ec44e3fe9b0501fd20669d7c11..c21f4264d1693559fca18fed674425c72a7ed095 100644 (file)
@@ -1,5 +1,5 @@
 set test "memory1"
-set ::result_string {Test passed}
+set ::result_string {Test passed\r\n}
 
 if {![installtest_p]} {
     untested $test
index 313b67aec4a5f5a8082e2dafc1ecd48ccd96aaac..186baa36d65defdd284dc4685110f6c891e5e97b 100644 (file)
@@ -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
This page took 0.062158 seconds and 5 git commands to generate.