This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/3] Fix the testcases so that the result will be more exact


fix by adding 'all_pass_string':
	* testsuite/systemtap.base/be_order.exp
	* testsuite/systemtap.base/global_init.exp
	* testsuite/systemtap.base/logical_and.exp
	* testsuite/systemtap.base/tri.exp
	* testsuite/systemtap.stress/current.exp

fix by adjusting the way of printing all_pass_string:
	* testsuite/systemtap.base/global_vars.stp
	* testsuite/systemtap.base/timers.stp
---
 testsuite/systemtap.base/be_order.exp    |  4 ++--
 testsuite/systemtap.base/global_init.exp |  4 ++--
 testsuite/systemtap.base/global_vars.stp | 40 ++++++++++++++++++--------------
 testsuite/systemtap.base/logical_and.exp |  4 ++--
 testsuite/systemtap.base/timers.stp      | 24 +++++++++----------
 testsuite/systemtap.base/tri.exp         |  4 ++--
 testsuite/systemtap.stress/current.exp   |  2 +-
 7 files changed, 43 insertions(+), 39 deletions(-)

diff --git a/testsuite/systemtap.base/be_order.exp b/testsuite/systemtap.base/be_order.exp
index eeae818..9398e50 100755
--- a/testsuite/systemtap.base/be_order.exp
+++ b/testsuite/systemtap.base/be_order.exp
@@ -3,9 +3,9 @@
 set test "be_order"
 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 ${all_pass_string}${all_pass_string} \
 	    --runtime=$runtime
     } else {
-	stap_run $srcdir/$subdir/$test.stp no_load $all_pass_string
+	stap_run $srcdir/$subdir/$test.stp no_load ${all_pass_string}${all_pass_string}
     }
 }
diff --git a/testsuite/systemtap.base/global_init.exp b/testsuite/systemtap.base/global_init.exp
index 040ac44..d1dabf6 100755
--- a/testsuite/systemtap.base/global_init.exp
+++ b/testsuite/systemtap.base/global_init.exp
@@ -4,9 +4,9 @@ set test "global_init"
 
 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 ${all_pass_string}${all_pass_string} \
 	    --runtime=$runtime
     } else {
-	stap_run $srcdir/$subdir/$test.stp no_load $all_pass_string
+	stap_run $srcdir/$subdir/$test.stp no_load ${all_pass_string}${all_pass_string}
     }
 }
diff --git a/testsuite/systemtap.base/global_vars.stp b/testsuite/systemtap.base/global_vars.stp
index 737e255..952f3c5 100755
--- a/testsuite/systemtap.base/global_vars.stp
+++ b/testsuite/systemtap.base/global_vars.stp
@@ -24,34 +24,38 @@ probe begin(-9223372036854775808) {
 }
 
 probe end {
-  if (c == 42)
-    println("systemtap test success")
-  else
+  ret = 0
+  if (c != 42) {
+    ret = 1;
     printf("systemtap test failure - c:%d != 42\n", c)
+  }
 
-  if (d == (c + g))
-    println("systemtap test success")
-  else
+  if (d != (c + g)) {
+    ret = 1;
     printf("systemtap test failure - d:%d != %d\n", d, (c+g))
+  }
 
-  if (a == d)
-    println("systemtap test success")
-  else
+  if (a != d) {
+    ret = 1;
     printf("systemtap test failure - a:%d != %d\n", a, d)
+  }
 
-  if (f == c)
-    println("systemtap test success")
-  else
+  if (f != c) {
+    ret = 1;
     printf("systemtap test failure - f:%d != %d\n", f, c)
+  }
 
-  if (e[0] == "a")
-    println("systemtap test success")
-  else
+  if (e[0] != "a") {
+    ret = 1;
     printf("systemtap test failure - e:%s != a\n", e[0])
+  }
 
-  if (gstr_saved == "foobar")
-    println("systemtap test success")
-  else
+  if (gstr_saved != "foobar") {
+    ret = 1;
     printf("systemtap test failure - gstr_saved:%s != foobar\n", gstr_saved)
+  }
+
+  if (ret == 0)
+    println("systemtap test success")
 }
 
