public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Zhou Wenjian <zhouwj-fnst@cn.fujitsu.com>
To: <systemtap@sourceware.org>
Subject: [PATCH 2/3] Fix the testcases so that the result will be more exact
Date: Mon, 09 Nov 2015 08:58:00 -0000	[thread overview]
Message-ID: <1447059456-19811-2-git-send-email-zhouwj-fnst@cn.fujitsu.com> (raw)
In-Reply-To: <1447059456-19811-1-git-send-email-zhouwj-fnst@cn.fujitsu.com>

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

  reply	other threads:[~2015-11-09  8:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-09  8:58 [PATCH 1/3] add testcases for function definitions Zhou Wenjian
2015-11-09  8:58 ` Zhou Wenjian [this message]
2015-11-09  8:58 ` [PATCH 3/3] add more test cases for timer Zhou Wenjian
2015-11-09 18:07 ` [PATCH 1/3] add testcases for function definitions Josh Stone
2015-11-09 21:24   ` David Smith
2015-11-09 22:21     ` Josh Stone
2015-11-10  2:11   ` "Zhou, Wenjian/周文剑"
2015-11-10  2:31     ` Josh Stone
2015-11-10  2:51       ` "Zhou, Wenjian/周文剑"
2015-11-10  7:07         ` "Zhou, Wenjian/周文剑"
2015-11-10 17:34           ` Josh Stone
2015-11-11  6:23             ` "Zhou, Wenjian/周文剑"
2015-11-11 14:03               ` Frank Ch. Eigler
2015-11-11 19:07                 ` David Smith
2015-11-12  2:57                   ` "Zhou, Wenjian/周文剑"

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1447059456-19811-2-git-send-email-zhouwj-fnst@cn.fujitsu.com \
    --to=zhouwj-fnst@cn.fujitsu.com \
    --cc=systemtap@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).