]> sourceware.org Git - systemtap.git/commitdiff
2007-02-16 David Smith <dsmith@redhat.com>
authordsmith <dsmith>
Fri, 16 Feb 2007 16:02:45 +0000 (16:02 +0000)
committerdsmith <dsmith>
Fri, 16 Feb 2007 16:02:45 +0000 (16:02 +0000)
* systemtap.base/alternatives.exp: New test case.

testsuite/ChangeLog
testsuite/systemtap.base/alternatives.exp [new file with mode: 0644]

index 1ff99ad4300b81b50070e62d54de74bcee2d2423..183998ae525499b9dc1459ba4389bf9a572a94c1 100644 (file)
@@ -1,3 +1,7 @@
+2007-02-16  David Smith  <dsmith@redhat.com>
+
+       * systemtap.base/alternatives.exp: New test case.
+
 2007-02-09  Frank Ch. Eigler  <fche@elastic.org>
 
        * systemtap.base/prologue.*: New test case.
diff --git a/testsuite/systemtap.base/alternatives.exp b/testsuite/systemtap.base/alternatives.exp
new file mode 100644 (file)
index 0000000..31a877e
--- /dev/null
@@ -0,0 +1,46 @@
+# alternatives.exp
+#
+# 2 simple tests:
+#
+# LOCAL1: makes sure that when a probe is compiled that accesses a
+# non-existent local variable, the local variables that do exist are
+# listed as alternatives.
+#
+# STRUCT1: makes sure that when a probe is compiled that accesses a
+# non-existent structure member, the structure members that do exist
+# are listed as alternatives.
+#
+# Note that the tests don't check if the correct alternatives are
+# listed, but that some alternatives are listed.
+
+set local1_script {
+    probe kernel.function("signal_wake_up") { x = $z; }
+}
+
+set struct1_script {
+    probe kernel.function("signal_wake_up") { sig_pid = $t->pig; }
+}
+
+proc stap_run_alternatives {args} {
+    set alternatives_found 0
+    verbose -log "starting $args"
+    eval spawn $args
+    expect { 
+       -re {semantic error: .+ \(alternatives: [a-zA-Z_]}
+           { set alternatives_found 1 }
+        -re {[^\r]*\r} { verbose -log $expect_out(0,string); exp_continue } 
+        eof { }
+        timeout { exp_continue } 
+    }
+    set results [wait]
+    verbose -log "wait results: $results"
+    return $alternatives_found
+}
+
+set test "LOCAL1"
+set rc [stap_run_alternatives ./stap -vu -p2 -e $local1_script]
+if {$rc == 1} { pass $test } else { fail $test }
+
+set test "STRUCT1"
+set rc [stap_run_alternatives ./stap -vu -p2 -e $struct1_script]
+if {$rc == 1} { pass $test } else { fail $test }
This page took 0.030721 seconds and 5 git commands to generate.