gcc/libjava/testsuite/libjava.jar/jar.exp
Rainer Orth c9c0db83bb re PR testsuite/21164 (libjava tests uses absolute paths)
libjava:
	PR testsuite/21164
	* testsuite/lib/libjava.exp: Load dg.exp.
	* testsuite/libjava.jar/jar.exp (gcj_jar_interpret): Strip srcdir
	from jarfile.
	Use result for messages.
	* testsuite/libjava.loader/loader.exp (gcj_loader_test_one): Pass
	errname to libjava_invoke, fix testname.

	gcc:
	PR testsuite/21164
	* lib/compat.exp (compat-execute): Declare unsupported after
	stripping path from src1.
	* lib/lto.exp (lto-execute): Likewise.

From-SVN: r172302
2011-04-12 09:04:05 +00:00

69 lines
1.7 KiB
Plaintext

# Tests for .jar files.
# Compile a single .jar file to an executable.
# Returns 0 on failure.
proc gcj_jar_link {jarfile mainclass} {
}
proc gcj_jar_compile_one {jarfile mainclass} {
set base [file rootname [file tail $jarfile]]
set out [file rootname $jarfile].out
if {! [gcj_link $base $mainclass [list $jarfile]]} {
return
}
gcj_invoke $base $out {}
}
proc gcj_jar_interpret {jarfile} {
global INTERPRETER srcdir
set gij [libjava_find_gij]
set errname [dg-trim-dirname $srcdir $jarfile]
# libjava_find_gij will return "" if it couldn't find the
# program; in this case we want to skip the test.
if {$INTERPRETER != "yes" || $gij == ""} {
untested "$errname execution - gij test"
untested "$errname output - gij test"
return
}
set opts(_) {}
set out [file rootname $jarfile].out
libjava_invoke $errname "gij test" opts $gij {} $out \
"" -jar $jarfile
}
proc gcj_jar_run {} {
global srcdir subdir env
foreach jar [lsort [glob -nocomplain ${srcdir}/${subdir}/*.jar]] {
set xff [file rootname $jar].xfail
set main {}
set interp 1
foreach item [libjava_read_xfail $xff] {
if {[string match main=* $item]} {
set main [string range $item 5 end]
break
} elseif {$item == "no-interpret"} {
set interp 0
}
}
gcj_jar_compile_one $jar $main
if {$interp} {
gcj_jar_interpret $jar
}
}
# When we succeed we remove all our clutter.
eval gcj_cleanup [glob -nocomplain -- ${main}.*] [list $main ]
# Reset CLASSPATH that we do not look into testsuite/libjava.jar for *.jar
# files which do not belong to the libgcj itself.
set env(CLASSPATH) ""
return 1
}
gcj_jar_run