diff options
author | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
commit | 1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch) | |
tree | c607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/libjava/testsuite/libjava.special/special.exp | |
parent | 283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff) | |
download | toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2 toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip |
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/libjava/testsuite/libjava.special/special.exp')
-rw-r--r-- | gcc-4.9/libjava/testsuite/libjava.special/special.exp | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/gcc-4.9/libjava/testsuite/libjava.special/special.exp b/gcc-4.9/libjava/testsuite/libjava.special/special.exp new file mode 100644 index 000000000..8397f8567 --- /dev/null +++ b/gcc-4.9/libjava/testsuite/libjava.special/special.exp @@ -0,0 +1,108 @@ +# Special test cases. These require tricky build procedures. + +proc gcj_special_try_compiler {} { + global srcdir subdir + return [bytecompile_file ${srcdir}/${subdir}/pr21115I.java [pwd]] +} + +proc gcj_special_pr21115 {} { + global srcdir subdir env + + # ---- PR 21115 ------------------------------------------------------- + + if {! [bytecompile_file ${srcdir}/${subdir}/pr21115I.java [pwd]]} { + fail "bytecompile ${srcdir}/${subdir}/libjava.special/pr21115I.java" + # FIXME - should use `untested' on all remaining tests. + # But that is hard. + return 0 + } + pass "bytecompile pr21115I.java" + + if {! [gcj_link pr21115 pr21115 [list ${srcdir}/${subdir}/pr21115.java]]} { + fail "compiling/linking pr21115.java" + # FIXME + return 0 + } + + if {! [gcj_invoke pr21115 ${srcdir}/${subdir}/pr21115.out ""]} { + # FIXME + return 0 + } + + return 1 +} + +# Write a .java file and bytecompile it. Return 0 on failure. +proc gcj_write_and_byte_compile {name contents} { + set fd [open $name w] + puts $fd $contents + close $fd + + if {! [bytecompile_file $name [pwd]]} { + fail "bytecompile $name" + # FIXME - should use `untested' on all remaining tests. + # But that is hard. + return 0 + } + pass "bytecompile $name" + return 1 +} + +# Check that BC-compiled code lazily throws IllegalAccessError. +proc gcj_special_lazy_illegal_access {} { + global srcdir subdir env + + # Write and compile the initial files. + if {! [gcj_write_and_byte_compile LazyA.java { + public class LazyA { + public static void m() { } + } + }]} { + return 0 + } + if {! [gcj_write_and_byte_compile LazyB.java { + public class LazyB { + public static void m() { } + public static void main(String[] args) { } + } + }]} { + return 0 + } + + # Create the expected output file. + set fd [open Lazy.out w] + close $fd + + # Now recompile LazyA with different access for m(). + if {! [gcj_write_and_byte_compile LazyA.java { + public class LazyA { + private static void m() { } + } + }]} { + return 0 + } + + # Link and run... this should still work, since we don't actually + # try to call LazyA.m(). + if {! [gcj_link Lazy LazyB {LazyA.class LazyB.class} \ + additional_flags=-findirect-dispatch]} { + fail "compiling/linking pr21115.java" + # FIXME + return 0 + } + + if {! [gcj_invoke Lazy Lazy.out ""]} { + # FIXME + return 0 + } + + return 1 +} + +# For these tests it is simpler to require that gcj work. So we try +# the compiler and if it fails, we simply skip the tests. + +if {[gcj_special_try_compiler]} { + gcj_special_pr21115 + gcj_special_lazy_illegal_access +} |