From e04aa64ded1074765045a8c1e0e78f4155caa694 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 3 May 1999 12:48:34 +0000 Subject: [PATCH] mauve.exp (test_mauve): Pass `link' to libjava_arguments when linking. * libjava.mauve/mauve.exp (test_mauve): Pass `link' to libjava_arguments when linking. (test_mauve_sim): Likewise. * lib/libjava.exp (libjava_arguments): Run `libtool' to link. Don't use `-static'. Added `mode' argument. Use -nodefaultlibs when linking. (test_libjava_from_source): Mention why target_compile failed. Pass `link' to libjava_arguments when linking. Only do `xfails' for tests we would actually have run. (test_libjava_from_javac): Likewise. (libjava_find_lib): Return name of `.la' file. From-SVN: r26748 --- libjava/testsuite/ChangeLog | 14 +++++ libjava/testsuite/lib/libjava.exp | 69 ++++++++++++++++------- libjava/testsuite/libjava.mauve/mauve.exp | 4 +- 3 files changed, 64 insertions(+), 23 deletions(-) diff --git a/libjava/testsuite/ChangeLog b/libjava/testsuite/ChangeLog index 506c1a889bc..b359154b7ed 100644 --- a/libjava/testsuite/ChangeLog +++ b/libjava/testsuite/ChangeLog @@ -1,3 +1,17 @@ +1999-05-03 Tom Tromey + + * libjava.mauve/mauve.exp (test_mauve): Pass `link' to + libjava_arguments when linking. + (test_mauve_sim): Likewise. + * lib/libjava.exp (libjava_arguments): Run `libtool' to link. + Don't use `-static'. Added `mode' argument. Use -nodefaultlibs + when linking. + (test_libjava_from_source): Mention why target_compile failed. + Pass `link' to libjava_arguments when linking. Only do `xfails' + for tests we would actually have run. + (test_libjava_from_javac): Likewise. + (libjava_find_lib): Return name of `.la' file. + 1999-04-26 Tom Tromey * lib/libjava.exp (libjava_find_lib): New proc. diff --git a/libjava/testsuite/lib/libjava.exp b/libjava/testsuite/lib/libjava.exp index b3f34f5cbd7..3c814f0833e 100644 --- a/libjava/testsuite/lib/libjava.exp +++ b/libjava/testsuite/lib/libjava.exp @@ -87,11 +87,11 @@ proc libjava_find_lib {dir name} { foreach sub {.libs _libs} { if {$gp != ""} { if {[file exists $gp/$dir/$sub/lib${name}.a]} then { - return "-L$gp/$dir/$sub -l$name" + return "$gp/$dir/lib${name}.la" } } set lib [findfile $base_dir/../../$dir/$sub/lib${name}.a \ - "-L$base_dir/../../$dir/$sub -l$name" ""] + "$base_dir/../../$dir/lib${name}.la" ""] if {$lib != ""} { return $lib } @@ -99,8 +99,9 @@ proc libjava_find_lib {dir name} { return "" } -# Compute arguments needed for compiler. -proc libjava_arguments {} { +# Compute arguments needed for compiler. MODE is a libtool mode: +# either compile or link. +proc libjava_arguments {{mode compile}} { global base_dir global LIBJAVA global LIBGC @@ -167,7 +168,6 @@ proc libjava_arguments {} { global wrapper_file wrap_compile_flags; lappend args "additional_flags=$wrap_compile_flags"; - lappend args "additional_flags=-static" lappend args "libs=$wrapper_file"; lappend args "libs=$libjava"; lappend args "libs=$libgc"; @@ -182,7 +182,21 @@ proc libjava_arguments {} { if [info exists TOOL_OPTIONS] { lappend args "additional_flags=$TOOL_OPTIONS" } - lappend args "compiler=$GCJ_UNDER_TEST" + + # Search for libtool. We need it to link. + set d [absolute $objdir] + foreach x {. .. ../.. ../../..} { + if {[file exists $d/$x/libtool]} then { + # We have to run silently to avoid DejaGNU lossage. + lappend args \ + "compiler=$d/$x/libtool --silent --mode=$mode $GCJ_UNDER_TEST" + break + } + } + + if {$mode == "link"} { + lappend args "additional_flags=-nodefaultlibs -lm -lgcc -lc -lgcc" + } return $args } @@ -208,7 +222,7 @@ proc test_libjava_from_source { options srcfile compile_args inpfile resultfile return } - set args [libjava_arguments] + set args [libjava_arguments link] # Add the --main flag lappend args "additional_flags=--main=[file rootname [file tail $srcfile]]" if { $compile_args != "" } { @@ -221,12 +235,16 @@ proc test_libjava_from_source { options srcfile compile_args inpfile resultfile set errname "$errname $compile_args" } - if { [target_compile $srcfile "$executable" executable $args] != "" } { + set x [target_compile $srcfile "$executable" executable $args] + if { $x != "" } { + verbose "target_compile failed: $x" 2 fail "$errname compilation from source" - setup_xfail "*-*-*" - fail "$errname execution from source compiled test" - setup_xfail "*-*-*" - fail "$errname output from source compiled test" + if {$exec_args != "no-exec"} { + setup_xfail "*-*-*" + fail "$errname execution from source compiled test" + setup_xfail "*-*-*" + fail "$errname output from source compiled test" + } return; } pass "$errname compilation from source" @@ -306,10 +324,12 @@ proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile e fail "$errname byte compilation" setup_xfail "*-*-*" fail "$errname compilation from bytecode" - setup_xfail "*-*-*" - fail "$errname execution from bytecode->native test" - setup_xfail "*-*-*" - fail "$errname output from bytecode->native test" + if {$exec_args != "no-exec"} { + setup_xfail "*-*-*" + fail "$errname execution from bytecode->native test" + setup_xfail "*-*-*" + fail "$errname output from bytecode->native test" + } return } pass "$errname byte compilation" @@ -335,11 +355,9 @@ proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile e set class_files [join [split [string trim $class_out]] ".class "].class } - # Initial arguments. - set args [libjava_arguments] - # Usually it is an error for a test program not to have a `main' # method. However, for no-exec tests it is ok. + set largs {} if {$main_name == ""} { if {$exec_args != "no-exec"} { perror "No `main' given in program $errname" @@ -347,13 +365,19 @@ proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile e } else { set type object set executable [file rootname [file tail $srcfile]].o + set mode compile } } else { set type executable - lappend args "additional_flags=--main=$main_name" + lappend largs "additional_flags=--main=$main_name" set executable "${objdir}/$main_name" + set mode link } + # Initial arguments. + set args [libjava_arguments $mode] + eval lappend args $largs + if { $compile_args != "" } { lappend args "additional_flags=$compile_args" } @@ -362,7 +386,10 @@ proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile e set errname "$errname $compile_args" } - if { [target_compile $class_files "$executable" $type $args] != "" } { + verbose "compilation command = $args" 2 + set x [target_compile $class_files "$executable" $type $args] + if { $x != "" } { + verbose "target_compile failed: $x" 2 fail "$errname compilation from bytecode" setup_xfail "*-*-*" if {$exec_args != "no-exec"} { diff --git a/libjava/testsuite/libjava.mauve/mauve.exp b/libjava/testsuite/libjava.mauve/mauve.exp index 08f08cf19a7..7b3cc9d17c3 100644 --- a/libjava/testsuite/libjava.mauve/mauve.exp +++ b/libjava/testsuite/libjava.mauve/mauve.exp @@ -99,7 +99,7 @@ proc test_mauve {} { # Compute flags to use to do the build. set compile_args [libjava_arguments] - set link_args [concat $compile_args \ + set link_args [concat [libjava_arguments link] \ [list "additional_flags=--main=DejaGNUTestHarness"]] set ok 1 @@ -229,7 +229,7 @@ proc test_mauve_sim {} { # Compute flags to use to do the build. set compile_args [libjava_arguments] - set link_args [concat $compile_args \ + set link_args [concat [libjava_arguments link] \ [list "additional_flags=--main=DejaGNUTestHarness"]] set ok 1