Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / libjava / testsuite / libjava.loader / loader.exp
blob86e518170c4f7c97837e549780b35f54324efff9
1 # Tests for ClassLoader and native library loader code.
3 # Compute the correct name for an object file.
4 # This is an awful hack.
5 proc gcj_object_file_name {compiler base} {
6 verbose "OBJECT: compiler = $compiler"
7 if {[string match *libtool* $compiler]} {
8 return $base.lo
10 return $base.o
13 # Do all the work for a single JNI test. Return 0 on failure.
14 proc gcj_loader_test_one {srcfile} {
15 global objdir srcdir subdir
17 set resfile $srcdir/$subdir/[file rootname [file tail $srcfile]].out
19 regsub "^.*/(\[^/.\]+)\[.\]\[^/]*$" "$srcfile" "\\1" out
20 set executable "${objdir}/$out.exe"
22 set errname [file rootname [file tail $srcfile]]
23 set args [libjava_arguments link]
24 lappend args "additional_flags=--main=[file rootname [file tail $srcfile]] $srcdir/$subdir/MyLoader.java $objdir/[gcj_object_file_name $args dummy]"
25 set x [libjava_prune_warnings \
26 [libjava_tcompile $srcfile "$executable" executable $args]]
28 if { $x != "" } {
29 verbose "target_compile failed: $x" 2
31 fail "$errname compilation from source"
32 untested "$errname execution from source compiled test"
33 return
35 pass "$errname compilation from source"
37 libjava_invoke $executable $executable "" $executable "" $resfile ""
39 return 1
42 # Run the bytecode loader tests.
43 proc gcj_loader_run {} {
44 global srcdir subdir objdir
45 global build_triplet host_triplet
46 global GCJ_UNDER_TEST
48 set file "${srcdir}/${subdir}/dummy.java"
49 if {! [bytecompile_file $file [pwd]]} {
50 fail "bytecompile $file"
51 # FIXME - should use `untested' on all remaining tests.
52 # But that is hard.
53 return 0
55 pass "bytecompile $file"
57 set args [libjava_arguments compile]
58 lappend args "additional_flags=--resource $objdir/dummy.class"
59 set x [libjava_prune_warnings \
60 [libjava_tcompile "$objdir/dummy.class" "$objdir/[gcj_object_file_name $args dummy]" object $args]]
62 if { $x != "" } {
63 verbose "resource compilation failed: $x" 2
65 fail "resource compilation dummy.class"
66 return 0;
68 pass "resource compilation: dummy.class"
70 catch { lsort [glob -nocomplain ${srcdir}/${subdir}/Test*.java] } srcfiles
72 foreach x $srcfiles {
73 gcj_loader_test_one $x
77 gcj_loader_run