2015-01-14 Richard Biener <rguenther@suse.de>
[official-gcc.git] / libjava / testsuite / libjava.jar / jar.exp
blobe57bcb3e540fd7c298410ccbfb2147db4dcb6252
1 # Tests for .jar files.
3 # Compile a single .jar file to an executable.
4 # Returns 0 on failure.
5 proc gcj_jar_link {jarfile mainclass} {
8 proc gcj_jar_compile_one {jarfile mainclass} {
9 set base [file rootname [file tail $jarfile]]
10 set out [file rootname $jarfile].out
12 if {! [gcj_link $base $mainclass [list $jarfile]]} {
13 return
16 gcj_invoke $base $out {}
19 proc gcj_jar_interpret {jarfile} {
20 global INTERPRETER srcdir
22 set gij [libjava_find_gij]
23 set errname [dg-trim-dirname $srcdir $jarfile]
24 # libjava_find_gij will return "" if it couldn't find the
25 # program; in this case we want to skip the test.
26 if {$INTERPRETER != "yes" || $gij == ""} {
27 untested "$errname execution - gij test"
28 untested "$errname output - gij test"
29 return
32 set opts(_) {}
33 set out [file rootname $jarfile].out
34 libjava_invoke $errname "gij test" opts $gij {} $out \
35 "" -jar $jarfile
38 proc gcj_jar_run {} {
39 global srcdir subdir env
40 foreach jar [lsort [glob -nocomplain ${srcdir}/${subdir}/*.jar]] {
41 set xff [file rootname $jar].xfail
42 set main {}
43 set interp 1
44 foreach item [libjava_read_xfail $xff] {
45 if {[string match main=* $item]} {
46 set main [string range $item 5 end]
47 break
48 } elseif {$item == "no-interpret"} {
49 set interp 0
53 gcj_jar_compile_one $jar $main
54 if {$interp} {
55 gcj_jar_interpret $jar
58 # When we succeed we remove all our clutter.
59 eval gcj_cleanup [glob -nocomplain -- ${main}.*] [list $main ]
61 # Reset CLASSPATH that we do not look into testsuite/libjava.jar for *.jar
62 # files which do not belong to the libgcj itself.
63 set env(CLASSPATH) ""
65 return 1
68 gcj_jar_run