| 1 |
# stap_run_binary.exp |
| 2 |
# |
| 3 |
# Simple script for testing binary output |
| 4 |
# stap_run_binary TEST_NAME |
| 5 |
# TEST_NAME is path to the current test |
| 6 |
# Additional arguments are passed to stap as-is. |
| 7 |
# |
| 8 |
# global result_string must be set to the expected output |
| 9 |
|
| 10 |
proc stap_run_binary { TEST_NAME args } { |
| 11 |
# zap the srcdir prefix |
| 12 |
set test_file_name $TEST_NAME |
| 13 |
set TEST_NAME [regsub {.*/testsuite/} $TEST_NAME ""] |
| 14 |
if {[llength $args]} { |
| 15 |
set TEST_NAME [concat $TEST_NAME $args] |
| 16 |
} |
| 17 |
|
| 18 |
if {[info procs installtest_p] != "" && ![installtest_p]} {untested $TEST_NAME; return} |
| 19 |
|
| 20 |
set hex_args {-ve {8/1 "%02x " "\n"}} |
| 21 |
set cmd [concat stap $args $test_file_name | hexdump $hex_args] |
| 22 |
send_log "executing: $cmd\n" |
| 23 |
catch { eval exec $cmd } res |
| 24 |
|
| 25 |
if {[string compare $res $::result_string] == 0} { |
| 26 |
pass "$TEST_NAME" |
| 27 |
} else { |
| 28 |
fail "$TEST_NAME" |
| 29 |
puts "EXPECTED:\n-----------------------\n<$::result_string>" |
| 30 |
puts "-----------------------\n" |
| 31 |
puts "GOT:\n-----------------------\n<$res>" |
| 32 |
puts "-----------------------\n" |
| 33 |
} |
| 34 |
} |