summaryrefslogtreecommitdiffstats
path: root/testsuite/lib/stap_compile.exp
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@HansenPartnership.com>2008-07-08 12:38:58 -0500
committerFrank Ch. Eigler <fche@elastic.org>2008-07-09 07:09:20 -0400
commita3ee6543b34b773568961e3d48f6ea30e65bc59c (patch)
tree51b90552e9b7cc9438d3108a13442d24fe1fd240 /testsuite/lib/stap_compile.exp
parent0b8f65798e0b454ccaab1d93925c3e034d4f5624 (diff)
downloadsystemtap-steved-a3ee6543b34b773568961e3d48f6ea30e65bc59c.tar.gz
systemtap-steved-a3ee6543b34b773568961e3d48f6ea30e65bc59c.tar.xz
systemtap-steved-a3ee6543b34b773568961e3d48f6ea30e65bc59c.zip
Add test suite for declaration resolution
This adds the test declaration.exp which checks that specific named declarations inside the kernel both fail and succeed. We get the failure by only using a single compile unit which is currently known to have the structure stubbed. We get exactly the same declaration to succeed by adding a CU that is known to have the declaration. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'testsuite/lib/stap_compile.exp')
-rw-r--r--testsuite/lib/stap_compile.exp39
1 files changed, 39 insertions, 0 deletions
diff --git a/testsuite/lib/stap_compile.exp b/testsuite/lib/stap_compile.exp
new file mode 100644
index 00000000..8c6df0ee
--- /dev/null
+++ b/testsuite/lib/stap_compile.exp
@@ -0,0 +1,39 @@
+# stap_compile TEST_NAME flags script args
+# - TEST_NAME is the name of the current test
+# - compile indicates whether the script is supposed to compile
+# - script is the script to compile
+# Additional arguments are passed to stap as-is.
+proc stap_compile { TEST_NAME compile script args } {
+ set cmd [concat {stap -v -p4 -e} $script $args]
+
+ verbose -log "running $cmd"
+ eval spawn $cmd
+ set compile_errors 0
+ expect {
+ -re {^Pass\ [1234]:[^\r]*\ in\ .*\ ms.\r\n} {exp_continue}
+ -re {^Pass\ [34]: using cached [^\r\n]+\r\n} {exp_continue}
+ # pass-4 output
+ -re {^/[^\r\n]+.ko\r\n} {exp_continue}
+ -re "parse error" { incr compile_errors 1; exp_continue}
+ -re "compilation failed" {incr compile_errors 1; exp_continue}
+ -re "semantic error:" {incr compile_errors 1; exp_continue}
+ }
+ catch close
+ wait
+
+ # If we've got compile errors and the script was supposed to
+ # compile, fail.
+ if {$compile_errors > 0} {
+ if {$compile == 1} {
+ fail "$TEST_NAME compilation failed"
+ } else {
+ pass "$TEST_NAME compilation failed correctly"
+ }
+ } else {
+ if {$compile == 1} {
+ pass "$TEST_NAME compilation succeeded"
+ } else {
+ fail "$TEST_NAME compilation succeeded unexpectedly"
+ }
+ }
+}