Commit 51e0d189 by Tom Tromey Committed by Tom Tromey

G19990217_02.no-link: New file.

	* libjava.compile/G19990217_02.no-link: New file.
	* libjava.compile/test.exp: Look for `.no-link' file.
	* lib/libjava.exp (test_libjava_from_source): Added `no-link'
	option.
	(test_libjava_from_javac): Likewise.  Also, handle package
	information from class name when creating class file name.

From-SVN: r28113
parent e533f648
1999-07-14 Tom Tromey <tromey@cygnus.com>
* libjava.compile/G19990217_02.no-link: New file.
* libjava.compile/test.exp: Look for `.no-link' file.
* lib/libjava.exp (test_libjava_from_source): Added `no-link'
option.
(test_libjava_from_javac): Likewise. Also, handle package
information from class name when creating class file name.
1999-07-13 Tom Tromey <tromey@cygnus.com> 1999-07-13 Tom Tromey <tromey@cygnus.com>
* libjava.lang/test.exp: New file. * libjava.lang/test.exp: New file.
......
...@@ -233,6 +233,7 @@ proc libjava_arguments {{mode compile}} { ...@@ -233,6 +233,7 @@ proc libjava_arguments {{mode compile}} {
# #
# Run the test specified by srcfile and resultfile. compile_args and # Run the test specified by srcfile and resultfile. compile_args and
# exec_args are options telling this proc how to work. # exec_args are options telling this proc how to work.
# `no-link' don't try to link the program
# `no-exec' don't try to run the test # `no-exec' don't try to run the test
# `xfail-gcj' compilation from source will fail # `xfail-gcj' compilation from source will fail
# `xfail-javac' compilation with javac will fail # `xfail-javac' compilation with javac will fail
...@@ -264,20 +265,33 @@ proc test_libjava_from_source { options srcfile compile_args inpfile resultfile ...@@ -264,20 +265,33 @@ proc test_libjava_from_source { options srcfile compile_args inpfile resultfile
return return
} }
set args [libjava_arguments link] if {[info exists opts(no-link)]} {
# Add the --main flag set mode compile
lappend args "additional_flags=--main=[file rootname [file tail $srcfile]]" } else {
if { $compile_args != "" } { set mode link
lappend args "additional_flags=$compile_args" }
set args [libjava_arguments $mode]
if {! [info exists opts(no-link)]} {
# Add the --main flag
lappend args "additional_flags=--main=[file rootname [file tail $srcfile]]"
if { $compile_args != "" } {
lappend args "additional_flags=$compile_args"
}
} }
regsub "^.*/(\[^/.\]+)\[.\]\[^/]*$" "$srcfile" "\\1" out regsub "^.*/(\[^/.\]+)\[.\]\[^/]*$" "$srcfile" "\\1" out
set executable "${objdir}/$out" set executable "${objdir}/$out"
if {[info exists opts(no-link)]} {
append executable ".o"
set target object
} else {
set target executable
}
if { $compile_args != "" } { if { $compile_args != "" } {
set errname "$errname $compile_args" set errname "$errname $compile_args"
} }
set x [target_compile $srcfile "$executable" executable $args] set x [target_compile $srcfile "$executable" $target $args]
if {[info exists opts(xfail-gcj)]} { if {[info exists opts(xfail-gcj)]} {
setup_xfail *-*-* setup_xfail *-*-*
} }
...@@ -294,7 +308,8 @@ proc test_libjava_from_source { options srcfile compile_args inpfile resultfile ...@@ -294,7 +308,8 @@ proc test_libjava_from_source { options srcfile compile_args inpfile resultfile
} }
pass "$errname compilation from source" pass "$errname compilation from source"
if {[info exists opts(no-exec)]} { if {[info exists opts(no-exec)]
|| [info exists opts(no-link)]} {
return return
} }
...@@ -352,6 +367,7 @@ proc test_libjava_from_source { options srcfile compile_args inpfile resultfile ...@@ -352,6 +367,7 @@ proc test_libjava_from_source { options srcfile compile_args inpfile resultfile
# #
# Run the test specified by srcfile and resultfile. compile_args and # Run the test specified by srcfile and resultfile. compile_args and
# exec_args are options telling this proc how to work. # exec_args are options telling this proc how to work.
# `no-link' don't try to link the program
# `no-exec' don't try to run the test # `no-exec' don't try to run the test
# `xfail-gcj' compilation from source will fail # `xfail-gcj' compilation from source will fail
# `xfail-javac' compilation with javac will fail # `xfail-javac' compilation with javac will fail
...@@ -422,14 +438,20 @@ proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile e ...@@ -422,14 +438,20 @@ proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile e
[list $objdir/[file rootname [file tail $srcfile]].class] [list $objdir/[file rootname [file tail $srcfile]].class]
} else { } else {
# Turn "a b" into "a.class b.class". # Turn "a b" into "a.class b.class".
# Also, turn "foo.bar" into "foo/bar.class".
set class_files {} set class_files {}
foreach file [split [string trim $class_out]] { foreach file [split [string trim $class_out]] {
set file [join [split $file .] /]
lappend class_files $objdir/$file.class lappend class_files $objdir/$file.class
} }
} }
# Usually it is an error for a test program not to have a `main' # Usually it is an error for a test program not to have a `main'
# method. However, for no-exec tests it is ok. # method. However, for no-exec tests it is ok. Treat no-link
# like no-exec here.
if {[info exists opts(no-link)]} {
set opts(no-exec) x
}
set largs {} set largs {}
if {$main_name == ""} { if {$main_name == ""} {
if {! [info exists opts(no-exec)]} { if {! [info exists opts(no-exec)]} {
...@@ -437,7 +459,6 @@ proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile e ...@@ -437,7 +459,6 @@ proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile e
return return
} else { } else {
set type object set type object
set executable [file rootname [file tail $srcfile]].o
set mode compile set mode compile
} }
} else { } else {
...@@ -460,7 +481,20 @@ proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile e ...@@ -460,7 +481,20 @@ proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile e
} }
verbose "compilation command = $args" 2 verbose "compilation command = $args" 2
set x [target_compile $class_files "$executable" $type $args] # When compiling and not linking, we have to build each .o
# separately. We do this because DejaGNU's target_compile won't
# accept an empty "destfile" argument when the mode is "compile".
if {$mode == "compile"} {
foreach c_file $class_files {
set executable [file rootname [file tail $c_file]].o
set x [target_compile $c_file "$executable" $type $args]
if {$x != ""} {
break
}
}
} else {
set x [target_compile $class_files "$executable" $type $args]
}
if {[info exists opts(xfail-byte)]} { if {[info exists opts(xfail-byte)]} {
setup_xfail *-*-* setup_xfail *-*-*
} }
...@@ -535,6 +569,7 @@ proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile e ...@@ -535,6 +569,7 @@ proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile e
# #
# Run the test specified by srcfile and resultfile. compile_args and # Run the test specified by srcfile and resultfile. compile_args and
# exec_args are options telling this proc how to work. # exec_args are options telling this proc how to work.
# `no-link' don't try to link the program
# `no-exec' don't try to run the test # `no-exec' don't try to run the test
# `xfail-gcj' compilation from source will fail # `xfail-gcj' compilation from source will fail
# `xfail-javac' compilation with javac will fail # `xfail-javac' compilation with javac will fail
......
...@@ -6,6 +6,9 @@ verbose "srcfiles are $srcfiles" ...@@ -6,6 +6,9 @@ verbose "srcfiles are $srcfiles"
set prefix "" set prefix ""
foreach x $srcfiles { foreach x $srcfiles {
set args [libjava_read_xfail [file rootname $x].xfail] set args [libjava_read_xfail [file rootname $x].xfail]
if {[file exists [file rootname $x].no-link]} {
lappend args no-link
}
lappend args no-exec lappend args no-exec
test_libjava $options "$x" "" "" "" $args test_libjava $options "$x" "" "" "" $args
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment