summaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/ChangeLog6
-rw-r--r--testsuite/systemtap.base/be_order.stp2
-rw-r--r--testsuite/systemtap.base/global_init.exp7
-rw-r--r--testsuite/systemtap.base/global_init.stp31
4 files changed, 45 insertions, 1 deletions
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog
index 83a48057..da7929f6 100644
--- a/testsuite/ChangeLog
+++ b/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2006-12-08 Josh Stone <joshua.i.stone@intel.com>
+
+ PR 3681.
+ * systemtap.base/global_init.exp, systemtap.base/global_init.stp: New
+ test for checking the timeliness of global initialization.
+
2006-12-07 Josh Stone <joshua.i.stone@intel.com>
PR 3624.
diff --git a/testsuite/systemtap.base/be_order.stp b/testsuite/systemtap.base/be_order.stp
index eb8ef0c8..166d0dca 100644
--- a/testsuite/systemtap.base/be_order.stp
+++ b/testsuite/systemtap.base/be_order.stp
@@ -1,5 +1,5 @@
/*
- * add.stp
+ * be_order.stp
*
* Check that ordering of begin/end probes works
*/
diff --git a/testsuite/systemtap.base/global_init.exp b/testsuite/systemtap.base/global_init.exp
new file mode 100644
index 00000000..2076f20f
--- /dev/null
+++ b/testsuite/systemtap.base/global_init.exp
@@ -0,0 +1,7 @@
+# Check that global variables are initialized before all begin probes
+
+load_lib "stap_run.exp"
+
+set test "global_init"
+
+stap_run $srcdir/$subdir/$test.stp no_load $all_pass_string
diff --git a/testsuite/systemtap.base/global_init.stp b/testsuite/systemtap.base/global_init.stp
new file mode 100644
index 00000000..a5d7e58e
--- /dev/null
+++ b/testsuite/systemtap.base/global_init.stp
@@ -0,0 +1,31 @@
+/*
+ * global_init.stp
+ *
+ * Check that global variables are initialized before all begin probes
+ */
+
+probe begin { log("systemtap starting probe") }
+probe end { log("systemtap ending probe") }
+
+global gnum = 42
+global gstr = "foobar"
+
+global gnum_saved
+global gstr_saved
+probe begin(-9223372036854775808) {
+ gnum_saved = gnum
+ gstr_saved = gstr
+}
+
+probe end {
+ if (gnum_saved == 42)
+ log("systemtap test success")
+ else
+ printf("systemtap test failure - gnum_saved:%d != 42\n", gnum_saved)
+
+ if (gstr_saved == "foobar")
+ log("systemtap test success")
+ else
+ printf("systemtap test failure - gstr_saved:%s != foobar\n", gstr_saved)
+}
+