diff --git a/testsuite/systemtap.base/logical_and.exp b/testsuite/systemtap.base/logical_and.exp
index 0e52e68..e5a586f 100755
--- a/testsuite/systemtap.base/logical_and.exp
+++ b/testsuite/systemtap.base/logical_and.exp
@@ -4,9 +4,9 @@ set test "logical_and"
 
 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 ${all_pass_string}${all_pass_string}${all_pass_string}${all_pass_string} \
 	    --runtime=$runtime
     } else {
-	stap_run $srcdir/$subdir/$test.stp no_load $all_pass_string
+	stap_run $srcdir/$subdir/$test.stp no_load ${all_pass_string}${all_pass_string}${all_pass_string}${all_pass_string}
     }
 }
diff --git a/testsuite/systemtap.base/timers.stp b/testsuite/systemtap.base/timers.stp
index fb590ed..6f4ce9d 100755
--- a/testsuite/systemtap.base/timers.stp
+++ b/testsuite/systemtap.base/timers.stp
@@ -27,6 +27,7 @@ probe timer.ms(1000000) { ++msmax }
 
 probe end
 {
+	ret = 0;
 	printf("systemtap ending probe\n")
 	printf("p = %d\n", p)
 	printf("j1 = %d\n", j1)
@@ -39,36 +40,35 @@ probe end
 	/* profile counter should be non-zero, and at
 	 * least as many as the jiffies(1) counter */
 	/* (fudge comparison by ~1% since start & end aren't synchronized) */
-	if ((p > 0) && (p*100 >= j1*99)) {
-		printf("systemtap test success\n")
-	} else {
+	if ( !((p > 0) && (p*100 >= j1*99)) ) {
+		ret = 1
 		printf("unexpected profile count: %d profiles and %d jiffies\n", p, j1)
 		printf("systemtap test failure\n");
 	}
 
 	/* jiffies(1) should count more than jiffies(2),
 	 * and both should be non-zero. */
-	if ((j2 > 0) && (j2 < j1)) {
-		printf("systemtap test success\n")
-	} else {
+	if ( !((j2 > 0) && (j2 < j1)) ) {
+		ret = 1
 		printf("unexpected jiffies count\n")
 		printf("systemtap test failure\n");
 	}
 
 	/* ms(1) should count more than ms(500),
 	 * and both should be non-zero. */
-	if ((ms500 > 0) && (ms500 < ms1)) {
-		printf("systemtap test success\n")
-	} else {
+	if ( !((ms500 > 0) && (ms500 < ms1)) ) {
+		ret = 1
 		printf("unexpected ms count\n")
 		printf("systemtap test failure\n");
 	}
 
 	/* both 'infinite' intervals should register zero counts */
-	if ((jmax == 0) && (msmax == 0)) {
-		printf("systemtap test success\n")
-	} else {
+	if ( !((jmax == 0) && (msmax == 0)) ) {
+		ret = 1
 		printf("unexpected count on 'infinite' interval\n")
 		printf("systemtap test failure\n");
 	}
+
+	if ( ret == 0 )
+		printf("systemtap test success\n")
 }
diff --git a/testsuite/systemtap.base/tri.exp b/testsuite/systemtap.base/tri.exp
index c980284..34c7e09 100755
--- a/testsuite/systemtap.base/tri.exp
+++ b/testsuite/systemtap.base/tri.exp
@@ -4,9 +4,9 @@ set test "tri"
 
 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 ${all_pass_string}${all_pass_string}${all_pass_string} \
 	    --runtime=$runtime
     } else {
-	stap_run $srcdir/$subdir/$test.stp no_load $all_pass_string
+	stap_run $srcdir/$subdir/$test.stp no_load ${all_pass_string}${all_pass_string}${all_pass_string}
     }
 }
diff --git a/testsuite/systemtap.stress/current.exp b/testsuite/systemtap.stress/current.exp
index 313b67a..b7a3d78 100755
--- 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}${all_pass_string}(WARNING.*skipped.*)?"
 
 stap_run $srcdir/$subdir/$test.stp current_load $output_string -g -w
-- 
1.8.3.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]