-# Copyright (C) 1998, 1999, 2000 Free Software Foundation.
+# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation.
# Written by Tom Tromey <tromey@cygnus.com>.
# Incorporate Mauve into libjava's DejaGNU test suite framework.
foreach file $ufiles {
set file [file rootname $file].o
lappend uses($item) $file
+ # Now add all inner classes
+ foreach inner [glob -nocomplain [file rootname $file]$*.class] {
+ # Prevent excessive escaping by replacing $ with a ^ in the .o name
+ set inner [file rootname $inner].o
+ regsub -all "\\$" $inner "\^" inner
+ lappend uses($item) $inner
+ }
}
}
return [lsort [array names uses]]
}
-# Run all the Mauve tests.
+# Find Mauve sources. At end, env(MAUVEDIR) points to sources.
+# Returns 0 if sources not found, 1 otherwise.
+proc find_mauve_sources {} {
+ global env srcdir
+
+ if {[info exists env(MAUVEDIR)]} {
+ return 1
+ } elseif {[file isdirectory $srcdir/libjava.mauve/mauve]} {
+ set env(MAUVEDIR) $srcdir/libjava.mauve/mauve
+ return 1
+ }
+
+ return 0
+}
+
+# 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 {} {
global srcdir objdir subdir env
- if {! [info exists env(MAUVEDIR)]} then {
+ if {! [find_mauve_sources]} then {
verbose "MAUVEDIR not set; not running Mauve tests"
- return
+ return 1
}
# Run in subdir so we don't overwrite our own Makefile.
set full_srcdir [pwd]
cd $here/mauve-build
- global env
- global GCJ_UNDER_TEST
- global TOOL_EXECUTABLE
+ global env libgcj_jar
+ global GCJ_UNDER_TEST
+ global TOOL_EXECUTABLE
- if ![info exists GCJ_UNDER_TEST] {
- if [info exists TOOL_EXECUTABLE] {
- set GCJ_UNDER_TEST $TOOL_EXECUTABLE;
- } else {
- if [info exists env(GCJ)] {
- set GCJ_UNDER_TEST env(GCJ)
- } else {
- set GCJ_UNDER_TEST "[find_gcj]"
- }
- }
+ if ![info exists GCJ_UNDER_TEST] {
+ if [info exists TOOL_EXECUTABLE] {
+ set GCJ_UNDER_TEST $TOOL_EXECUTABLE;
+ } else {
+ if [info exists env(GCJ)] {
+ set GCJ_UNDER_TEST env(GCJ)
+ } else {
+ set GCJ_UNDER_TEST "[find_gcj]"
+ }
}
+ }
- # Append -B and -I so that libgcj.spec and libgcj.zip are found
- # before they're installed.
- set env(GCJ) "$GCJ_UNDER_TEST -B$objdir/../ -I$objdir/../libgcj.zip"
+ # Append -B and -I so that libgcj.spec and libgcj.jar are found
+ # before they're installed.
+ # Append -Wno-deprecated since Mauve tests lots of deprecated stuff.
+ set env(GCJ) "$GCJ_UNDER_TEST -Wno-deprecated -B$objdir/../ -I$libgcj_jar"
if {[catch {
- system "$env(MAUVEDIR)/configure --with-gcj 2>@ stdout"
+ system "$env(MAUVEDIR)/configure --with-gcj 2>&1"
} msg]} then {
fail "Mauve configure"
verbose "configure failed with $msg"
- return
+ return 0
}
pass "Mauve configure"
puts -nonewline $fd $c
close $fd
+ catch {system "ln -s $full_srcdir/libjava.mauve/xfails xfails"}
+
if {[catch {
system "make KEYS=libgcj classes.stamp 2>&1"
} msg]} then {
fail "Mauve build"
verbose "build failed with $msg"
- return
+ return 0
}
pass "Mauve build"
set srcfile $full_srcdir/$subdir/DejaGNUTestHarness.java
if {! [bytecompile_file $srcfile [pwd] $env(MAUVEDIR):[pwd]]} then {
fail "Compile DejaGNUTestHarness.java"
- return
+ return 0
}
pass "Compile DejaGNUTestHarness.java"
foreach base {DejaGNUTestHarness gnu/testlet/SimpleTestHarness gnu/testlet/TestHarness gnu/testlet/Testlet gnu/testlet/ResourceNotFoundException gnu/testlet/config} {
set file $base.class
set obj $base.o
- set x [prune_warnings \
+ set x [libjava_prune_warnings \
[target_compile [pwd]/$file $obj object $compile_args]]
if {$x != ""} then {
fail "Compile $obj"
lappend objlist $obj
}
if {! $ok} then {
- return
+ return 0
}
+ set proc_ok 1
set Executable DejaGNUTestHarness
foreach file $choices {
# Turn `java/lang/Foo.java' into `java.lang.Foo'.
foreach obj $uses($file) {
if {! [file exists $obj]} then {
verbose "compiling $obj for test of $class"
+ # The .class file does contain a $, but we can quote it between "'"s.
set srcfile [file rootname $obj].class
- set x [prune_warnings \
- [target_compile [pwd]/$srcfile $obj object $compile_args]]
+ regsub -all "\\^" $srcfile "\$" srcfile
+ set x [libjava_prune_warnings \
+ [libjava_tcompile '[pwd]/$srcfile' $obj object $compile_args]]
if {$x != ""} then {
fail "Compile $obj for $class"
set ok 0
}
}
if {! $ok} then {
+ set proc_ok 0
continue
}
- set x [prune_warnings [target_compile [concat $uses($file) $objlist] \
- $Executable executable $link_args]]
+ set x [libjava_prune_warnings \
+ [libjava_tcompile [concat $uses($file) $objlist] \
+ $Executable executable $link_args]]
if {$x != ""} then {
+ set proc_ok 0
fail "Link for $class"
continue
}
set result [libjava_load [pwd]/DejaGNUTestHarness \
"$env(MAUVEDIR) $class" ""]
- # Test for an exception thrown in the test harness itself. This
- # isn't enough to test for all faults in the test harness, but
- # it's better than nothing.
- set output [lindex $result 1];
- if [regexp "Exception: " $output] then {
- fail $output
- continue
- }
-
- pass "Execute for $class"
-
# Extract pass/failure info from output.
foreach line [split [lindex $result 1] \n] {
- if {[regexp -- {^(PASS|FAIL): (.*)$} $line ignore what msg]} then {
- if {$what == "PASS"} then {
+ if {[regexp -- {^(PASS|FAIL|XFAIL|XPASS): (.*)$} $line ignore what msg]} then {
+ if {$what == "XFAIL" || $what == "XPASS"} then {
+ setup_xfail *-*-*
+ }
+ if {$what == "PASS" || $what == "XPASS"} then {
pass $msg
} else {
+ set proc_ok 0
fail $msg
}
}
}
}
+
+ return $proc_ok
}
# 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
# 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 {} {
global srcdir subdir env
- if {! [info exists env(MAUVEDIR)]} then {
+ if {! [find_mauve_sources]} then {
verbose "MAUVEDIR not set; not running Mauve tests"
- return
+ return 1
}
# Run in subdir so we don't overwrite our own Makefile.
} msg]} then {
fail "Mauve configure"
verbose "configure failed with $msg"
- return
+ return 0
}
pass "Mauve configure"
puts -nonewline $fd $c
close $fd
+ catch {system "ln -s $full_srcdir/libjava.mauve/xfails xfails"}
+
if {[catch {
system "make KEYS=libgcj classes.stamp 2>&1"
} msg]} then {
fail "Mauve build"
verbose "build failed with $msg"
- return
+ return 0
}
pass "Mauve build"
gnu/testlet/config} {
set file $base.class
set obj $base.o
- set x [prune_warnings \
+ set x [libjava_prune_warnings \
[target_compile [pwd]/$file $obj object $compile_args]]
if {$x != ""} then {
fail "Compile $obj"
lappend objlist $obj
}
if {! $ok} then {
- return
+ return 0
}
lappend objlist gnu/testlet/DejaGNUTestHarness.o
+ set proc_ok 1
set Executable DejaGNUTestHarness
foreach file $choices {
# Turn `java/lang/Foo.java' into `java.lang.Foo'.
if {! [file exists $obj]} then {
verbose "compiling $obj for test of $class"
set srcfile [file rootname $obj].class
- set x [prune_warnings \
+ set x [libjava_prune_warnings \
[target_compile [pwd]/$srcfile $obj object $compile_args]]
if {$x != ""} then {
fail "Compile $obj for $class"
}
}
if {! $ok} then {
+ set proc_ok 0
continue
}
if {! [bytecompile_file [pwd]/gnu/testlet/$srcfile [pwd]/gnu/testlet \
$env(MAUVEDIR):[pwd]]} then {
fail "Compile DejaGNUTestHarness.java"
- return
+ return 0
}
- set x [prune_warnings \
+ set x [libjava_prune_warnings \
[target_compile gnu/testlet/DejaGNUTestHarness.class \
gnu/testlet/DejaGNUTestHarness.o object $compile_args]]
if {$x != ""} then {
fail "Compile DejaGNUTestHarness.java"
+ set proc_ok 0
continue
- }
+ }
- set x [prune_warnings [target_compile [concat $uses($file) $objlist] \
- $Executable executable $link_args]]
+ set x [libjava_prune_warnings \
+ [target_compile [concat $uses($file) $objlist] \
+ $Executable executable $link_args]]
if {$x != ""} then {
+ set proc_ok 0
fail "Link for $class"
continue
}
set result [libjava_load [pwd]/DejaGNUTestHarness \
"$env(MAUVEDIR) $class" ""]
- # Test for an exception thrown in the test harness itself. This
- # isn't enough to test for all faults in the test harness, but
- # it's better than nothing.
- set output [lindex $result 1];
- if [regexp "Exception: " $output] then {
- fail $output
- continue
- }
-
- pass "Execute for $class"
-
# Extract pass/failure info from output.
foreach line [split [lindex $result 1] \n] {
- if {[regexp -- {^(PASS|FAIL): (.*)$} $line ignore what msg]} then {
- if {$what == "PASS"} then {
+ if {[regexp -- {^(PASS|FAIL|XFAIL|XPASS): (.*)$} $line ignore what msg]} then {
+ if {$what == "XFAIL" || $what == "XPASS"} then {
+ setup_xfail *-*-*
+ }
+ if {$what == "PASS" || $what == "XPASS"} then {
pass $msg
} else {
+ set proc_ok 0
fail $msg
}
}
}
}
+
+ return $proc_ok
}
-# The test_mauve* procs will change the current directory. It's
-# simpler to fix this up here than to keep track of this in the procs.
-set here [pwd]
-if { [board_info target exists is_simulator] } {
- test_mauve_sim
-} else {
- test_mauve
+proc gcj_run_mauve_tests {} {
+ # The test_mauve* procs will change the current directory. It's
+ # simpler to fix this up here than to keep track of this in the
+ # procs.
+ set here [pwd]
+ if { [board_info target exists is_simulator] } {
+ 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