summaryrefslogtreecommitdiff
path: root/libjava/testsuite/libjava.loader/loader.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.loader/loader.exp
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.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.loader/loader.exp')
-rw-r--r--libjava/testsuite/libjava.loader/loader.exp77
1 files changed, 77 insertions, 0 deletions
diff --git a/libjava/testsuite/libjava.loader/loader.exp b/libjava/testsuite/libjava.loader/loader.exp
new file mode 100644
index 000000000..a94e4e9ea
--- /dev/null
+++ b/libjava/testsuite/libjava.loader/loader.exp
@@ -0,0 +1,77 @@
+# Tests for ClassLoader and native library loader code.
+
+# Compute the correct name for an object file.
+# This is an awful hack.
+proc gcj_object_file_name {compiler base} {
+ verbose "OBJECT: compiler = $compiler"
+ if {[string match *libtool* $compiler]} {
+ return $base.lo
+ }
+ return $base.o
+}
+
+# Do all the work for a single JNI test. Return 0 on failure.
+proc gcj_loader_test_one {srcfile} {
+ global objdir srcdir subdir
+
+ set resfile $srcdir/$subdir/[file rootname [file tail $srcfile]].out
+
+ regsub "^.*/(\[^/.\]+)\[.\]\[^/]*$" "$srcfile" "\\1" out
+ set executable "${objdir}/$out.exe"
+
+ set errname [file rootname [file tail $srcfile]]
+ set args [libjava_arguments link]
+ lappend args "additional_flags=--main=[file rootname [file tail $srcfile]] [gcj_object_file_name $args dummy]"
+ set x [libjava_prune_warnings \
+ [libjava_tcompile $srcfile "$executable" executable $args]]
+
+ if { $x != "" } {
+ verbose "target_compile failed: $x" 2
+
+ fail "$errname compilation from source"
+ untested "$errname execution from source compiled test"
+ return
+ }
+ pass "$errname compilation from source"
+
+ libjava_invoke $executable $executable "" $executable "" $resfile ""
+
+ return 1
+}
+
+# Run the bytecode loader tests.
+proc gcj_loader_run {} {
+ global srcdir subdir objdir
+ global build_triplet host_triplet
+ global GCJ_UNDER_TEST
+
+# set file "${srcdir}/${subdir}/dummy.java"
+# if {! [bytecompile_file $file [pwd]]} {
+# fail "bytecompile $file"
+# # FIXME - should use `untested' on all remaining tests.
+# # But that is hard.
+# return 0
+# }
+# pass "bytecompile $file"
+
+ set args [libjava_arguments compile]
+ lappend args "additional_flags=--resource $srcdir/$subdir/dummy.class"
+ set x [libjava_prune_warnings \
+ [libjava_tcompile "$srcdir/$subdir/dummy.class" "$objdir/[gcj_object_file_name $args dummy]" object $args]]
+
+ if { $x != "" } {
+ verbose "resource compilation failed: $x" 2
+
+ fail "resource compilation dummy.class"
+ return 0;
+ }
+ pass "resource compilation: dummy.class"
+
+ catch { lsort [glob -nocomplain ${srcdir}/${subdir}/Test*.jar] } srcfiles
+
+ foreach x $srcfiles {
+ gcj_loader_test_one $x
+ }
+}
+
+gcj_loader_run