Commit fdf448f7 by Tom Tromey Committed by Tom Tromey

re PR libgcj/2874 (libjava testsuite disk space usage)

	Fix for PR libgcj/2874:
	* libjava.mauve/mauve.exp (gcj_run_mauve_tests): New proc.
	(test_mauve): Return 0 on failure.
	* lib/libjava.exp (test_libjava_from_source): Remove generated
	files if test is successful.
	(test_libjava_from_javac): Likewise.
	(gcj_cleanup): New proc.

From-SVN: r43050
parent e68e3108
2001-06-08 Tom Tromey <tromey@redhat.com>
Fix for PR libgcj/2874:
* libjava.mauve/mauve.exp (gcj_run_mauve_tests): New proc.
(test_mauve): Return 0 on failure.
* lib/libjava.exp (test_libjava_from_source): Remove generated
files if test is successful.
(test_libjava_from_javac): Likewise.
(gcj_cleanup): New proc.
2001-06-05 Jeff Sturm <jsturm@one-point.com> 2001-06-05 Jeff Sturm <jsturm@one-point.com>
* lib/libjava.exp (libjava_arguments): Build with `-no-install' * lib/libjava.exp (libjava_arguments): Build with `-no-install'
......
...@@ -188,6 +188,21 @@ proc libjava_find_lib {dir name} { ...@@ -188,6 +188,21 @@ proc libjava_find_lib {dir name} {
return "" return ""
} }
# Remove a bunch of files.
proc gcj_cleanup {args} {
foreach file $args {
if {[string match *.o $file]} {
verbose "removing [file rootname $file].lo"
file delete -force [file rootname $file].lo
}
file delete -force -- $file
verbose "removing $file"
}
# It is simplest to do this instead of trying to figure out what
# bits in .libs ought to be removed.
catch {system "rm -rf .libs"}
}
# Compute arguments needed for compiler. MODE is a libtool mode: # Compute arguments needed for compiler. MODE is a libtool mode:
# either compile or link. # either compile or link.
proc libjava_arguments {{mode compile}} { proc libjava_arguments {{mode compile}} {
...@@ -383,6 +398,8 @@ proc test_libjava_from_source { options srcfile compile_args inpfile resultfile ...@@ -383,6 +398,8 @@ proc test_libjava_from_source { options srcfile compile_args inpfile resultfile
set errname "$errname $compile_args" set errname "$errname $compile_args"
} }
set removeList [list $executable]
set x [prune_warnings \ set x [prune_warnings \
[libjava_tcompile $srcfile "$executable" $target $args]] [libjava_tcompile $srcfile "$executable" $target $args]]
if {[info exists opts(xfail-gcj)]} { if {[info exists opts(xfail-gcj)]} {
...@@ -393,6 +410,7 @@ proc test_libjava_from_source { options srcfile compile_args inpfile resultfile ...@@ -393,6 +410,7 @@ proc test_libjava_from_source { options srcfile compile_args inpfile resultfile
if {[info exists opts(shouldfail)]} { if {[info exists opts(shouldfail)]} {
pass "$errname compilation from source" pass "$errname compilation from source"
eval gcj_cleanup $removeList
return return
} }
...@@ -419,9 +437,11 @@ proc test_libjava_from_source { options srcfile compile_args inpfile resultfile ...@@ -419,9 +437,11 @@ proc test_libjava_from_source { options srcfile compile_args inpfile resultfile
untested "$errname execution from source compiled test" untested "$errname execution from source compiled test"
untested "$errname output from source compiled test" untested "$errname output from source compiled test"
} }
eval gcj_cleanup $removeList
return return
} }
if {[info exists opts(no-link)]} { if {[info exists opts(no-link)]} {
eval gcj_cleanup $removeList
return return
} }
...@@ -467,6 +487,7 @@ proc test_libjava_from_source { options srcfile compile_args inpfile resultfile ...@@ -467,6 +487,7 @@ proc test_libjava_from_source { options srcfile compile_args inpfile resultfile
} }
if { $passed == 1 } { if { $passed == 1 } {
pass "$errname output from source compiled test" pass "$errname output from source compiled test"
eval gcj_cleanup $removeList
} else { } else {
clone_output "expected was $expected" clone_output "expected was $expected"
clone_output "output was $output" clone_output "output was $output"
...@@ -542,6 +563,8 @@ proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile e ...@@ -542,6 +563,8 @@ proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile e
} }
pass "$errname byte compilation" pass "$errname byte compilation"
set removeList {}
# Find name to use for --main, and name of all class files. # Find name to use for --main, and name of all class files.
set jvscan [find_jvscan] set jvscan [find_jvscan]
verbose "jvscan is $jvscan" verbose "jvscan is $jvscan"
...@@ -573,6 +596,8 @@ proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile e ...@@ -573,6 +596,8 @@ proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile e
lappend class_files $objdir/$file.class lappend class_files $objdir/$file.class
} }
eval lappend removeList $class_files
# 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. Treat no-link # method. However, for no-exec tests it is ok. Treat no-link
# like no-exec here. # like no-exec here.
...@@ -615,18 +640,20 @@ proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile e ...@@ -615,18 +640,20 @@ proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile e
set executable [file rootname [file tail $c_file]].o set executable [file rootname [file tail $c_file]].o
set x [prune_warnings \ set x [prune_warnings \
[libjava_tcompile $c_file "$executable" $type $args]] [libjava_tcompile $c_file "$executable" $type $args]]
lappend removeList $executable
if {$x != ""} { if {$x != ""} {
break break
} }
} }
} else { } else {
# This is no evil: we de-listify CLASS_FILES so that we can # This is so evil: we de-listify CLASS_FILES so that we can
# turn around and quote the `$' in it for the shell. I really # turn around and quote the `$' in it for the shell. I really
# hate DejaGNU. It is so !@#$!@# unpredictable. # hate DejaGNU. It is so !@#$!@# unpredictable.
set hack "" set hack ""
foreach stupid $class_files { foreach stupid $class_files {
set hack "$hack $stupid" set hack "$hack $stupid"
} }
lappend removeList $executable
set x [prune_warnings \ set x [prune_warnings \
[libjava_tcompile $hack "$executable" $type $args]] [libjava_tcompile $hack "$executable" $type $args]]
} }
...@@ -650,6 +677,7 @@ proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile e ...@@ -650,6 +677,7 @@ proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile e
untested "$errname execution from bytecode->native test" untested "$errname execution from bytecode->native test"
untested "$errname output from bytecode->native test" untested "$errname output from bytecode->native test"
} }
eval gcj_cleanup $removeList
return return
} }
...@@ -662,7 +690,7 @@ proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile e ...@@ -662,7 +690,7 @@ proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile e
$status "$errname execution from bytecode->native test" $status "$errname execution from bytecode->native test"
if { $status != "pass" } { if { $status != "pass" } {
untested "$errname output from bytecode->native test" untested "$errname output from bytecode->native test"
return; return
} }
verbose "resultfile is $resultfile" verbose "resultfile is $resultfile"
...@@ -695,6 +723,7 @@ proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile e ...@@ -695,6 +723,7 @@ proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile e
} }
if { $passed == 1 } { if { $passed == 1 } {
pass "$errname output from bytecode->native test" pass "$errname output from bytecode->native test"
eval gcj_cleanup $removeList
} else { } else {
clone_output "expected was $expected" clone_output "expected was $expected"
clone_output "output was $output" clone_output "output was $output"
......
...@@ -52,13 +52,14 @@ proc mauve_compute_uses {aName} { ...@@ -52,13 +52,14 @@ proc mauve_compute_uses {aName} {
return [lsort [array names uses]] return [lsort [array names uses]]
} }
# Run all the Mauve tests. # Run all the Mauve tests. Return 1 on success, 0 on any failure. If
# the tests are skipped, that is treated like success.
proc test_mauve {} { proc test_mauve {} {
global srcdir objdir subdir env global srcdir objdir subdir env
if {! [info exists env(MAUVEDIR)]} then { if {! [info exists env(MAUVEDIR)]} then {
verbose "MAUVEDIR not set; not running Mauve tests" verbose "MAUVEDIR not set; not running Mauve tests"
return return 1
} }
# Run in subdir so we don't overwrite our own Makefile. # Run in subdir so we don't overwrite our own Makefile.
...@@ -95,7 +96,7 @@ proc test_mauve {} { ...@@ -95,7 +96,7 @@ proc test_mauve {} {
} msg]} then { } msg]} then {
fail "Mauve configure" fail "Mauve configure"
verbose "configure failed with $msg" verbose "configure failed with $msg"
return return 0
} }
pass "Mauve configure" pass "Mauve configure"
...@@ -114,14 +115,14 @@ proc test_mauve {} { ...@@ -114,14 +115,14 @@ proc test_mauve {} {
} msg]} then { } msg]} then {
fail "Mauve build" fail "Mauve build"
verbose "build failed with $msg" verbose "build failed with $msg"
return return 0
} }
pass "Mauve build" pass "Mauve build"
set srcfile $full_srcdir/$subdir/DejaGNUTestHarness.java set srcfile $full_srcdir/$subdir/DejaGNUTestHarness.java
if {! [bytecompile_file $srcfile [pwd] $env(MAUVEDIR):[pwd]]} then { if {! [bytecompile_file $srcfile [pwd] $env(MAUVEDIR):[pwd]]} then {
fail "Compile DejaGNUTestHarness.java" fail "Compile DejaGNUTestHarness.java"
return return 0
} }
pass "Compile DejaGNUTestHarness.java" pass "Compile DejaGNUTestHarness.java"
...@@ -149,9 +150,10 @@ proc test_mauve {} { ...@@ -149,9 +150,10 @@ proc test_mauve {} {
lappend objlist $obj lappend objlist $obj
} }
if {! $ok} then { if {! $ok} then {
return return 0
} }
set proc_ok 1
set Executable DejaGNUTestHarness set Executable DejaGNUTestHarness
foreach file $choices { foreach file $choices {
# Turn `java/lang/Foo.java' into `java.lang.Foo'. # Turn `java/lang/Foo.java' into `java.lang.Foo'.
...@@ -174,12 +176,14 @@ proc test_mauve {} { ...@@ -174,12 +176,14 @@ proc test_mauve {} {
} }
} }
if {! $ok} then { if {! $ok} then {
set proc_ok 0
continue continue
} }
set x [prune_warnings [target_compile [concat $uses($file) $objlist] \ set x [prune_warnings [target_compile [concat $uses($file) $objlist] \
$Executable executable $link_args]] $Executable executable $link_args]]
if {$x != ""} then { if {$x != ""} then {
set proc_ok 0
fail "Link for $class" fail "Link for $class"
continue continue
} }
...@@ -197,23 +201,28 @@ proc test_mauve {} { ...@@ -197,23 +201,28 @@ proc test_mauve {} {
if {$what == "PASS" || $what == "XPASS"} then { if {$what == "PASS" || $what == "XPASS"} then {
pass $msg pass $msg
} else { } else {
set proc_ok 0
fail $msg fail $msg
} }
} }
} }
} }
return $proc_ok
} }
# Run all the Mauve tests in a sim environment. In this case, the # Run all the Mauve tests in a sim environment. In this case, the
# program cannot use argv[] because there's no way to pass in the # program cannot use argv[] because there's no way to pass in the
# command line, so tha name of the class to test is substituted by # command line, so tha name of the class to test is substituted by
# patching the source of the DejaGNUTestHarness. # patching the source of the DejaGNUTestHarness. Return 1 on success,
# 0 on any failure. If the tests are skipped, that is treated like
# success.
proc test_mauve_sim {} { proc test_mauve_sim {} {
global srcdir subdir env global srcdir subdir env
if {! [info exists env(MAUVEDIR)]} then { if {! [info exists env(MAUVEDIR)]} then {
verbose "MAUVEDIR not set; not running Mauve tests" verbose "MAUVEDIR not set; not running Mauve tests"
return return 1
} }
# Run in subdir so we don't overwrite our own Makefile. # Run in subdir so we don't overwrite our own Makefile.
...@@ -230,7 +239,7 @@ proc test_mauve_sim {} { ...@@ -230,7 +239,7 @@ proc test_mauve_sim {} {
} msg]} then { } msg]} then {
fail "Mauve configure" fail "Mauve configure"
verbose "configure failed with $msg" verbose "configure failed with $msg"
return return 0
} }
pass "Mauve configure" pass "Mauve configure"
...@@ -249,7 +258,7 @@ proc test_mauve_sim {} { ...@@ -249,7 +258,7 @@ proc test_mauve_sim {} {
} msg]} then { } msg]} then {
fail "Mauve build" fail "Mauve build"
verbose "build failed with $msg" verbose "build failed with $msg"
return return 0
} }
pass "Mauve build" pass "Mauve build"
...@@ -279,11 +288,12 @@ proc test_mauve_sim {} { ...@@ -279,11 +288,12 @@ proc test_mauve_sim {} {
lappend objlist $obj lappend objlist $obj
} }
if {! $ok} then { if {! $ok} then {
return return 0
} }
lappend objlist gnu/testlet/DejaGNUTestHarness.o lappend objlist gnu/testlet/DejaGNUTestHarness.o
set proc_ok 1
set Executable DejaGNUTestHarness set Executable DejaGNUTestHarness
foreach file $choices { foreach file $choices {
# Turn `java/lang/Foo.java' into `java.lang.Foo'. # Turn `java/lang/Foo.java' into `java.lang.Foo'.
...@@ -307,6 +317,7 @@ proc test_mauve_sim {} { ...@@ -307,6 +317,7 @@ proc test_mauve_sim {} {
} }
} }
if {! $ok} then { if {! $ok} then {
set proc_ok 0
continue continue
} }
...@@ -328,7 +339,7 @@ proc test_mauve_sim {} { ...@@ -328,7 +339,7 @@ proc test_mauve_sim {} {
if {! [bytecompile_file [pwd]/gnu/testlet/$srcfile [pwd]/gnu/testlet \ if {! [bytecompile_file [pwd]/gnu/testlet/$srcfile [pwd]/gnu/testlet \
$env(MAUVEDIR):[pwd]]} then { $env(MAUVEDIR):[pwd]]} then {
fail "Compile DejaGNUTestHarness.java" fail "Compile DejaGNUTestHarness.java"
return return 0
} }
set x [prune_warnings \ set x [prune_warnings \
...@@ -336,12 +347,14 @@ proc test_mauve_sim {} { ...@@ -336,12 +347,14 @@ proc test_mauve_sim {} {
gnu/testlet/DejaGNUTestHarness.o object $compile_args]] gnu/testlet/DejaGNUTestHarness.o object $compile_args]]
if {$x != ""} then { if {$x != ""} then {
fail "Compile DejaGNUTestHarness.java" fail "Compile DejaGNUTestHarness.java"
set proc_ok 0
continue continue
} }
set x [prune_warnings [target_compile [concat $uses($file) $objlist] \ set x [prune_warnings [target_compile [concat $uses($file) $objlist] \
$Executable executable $link_args]] $Executable executable $link_args]]
if {$x != ""} then { if {$x != ""} then {
set proc_ok 0
fail "Link for $class" fail "Link for $class"
continue continue
} }
...@@ -359,19 +372,33 @@ proc test_mauve_sim {} { ...@@ -359,19 +372,33 @@ proc test_mauve_sim {} {
if {$what == "PASS" || $what == "XPASS"} then { if {$what == "PASS" || $what == "XPASS"} then {
pass $msg pass $msg
} else { } else {
set proc_ok 0
fail $msg fail $msg
} }
} }
} }
} }
return $proc_ok
} }
# The test_mauve* procs will change the current directory. It's proc gcj_run_mauve_tests {} {
# simpler to fix this up here than to keep track of this in the procs. # The test_mauve* procs will change the current directory. It's
set here [pwd] # simpler to fix this up here than to keep track of this in the
if { [board_info target exists is_simulator] } { # procs.
test_mauve_sim set here [pwd]
} else { if { [board_info target exists is_simulator] } {
test_mauve set r [test_mauve_sim]
} else {
set r [test_mauve]
}
cd $here
if {$r} {
# No need to keep the build around. FIXME: this knows how the
# tests work. This whole file could use a rewrite.
system "rm -rf mauve-build"
}
} }
cd $here
gcj_run_mauve_tests
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