2003-11-10 22:30:10 +01:00
|
|
|
# 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
|
|
|
|
|
2003-11-18 08:17:01 +01:00
|
|
|
set gij [libjava_find_gij]
|
2004-12-21 02:01:08 +01:00
|
|
|
# libjava_find_gij will return "" if it couldn't find the
|
2003-11-10 22:30:10 +01:00
|
|
|
# program; in this case we want to skip the test.
|
2004-12-21 02:01:08 +01:00
|
|
|
if {$INTERPRETER != "yes" || $gij == ""} {
|
2003-11-10 22:30:10 +01:00
|
|
|
untested "$jarfile execution - gij test"
|
|
|
|
untested "$jarfile output - gij test"
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
set opts(_) {}
|
|
|
|
set out [file rootname $jarfile].out
|
|
|
|
libjava_invoke $jarfile "gij test" opts $gij {} $out \
|
2004-05-10 22:44:13 +02:00
|
|
|
"" -jar $jarfile
|
2003-11-10 22:30:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
proc gcj_jar_run {} {
|
2003-11-18 08:17:01 +01:00
|
|
|
global srcdir subdir env
|
2003-11-10 22:30:10 +01:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
2003-11-18 08:17:01 +01:00
|
|
|
# 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
|
2003-11-10 22:30:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
gcj_jar_run
|