diff options
Diffstat (limited to 'libjava/testsuite/lib/libjava.exp')
-rw-r--r-- | libjava/testsuite/lib/libjava.exp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/libjava/testsuite/lib/libjava.exp b/libjava/testsuite/lib/libjava.exp index 6be5ec6..972b7be 100644 --- a/libjava/testsuite/lib/libjava.exp +++ b/libjava/testsuite/lib/libjava.exp @@ -457,6 +457,50 @@ proc gcj_link {program main files {options {}}} { return 1 } +# Invoke the program and see what happens. Return 0 on failure. +proc gcj_invoke {program expectFile ld_library_additions} { + global env + set lib_path $env(LD_LIBRARY_PATH) + + set newval . + if {[llength $ld_library_additions] > 0} { + append newval :[join $ld_library_additions :] + } + append newval :$lib_path + + setenv LD_LIBRARY_PATH $newval + setenv SHLIB_PATH $newval + + verbose "LD_LIBRARY_PATH=$env(LD_LIBRARY_PATH)" + + set result [libjava_load ./$program] + set status [lindex $result 0] + set output [lindex $result 1] + + # Restore setting + setenv LD_LIBRARY_PATH $lib_path + setenv SHLIB_PATH $lib_path + + if {$status != "pass"} { + verbose "got $output" + fail "$program run" + untested "$program output" + return 0 + } + + set id [open $expectFile r] + set expected [read $id] + close $id + + if {! [string compare $output $expected]} { + pass "$program output" + return 1 + } else { + fail "$program output" + return 0 + } +} + # Invoke a program and check its output. EXECUTABLE is the program; # ARGS are the arguments to the program. Returns 1 if tests passed # (or things were left untested), 0 otherwise. |