OSDN Git Service

228e18ff3580f71a50f53e8a81ef67d2d7773f8f
[pf3gnuchains/gcc-fork.git] / libjava / testsuite / libjava.jacks / jacks.exp
1 # Run the Jacks test suite.
2 # See http://www-124.ibm.com/developerworks/oss/cvs/jikes/~checkout~/jacks/jacks.html
3
4 proc gcj_jacks_setup_xfail {ary} {
5   upvar $ary array
6   global srcdir
7
8   set fd [open $srcdir/libjava.jacks/jacks.xfail]
9   while {! [eof $fd]} {
10     set array([gets $fd]) {}
11   }
12   close $fd
13 }
14
15 proc gcj_jacks_write {filename} {
16   global GCJ_UNDER_TEST
17   global libgcj_jar
18   global libjava_libgcc_s_path
19   global original_ld_library_path
20
21   set gcjl [split $GCJ_UNDER_TEST]
22   set gcj_cmd [lindex $gcjl 0]
23   set rest [join [lreplace $gcjl 0 0]]
24   append rest " -C"
25
26   set fd [open $filename w]
27   puts $fd "set JAVAC $gcj_cmd"
28   puts $fd "set JAVA_CLASSPATH \"$libgcj_jar\""
29   puts $fd "set JAVAC_FLAGS [list $rest]"
30   puts $fd "set JAVA [list [libjava_find_gij]]"
31
32   # Without an explicit limit on the heap size, tests depending on
33   # an OutOfMemoryError (e.g. "15.9.4-runtime-creation-2") can result
34   # in a lot of unnecessary thrashing.
35   puts $fd "set JAVA_FLAGS \"-mx=64m\""
36
37   puts $fd "set JAVAC_ENCODING_FLAG --encoding="
38   puts $fd "set JAVAC_DEPRECATION_FLAG -Wdeprecated"
39   puts $fd "set tcltest::testConstraints(encoding) 1"
40   puts $fd "set tcltest::testConstraints(gcj) 1"
41   puts $fd "set tcltest::testConstraints(assert) 1"
42   # "Time-consuming JVM limitation tests".
43   # puts $fd "set tcltest::testConstraints(jvm) 1"
44   close $fd
45
46   setenv LD_LIBRARY_PATH $libjava_libgcc_s_path:$original_ld_library_path
47 }
48
49 proc gcj_jacks_parse {file} {
50   if {[catch {open $file} fd]} {
51     verbose "couldn't parse Jacks output: $fd"
52     return
53   }
54
55   verbose "Reading jacks.xfail"
56   gcj_jacks_setup_xfail xfails
57
58   while {! [eof $fd]} {
59     set line [gets $fd]
60     if {[string match RESULT* $line]} {
61       set linelist [split $line]
62       set test [lindex $linelist 1]
63       if {[info exists xfails($test)]} {
64         setup_xfail "*-*-*"
65       }
66       if {[lindex $linelist 2] == "PASSED"} {
67         pass $test
68       } else {
69         fail $test
70       }
71     }
72   }
73
74   close $fd
75 }
76
77 proc gcj_jacks_run {} {
78   global srcdir
79
80   if {! [file isdirectory $srcdir/libjava.jacks/jacks]} {
81     # No tests.
82     verbose "Jacks tests not found"
83     return
84   }
85
86   # Jacks forces us to do this.  You can't run it from a separate
87   # tree.
88   verbose "Copying Jacks..."
89   catch {system "rm -rf jacks"}
90   catch {system "cp -r $srcdir/libjava.jacks/jacks jacks"}
91
92   set here [pwd]
93   cd jacks
94
95   verbose "Writing Jacks setup file"
96   gcj_jacks_write gcj_setup
97
98   verbose "Running Jacks..."
99   # Just ignore error exits from the jacks program.
100   # It will always error exit for us, since don't completely pass.
101   # At the moment jacks has a hardcoded call to tclsh8.3. To override this,
102   # we check here on the version and launch the script directly with the
103   # tclsh$tcl_ver.
104   set tcl_ver [info tclversion]
105   if {[package vcompare  $tcl_ver 8.3] >= 0 } {
106     if {[catch {exec tclsh$tcl_ver jacks gcj} msg]} {
107         send_log "Couldn't run jacks: $msg\n"
108         return
109     }
110     gcj_jacks_parse logging/gcj.log
111   } else {
112       send_log "No suitable tclsh found, you need at least version 8.3 or up.\n"
113       return
114   }
115
116   cd $here
117 }
118
119 gcj_jacks_run