summaryrefslogtreecommitdiffstats
path: root/testsuite/lib/stap_run2.exp
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/lib/stap_run2.exp')
-rw-r--r--testsuite/lib/stap_run2.exp30
1 files changed, 25 insertions, 5 deletions
diff --git a/testsuite/lib/stap_run2.exp b/testsuite/lib/stap_run2.exp
index 9849aefb..b734a1e7 100644
--- a/testsuite/lib/stap_run2.exp
+++ b/testsuite/lib/stap_run2.exp
@@ -10,12 +10,27 @@
proc stap_run2 { TEST_NAME args } {
# zap the srcdir prefix
- set test_file_name $TEST_NAME
+ set TEST_FILE $TEST_NAME
set TEST_NAME [regsub {.*/testsuite/} $TEST_NAME ""]
-
+ if {[llength $args] == 0} {
+ stap_run3 $TEST_NAME $TEST_FILE
+ } else {
+ stap_run3 $TEST_NAME $TEST_FILE $args
+ }
+}
+
+# stap_run3 TEST_NAME TEST_FILE
+# TEST_NAME is the name of the test as shown in PASS/FAIL/SKIPPED messages.
+# TEST_FILE is the path to the current test
+# Additional arguments are passed to stap as-is.
+#
+# global result_string must be set to the expected output
+
+proc stap_run3 { TEST_NAME TEST_FILE args } {
if {[info procs installtest_p] != "" && ![installtest_p]} { untested $TEST_NAME; return }
-
- set cmd [concat stap $args $test_file_name]
+
+ set cmd [concat stap $args $TEST_FILE]
+ send_log "executing: $cmd\n"
catch {eval exec $cmd} res
set n 0
@@ -29,5 +44,10 @@ proc stap_run2 { TEST_NAME args } {
}
incr n
}
- pass "$TEST_NAME"
+ if {[expr $n == [llength $expected]]} {
+ pass "$TEST_NAME"
+ } else {
+ fail "$TEST_NAME"
+ send_log "too few lines of output, got $n, expected [llength $expected]\n"
+ }
}