summaryrefslogtreecommitdiff
path: root/libjava/testsuite/libjava.jar/jar.exp
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /libjava/testsuite/libjava.jar/jar.exp
downloadcbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.bz2
cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'libjava/testsuite/libjava.jar/jar.exp')
-rw-r--r--libjava/testsuite/libjava.jar/jar.exp67
1 files changed, 67 insertions, 0 deletions
diff --git a/libjava/testsuite/libjava.jar/jar.exp b/libjava/testsuite/libjava.jar/jar.exp
new file mode 100644
index 000000000..65565832e
--- /dev/null
+++ b/libjava/testsuite/libjava.jar/jar.exp
@@ -0,0 +1,67 @@
+# 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]
+ # 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 "$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 \
+ "" -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