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 3/3] add cases for break and continue
Date: Thu, 26 Nov 2015 08:44:00 -0000	[thread overview]
Message-ID: <1448527335-14750-3-git-send-email-zhouwj-fnst@cn.fujitsu.com> (raw)
In-Reply-To: <1448527335-14750-1-git-send-email-zhouwj-fnst@cn.fujitsu.com>

	* testsuite/systemtap.base/break_and_continue.exp: New test case
	* testsuite/systemtap.base/break_and_continue.stp: New test file
---
 testsuite/systemtap.base/break_and_continue.exp | 13 +++++
 testsuite/systemtap.base/break_and_continue.stp | 78 +++++++++++++++++++++++++
 2 files changed, 91 insertions(+)
 create mode 100755 testsuite/systemtap.base/break_and_continue.exp
 create mode 100755 testsuite/systemtap.base/break_and_continue.stp

diff --git a/testsuite/systemtap.base/break_and_continue.exp b/testsuite/systemtap.base/break_and_continue.exp
new file mode 100755
index 0000000..0ddfdb9
--- /dev/null
+++ b/testsuite/systemtap.base/break_and_continue.exp
@@ -0,0 +1,13 @@
+# Check break and continue in for, foreach and while work correctly
+
+set test "break_and_continue"
+
+foreach runtime [get_runtime_list] {
+    if {$runtime != ""} {
+	stap_run $srcdir/$subdir/$test.stp no_load $all_pass_string \
+	    --runtime=$runtime -w
+    } else {
+	stap_run $srcdir/$subdir/$test.stp no_load $all_pass_string \
+	    -w
+    }
+}
diff --git a/testsuite/systemtap.base/break_and_continue.stp b/testsuite/systemtap.base/break_and_continue.stp
new file mode 100755
index 0000000..5f0afb4
--- /dev/null
+++ b/testsuite/systemtap.base/break_and_continue.stp
@@ -0,0 +1,78 @@
+/*
+ * break_and_continue.stp
+ *
+ * Check break and continue in for, foreach and while work correctly
+ */
+
+global a
+
+probe begin
+{
+	println("systemtap starting probe")
+	exit()
+}
+
+probe end
+{
+	a[1]=1
+	a[2]=2
+	a[3]=3
+	i=1
+	ret=0
+	println("systemtap ending probe")
+	for(i=1;i<3;i++)
+	{
+		break;
+		ret=1
+	}
+	if (i!=1)
+		ret=1
+
+	foreach(i in a)
+	{
+		break;
+		ret=1
+	}
+	if (i!=1)
+		ret=1
+
+	i=0
+	while(i<3)
+	{
+		i++
+		break;
+		ret=1
+	}
+	if (i!=1)
+		ret=1
+
+	for(i=1;i<3;i++)
+	{
+		continue;
+		ret=1
+	}
+	if (i!=3)
+		ret=1
+
+	foreach(i in a)
+	{
+		continue;
+		ret=1
+	}
+	if (i!=3)
+		ret=1
+
+	i=0
+	while(i<3)
+	{
+		i++
+		continue;
+		ret=1
+	}
+	if (i!=3)
+		ret=1
+
+
+	if (ret == 0)
+		println("systemtap test success")
+}
-- 
1.8.3.1



  parent reply	other threads:[~2015-11-26  8:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-26  8:43 [PATCH 1/3] add testcases for function definitions Zhou Wenjian
2015-11-26  8:44 ` [PATCH 2/3] add more test cases for timer Zhou Wenjian
2015-11-26  8:44 ` Zhou Wenjian [this message]
2015-12-01  3:21 ` [PATCH 1/3] add testcases for function definitions "Zhou, Wenjian/周文剑"
2015-12-04 13:45   ` David Smith

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=1448527335-14750-3-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).