OSDN Git Service

* langhooks.c (lhd_tree_inlining_add_pending_fn_decls,
[pf3gnuchains/gcc-fork.git] / libjava / testsuite / libjava.loader / loader.exp
1 # Tests for ClassLoader and native library loader code.
2
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
9   }
10   return $base.o
11 }
12
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
16
17   set resfile $srcdir/$subdir/[file rootname [file tail $srcfile]].out
18
19   regsub "^.*/(\[^/.\]+)\[.\]\[^/]*$" "$srcfile" "\\1" out
20   set executable "${objdir}/$out.exe"
21
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]] [gcj_object_file_name $args dummy]"
25   set x [libjava_prune_warnings \
26              [libjava_tcompile $srcfile "$executable" executable $args]]
27
28     if { $x != "" } {
29         verbose "target_compile failed: $x" 2
30
31         fail "$errname compilation from source"
32         untested "$errname execution from source compiled test"
33         return
34     }
35     pass "$errname compilation from source"
36
37     libjava_invoke $executable $executable "" $executable "" $resfile ""
38
39   return 1
40 }
41
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
47
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
54 #   }
55 #   pass "bytecompile $file"
56
57   set args [libjava_arguments compile]
58   lappend args "additional_flags=--resource $srcdir/$subdir/dummy.class"
59   set x [libjava_prune_warnings \
60            [libjava_tcompile "$srcdir/$subdir/dummy.class" "$objdir/[gcj_object_file_name $args dummy]" object $args]]
61
62     if { $x != "" } {
63         verbose "resource compilation failed: $x" 2
64
65         fail "resource compilation dummy.class"
66         return 0;
67     }
68   pass "resource compilation: dummy.class"
69
70   catch { lsort [glob -nocomplain ${srcdir}/${subdir}/Test*.jar] } srcfiles
71
72   foreach x $srcfiles {
73     gcj_loader_test_one $x
74   }
75 }
76
77 gcj_loader_run