Debian Codegraph @

testsuite/lib/stap_run_exact.exp

raw
1 # stap_run_exact.exp
2 #
3 # Simple script for testing multiple lines of exact output.
4
5 # stap_run_exact TEST_NAME filename args
6 # TEST_NAME is the name printed
7 # filename is path to the current test
8 # Additional arguments are passed to stap as-is.
9 #
10 # global result_string must be set to the expected output
11
12 proc stap_run_exact { TEST_NAME test_file_name args } {
13 if {[info procs installtest_p] != "" && ![installtest_p]} { untested $TEST_NAME; return }
14
15 set cmd [concat stap $args $test_file_name]
16 send_log "executing: $cmd\n"
17 catch {eval exec $cmd} res
18
19 set n 0
20 set expected [split $::result_string "\n"]
21 foreach line [split $res "\n"] {
22 if {![string equal $line [lindex $expected $n]]} {
23 fail "$TEST_NAME"
24 send_log "line [expr $n + 1]: expected \"[lindex $expected $n]\"\n"
25 send_log "Got \"$line\"\n"
26 return
27 }
28 incr n
29 }
30 pass "$TEST_NAME"
31 }