OSDN Git Service

PR c/48517
[pf3gnuchains/gcc-fork.git] / libjava / testsuite / lib / libjava.exp
1 # Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007 Free Software Foundation
2
3 proc load_gcc_lib { filename } {
4     global srcdir
5     load_file $srcdir/../../gcc/testsuite/lib/$filename
6 }
7
8 load_lib libgloss.exp
9 load_gcc_lib target-libpath.exp
10
11 # GCJ_UNDER_TEST is the compiler under test.
12
13 global tmpdir
14
15 if ![info exists tmpdir] {
16     set tmpdir "/tmp"
17 }
18
19 # This is like `prune_warnings', but it also prunes away a warning
20 # from the bytecode front end that we don't care about.
21 proc libjava_prune_warnings {text} {
22     set text [prune_warnings $text]
23     set tlist [split $text \n]
24     set len [llength $tlist]
25     for {set i [expr {$len - 1}]} {$i >= 2} {incr i -1} {
26         if {[string match "*unreachable bytecode*" [lindex $tlist $i]]} {
27             # Delete this line, all other unreachable warnings and the previous
28             # two lines containing the method and class.
29             set j [expr {$i - 1}]
30             while {[string match "*unreachable bytecode*" [lindex $tlist $j]]} {
31                 incr j -1
32             }
33             incr j -1
34             set tlist [lreplace $tlist $j $i]
35             set i $j
36         }
37     }
38     return [join $tlist \n]
39 }
40
41 # This is like `target_compile' but it does some surgery to work
42 # around stupid DejaGNU bugs.  In particular DejaGNU has very poor
43 # quoting, so for instance a `$' will be re-evaluated at spawn time.
44 # We don't want that.
45 proc libjava_tcompile {source destfile type options} {
46     # This strange-looking expression really does quote the `$'.
47     regsub -all -- {\$} $source {\$} source
48     regsub -all -- {\$} $destfile {\$} destfile
49     return [target_compile $source $destfile $type $options]
50 }
51
52 # Read an `xfail' file if it exists.  Returns a list of xfail tokens.
53 proc libjava_read_xfail {file} {
54     if {! [file exists $file]} {
55         return ""
56     }
57     set fd [open $file r]
58     set tokens [string trim [read $fd]]
59     close $fd
60     return $tokens
61 }
62
63 # Find a particular executable.  FIXME: this relies on DejaGnu
64 # internals.  These should probably be exposed in a better way.
65 proc libjava_find_program {prog} {
66     global tool_root_dir
67
68     set file [lookfor_file $tool_root_dir $prog]
69     if { $file == "" } {
70         set file [lookfor_file $tool_root_dir gcc/$prog];
71     }
72     if {$file == ""} {
73         set file $prog
74     }
75     return $file
76 }
77
78 # Find `gcjh'.
79 proc find_gcjh {} {
80     return [libjava_find_program gjavah]
81 }
82
83 proc find_javac {} {
84     global SUN_JAVAC GCJ_UNDER_TEST env libgcj_jar
85     # If JDK doesn't run on your platform but some other
86     # JDK-compatible javac does, you may set SUN_JAVAC to point to it.
87     # One of the most important properties of a SUN_JAVAC is that it
88     # must create class-files even for classes that have not been
89     # specified in the command line, but that were needed to compile
90     # those that have.  For example, Pizza won't do it, but you can
91     # use `kaffe sun.tools.javac.Main', if you have Sun's classes.zip
92     # in the kaffe's default search path.
93     if {![info exists SUN_JAVAC]} {
94         if {[info exists env(SUN_JAVAC)]} {
95             set SUN_JAVAC $env(SUN_JAVAC)
96         } else {
97             set SUN_JAVAC "$GCJ_UNDER_TEST -C -I$libgcj_jar"
98         }
99     }
100     return $SUN_JAVAC
101 }
102
103 proc bytecompile_file { file objdir {classpath {}} } {
104     global env
105     set dirname [file dirname $file]
106
107     set javac [find_javac]
108     if {$classpath != ""} then {
109         set env(CLASSPATH) $classpath
110     }
111     set here [pwd]
112     cd $dirname
113     send_log "byte compile: $javac -g [list $file] -d $objdir 2>@ stdout\n"
114     if {[catch {
115         set q [eval exec "$javac -g [list $file] -d $objdir 2>@ stdout"]
116     } msg]} then {
117         send_log "couldn't compile $file: $msg\n"
118         set r 0
119     } else {
120         set r 1
121     }
122     cd $here
123     return $r
124 }
125
126 set libjava_initialized 0
127
128 #
129 # Build the status wrapper library as needed.
130 #
131 proc libjava_init { args } {
132     global wrapper_file;
133     global wrap_compile_flags;
134     global libjava_initialized libjava_uses_threads
135     global GCJ_UNDER_TEST
136     global TOOL_EXECUTABLE
137     global env objdir
138     global env libgcj_jar
139     global tool_root_dir
140     global libjava_libgcc_s_path
141     global target_triplet
142     global libjava_version
143
144     # We set LC_ALL and LANG to C so that we get the same error messages as expected.
145     setenv LC_ALL C
146     setenv LANG C
147
148     # Many hosts now default to a non-ASCII C locale, however, so
149     # they can set a charset encoding here if they need.
150     if { [ishost "*-*-cygwin*"] } {
151       setenv LC_ALL C.ASCII
152       setenv LANG C.ASCII
153     }
154
155     if { $libjava_initialized == 1 } { return; }
156
157     if ![info exists GCJ_UNDER_TEST] {
158         if [info exists TOOL_EXECUTABLE] {
159             set GCJ_UNDER_TEST $TOOL_EXECUTABLE;
160         } else {
161             if [info exists env(GCJ)] {
162                 set GCJ_UNDER_TEST $env(GCJ)
163             } else {
164                 set GCJ_UNDER_TEST "[find_gcj]"
165             }
166         }
167     }
168
169     # Find the libgcj jar file.
170
171     # FIXME: This finds libgcj.spec for the default multilib.
172     # If thread models differ between multilibs, this has to be moved
173     # to libjava_arguments
174     set specdir [libjava_find_spec]
175
176     set text [eval exec "$GCJ_UNDER_TEST -B$specdir -v 2>@ stdout"]
177     regexp " version \[^\n\r\]*" $text version
178     set libjava_version [lindex $version 1]
179
180     verbose "version: $libjava_version"
181
182     set libgcj_jar [glob $objdir/../libgcj-$libjava_version.jar]
183     verbose "jar file is $libgcj_jar"
184
185     # The -B is so we find libgcj.spec.
186     regexp -- "Thread model: (\[^\n\]+)\n" $text ignore model
187     set libjava_uses_threads [expr {! ($model == "no"
188                                        || $model == "none"
189                                        || $model == "single")}]
190
191     # Always set encoding used by gcj.
192     append GCJ_UNDER_TEST " --encoding=UTF-8"
193
194     set wrapper_file "";
195     set wrap_compile_flags "";
196     if [target_info exists needs_status_wrapper] {
197         set result [build_wrapper "testglue.o"];
198         if { $result != "" } {
199             set wrapper_file [lindex $result 0];
200             set wrap_compile_flags [lindex $result 1];
201         } else {
202             warning "Status wrapper failed to build."
203         }
204     }
205
206     # Finally, add the gcc build directory so that we can find the
207     # shared libgcc.  This, like much of dejagnu, is hideous.
208     set libjava_libgcc_s_path {}
209
210     if { [istarget "*-*-darwin*"] } {
211         set so_extension "dylib"
212     } elseif { [istarget "*-*-cygwin*"] || [istarget "*-*-mingw*"] } {
213         set so_extension "dll"
214     } else {
215         set so_extension "so"
216     }
217     set gccdir [lookfor_file $tool_root_dir gcc/libgcc_s.${so_extension}]
218     if {$gccdir != ""} {
219         set gccdir [file dirname $gccdir]
220         lappend libjava_libgcc_s_path $gccdir
221         verbose "libjava_libgcc_s_path = $libjava_libgcc_s_path"
222         set compiler ${gccdir}/xgcc
223         if { [is_remote host] == 0 && [which $compiler] != 0 } {
224             foreach i "[exec $compiler --print-multi-lib]" {
225                 set mldir ""
226                 regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir
227                 set mldir [string trimright $mldir "\;@"]
228                 if { "$mldir" == "." } {
229                     continue
230                 }
231                 if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.${so_extension}.*]] >= 1 } {
232                     lappend libjava_libgcc_s_path "${gccdir}/${mldir}"
233                 }
234             }
235         }
236     }
237
238     set libjava_initialized 1
239 }
240
241 # Find a library.  We know where libtool puts the actual libraries,
242 # and we look there.  The implementation is fairly hacky.  We can't
243 # compile with -nodefaultlibs, because that will also eliminate the
244 # system libraries we need.  In order to have gcj still work, it must
245 # find the appropriate libraries so we must add -L options for their
246 # paths.  However we can't simply use those libraries; we still need
247 # libtool for linking.
248 # Don't return the the lib${name}.la files here, since this causes the
249 # libraries to be linked twice: once as lib${name}.so/dylib and another time
250 # via gcj's implicit -l${name}.  This is both unnecessary and causes the
251 # Solaris ld to warn: attempted multiple inclusion of file.  This warning
252 # is not ignored by the dejagnu framework and cannot be disabled.
253 proc libjava_find_lib {dir name} {
254     global base_dir
255     set gp [get_multilibs]
256     foreach extension {so dll dylib sl a} {
257         foreach sub {.libs _libs} {
258             if {$gp != ""} {
259                 if {[file exists $gp/$dir/$sub/lib${name}.${extension}]} then {
260                     # Just return the `-L' option.  The library itself
261                     # will be picked up via the spec file.
262                     return "-L$gp/$dir/$sub"
263                 }
264             }
265             # Just return the `-L' option.  The library itself will be
266             # picked up via the spec file.
267             set lib [findfile \
268                        $base_dir/../../$dir/$sub/lib${name}.${extension} \
269                        "-L$base_dir/../../$dir/$sub" \
270                        ""]
271             if {$lib != ""} {
272                 return $lib
273             }
274         }
275     }
276     return ""
277 }
278
279 # Find libgcj.spec.  We need to use the file corresponding to the multilib
280 # under test since they might differ.  Append a trailing slash since this
281 # is used with -B.
282 proc libjava_find_spec {} {
283     global objdir
284     return "$objdir/../"
285 }
286
287 # Find `gij'.  Return empty string if not found.
288 proc libjava_find_gij {} {
289     global base_dir objdir
290
291     set gijdir [lookfor_file [get_multilibs] libjava];
292     # Fall back if get_multilibs fails.
293     if {$gijdir == ""} {
294       set gijdir "$objdir/.."
295     }
296     if {! [file exists $gijdir/gij]} {
297         return ""
298     }
299     return $gijdir/gij
300 }
301
302 # Remove a bunch of files.
303 proc gcj_cleanup {args} {
304     foreach file $args {
305         if {[string match *.o $file]} {
306             verbose "removing [file rootname $file].lo"
307             file delete -force [file rootname $file].lo
308         }
309         file delete -force -- $file
310         verbose "removing $file"
311     }
312     # It is simplest to do this instead of trying to figure out what
313     # bits in .libs ought to be removed.
314     catch {system "rm -rf .libs"}
315 }
316
317 # Compute arguments needed for compiler.  MODE is a libtool mode:
318 # either compile or link.
319 proc libjava_arguments {{mode compile}} {
320     global base_dir
321     global LIBJAVA
322     global srcdir subdir objdir
323     global TOOL_OPTIONS
324     global GCJ_UNDER_TEST
325     global tmpdir
326     global runtests
327     global env
328     global tool_root_dir
329     global libgcj_jar
330     global libjava_libgcc_s_path
331     global libjava_ld_library_path
332     global ld_library_path
333     global target_triplet
334
335     if [info exists LIBJAVA] {
336         set libjava $LIBJAVA;
337     } else {
338         set libjava [libjava_find_lib libjava gcj]
339     }
340
341     verbose "using LIBJAVA = $libjava" 2
342     set args ""
343
344     # Basically we want to build up a colon separated path list from
345     # the value of $libjava.
346
347     set lpath "."
348     foreach dir [list $libjava] {
349         foreach item [split $dir " "] {
350             switch -glob -- $item {
351                 "-L*" {
352                     lappend lpath [string range $item 2 end]
353                 }
354             }
355         }
356     }
357
358     set lpath [concat $lpath $libjava_libgcc_s_path]
359     verbose "lpath = $lpath ; libgcc_s_path = $libjava_libgcc_s_path"
360     set ld_library_path [join $lpath :]
361     set libjava_ld_library_path "$ld_library_path"
362
363     # That's enough to make things work for the normal case.
364     # If we wanted to handle an arbitrary value of libjava,
365     # then we'd have to do a lot more work.
366
367     set_ld_library_path_env_vars
368     if [info exists env(LD_LIBRARY_PATH)] {
369         verbose "LD_LIBRARY_PATH = $env(LD_LIBRARY_PATH)"
370     }
371
372     # Determine CLASSPATH separator
373     if { [string match "i?86-pc-mingw32*" $target_triplet] } {
374         set sep ";"
375     } else {
376         set sep ":"
377     }
378
379     # Set the CLASSPATH environment variable
380     global env
381     set env(CLASSPATH) \
382         [join [list . $srcdir/$subdir $objdir $libgcj_jar] $sep]
383     verbose "CLASSPATH is $env(CLASSPATH)"
384
385     # Disable all warnings, as ecj is rather chatty.
386     lappend args "additional_flags=-w"
387
388     if {$mode == "link"} {
389         global wrapper_file wrap_compile_flags
390         lappend args "additional_flags=$wrap_compile_flags"
391
392         if { [regexp "linux" $target_triplet] } {
393             lappend args "additional_flags=-specs=libgcj-test.spec"
394         }
395
396         lappend args "libs=$wrapper_file"
397         lappend args "libs=$libjava"
398         lappend args debug
399     }
400
401     if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } {
402         lappend args "libs=${gluefile}"
403         lappend args "ldflags=$wrap_flags"
404     }
405
406     if [info exists TOOL_OPTIONS] {
407         lappend args "additional_flags=$TOOL_OPTIONS"
408     }
409
410     # Determine libgcj.spec corresponding to multilib under test.
411     set specdir [libjava_find_spec]
412
413     # Search for libtool.  We need it to link.
414     set found_compiler 0
415     set d [absolute $objdir]
416     foreach x {. .. ../.. ../../..} {
417         if {[file exists $d/$x/libtool]} then {
418             # We have to run silently to avoid DejaGNU lossage.
419             lappend args \
420               "compiler=$d/$x/libtool --silent --tag=GCJ --mode=$mode $GCJ_UNDER_TEST -B$specdir"
421             set found_compiler 1
422             break
423         }
424     }
425     if {! $found_compiler} {
426         # Append -B$specdir so that we find libgcj.spec before it
427         # is installed.
428         lappend args "compiler=$GCJ_UNDER_TEST -B$specdir"
429     }
430
431     # Avoid libtool wrapper scripts when possible.
432     # but not if libtool warnings results in FAILs
433     if {$mode == "link"} {
434         if {! [istarget "*-*-cygwin*"] && ! [istarget "*-*-mingw*"]
435             && ! [istarget "*-*-darwin*"] } { 
436             lappend args "additional_flags=-no-install"
437         }
438         if { [istarget "*-*-darwin*"] } {
439             lappend args "additional_flags=-bind_at_load"
440             lappend args "additional_flags=-multiply_defined suppress"
441         }
442         if { [istarget "*-*-darwin9*"] || [istarget "*-*-darwin1*"] || [istarget "*-*-darwin2*"] } {
443             lappend args "additional_flags=-Wl,-allow_stack_execute"
444         }
445
446     }
447
448     return $args
449 }
450
451 # Link a bunch of objects into a program.  MAIN is the name of the
452 # class holding `main'.  Return 0 on failure.
453 proc gcj_link {program main files {options {}}} {
454     set arguments [libjava_arguments link]
455     if {[llength $options]} {
456         eval lappend arguments $options
457     }
458     lappend arguments "additional_flags=--main=$main"
459     set x [libjava_prune_warnings \
460              [libjava_tcompile $files $program executable $arguments]]
461     if {$x != ""} {
462         verbose "link failure: $x" 2
463         fail "linking $program"
464         setup_xfail "*-*-*"
465         fail "running $program"
466         return 0
467     }
468
469     pass "linking $program"
470     return 1
471 }
472
473 # Invoke the program and see what happens.  Return 0 on failure.
474 proc gcj_invoke {program expectFile ld_library_additions} {
475   global env
476   global libjava_ld_library_path
477   global ld_library_path
478
479   set ld_library_path "$libjava_ld_library_path"
480   if {[llength $ld_library_additions] > 0} {
481     append ld_library_path :[join $ld_library_additions :]
482   }
483
484   set_ld_library_path_env_vars
485   if [info exists env(LD_LIBRARY_PATH)] {
486     verbose "LD_LIBRARY_PATH=$env(LD_LIBRARY_PATH)"
487   }
488
489   set result [libjava_load ./$program]
490   set status [lindex $result 0]
491   set output [lindex $result 1]
492
493   # Restore setting
494   restore_ld_library_path_env_vars
495
496   if {$status != "pass"} {
497     verbose "got $output"
498     fail "$program run"
499     untested "$program output"
500     return 0
501   }
502
503   set id [open $expectFile r]
504   set expected [read $id]
505   close $id
506
507   if {! [string compare $output $expected]} {
508     pass "$program output"
509     return 1
510   } else {
511     fail "$program output"
512     return 0
513   }
514 }
515
516 proc exec_gij {jarfile expectFile {ld_library_additions {}} {addl_flags {}}} {
517   global env
518   global libjava_ld_library_path
519   global ld_library_path
520
521   set ld_library_path "$libjava_ld_library_path"
522   if {[llength $ld_library_additions] > 0} {
523   append ld_library_path :[join $ld_library_additions :]
524   }
525         
526   set_ld_library_path_env_vars
527   if [info exists env(LD_LIBRARY_PATH)] {
528     verbose "LD_LIBRARY_PATH=$env(LD_LIBRARY_PATH)"
529   }
530   
531   set gij [libjava_find_gij]
532   set classname [file rootname [file tail $jarfile]]
533   
534   puts "LD_LIBRARY_PATH=. $gij -cp $jarfile $addl_flags $classname"
535         
536   set result [libjava_load $gij "-cp $jarfile $addl_flags $classname"]
537   set status [lindex $result 0]
538   set output [lindex $result 1]
539
540   restore_ld_library_path_env_vars
541
542   if {$status != "pass"} {
543     verbose "got $output"
544     fail "$classname run"
545     untested "$classname output"
546     return 0
547   }
548
549   set id [open $expectFile r]
550   set expected [read $id]
551   close $id
552
553   if {! [string compare $output $expected]} {
554     pass "$classname output"
555     return 1
556   } else {
557     fail "$classname output"
558     return 0
559   }
560 }
561
562 # Invoke a program and check its output.  EXECUTABLE is the program;
563 # ARGS are the arguments to the program.  Returns 1 if tests passed
564 # (or things were left untested), 0 otherwise.
565 proc libjava_invoke {errname testName optName executable inpfile resultfile
566                       ld_library_additions args} {
567     global env
568     global libjava_ld_library_path
569     global ld_library_path
570
571     set ld_library_path "$libjava_ld_library_path"
572     if {[llength $ld_library_additions] > 0} {
573         append ld_library_path :[join $ld_library_additions :]
574     }
575
576     set_ld_library_path_env_vars
577     if [info exists env(LD_LIBRARY_PATH)] {
578         verbose "LD_LIBRARY_PATH=$env(LD_LIBRARY_PATH)"
579     }
580
581     upvar $optName opts
582
583     if {[info exists opts(no-exec)]} {
584         if {[info exists opts(need-threads)]} {
585             # This means we wanted to try to run it but we couldn't
586             # because threads aren't supported.  So we have to
587             # generate an `untested'.
588             untested "$errname execution - $testName"
589             untested "$errname output - $testName"
590         }
591         return 1
592     }
593
594     send_log "invoke: $executable $args $inpfile\n"
595
596     set result [libjava_load $executable $args "$inpfile"]
597     set status [lindex $result 0]
598     set output [lindex $result 1]
599
600     # Restore LD_LIBRARY_PATH setting.
601     restore_ld_library_path_env_vars
602
603     if {[info exists opts(xfail-exec)]} then {
604         setup_xfail *-*-*
605     }
606     $status "$errname execution - $testName"
607     if { $status != "pass" } {
608         untested "$errname output - $testName"
609         return 0
610     }
611
612     verbose "resultfile is $resultfile"
613     set id [open $resultfile r]
614     set expected ""
615     append expected [read $id]
616     regsub -all "\r" "$output" "" output
617     regsub "\n*$" $expected "" expected
618     regsub "\n*$" $output "" output
619     regsub "^\n*" $expected "" expected
620     regsub "^\n*" $output "" output
621     regsub -all "\[ \t\]\[ \t\]*" $expected " " expected
622     regsub -all "\[ \t\]*\n\n*" $expected "\n" expected
623     regsub -all "\[ \t\]\[ \t\]*" $output " " output
624     regsub -all "\[ \t\]*\n\n*" $output "\n" output
625     verbose "expected is $expected"
626     verbose "actual is $output"
627     set passed 0
628     if {[info exists opts(regexp_match)]} {
629         if [regexp $expected $output] {
630             set passed 1
631         }
632     } else {
633         if { $expected == $output } {
634             set passed 1
635         }
636     }
637     if {[info exists opts(xfail-output)]} {
638         setup_xfail *-*-*
639     }
640     if { $passed == 1 } {
641         pass "$errname output - $testName"
642     } else {
643         fail "$errname output - $testName"
644     }
645     close $id
646
647     return $passed
648 }
649
650 #
651 # Run the test specified by srcfile and resultfile. compile_args and
652 # exec_args are options telling this proc how to work.
653 #
654 proc test_libjava_from_source { options srcfile compile_args inpfile resultfile exec_args } {
655     global base_dir
656     global srcdir subdir objdir
657     global TOOL_OPTIONS
658     global GCJ_UNDER_TEST
659     global tmpdir
660     global runtests
661
662     # Make opts into an array.
663     set opts(_) x
664     unset opts(_)
665     foreach item $exec_args {
666         set opts($item) x
667     }
668
669     # If we need threads and we don't have them then set the `no-exec'
670     # flag.  This is case is also handled specially later.
671     if {[info exists opts(need-threads)]} {
672         global libjava_uses_threads
673         if {! $libjava_uses_threads} {
674             set opts(no-exec) x
675         }
676     }
677
678     set errname [file rootname [file tail $srcfile]]
679     if {! [runtest_file_p $runtests $errname]} {
680         return
681     }
682
683     if {[info exists opts(no-link)]} {
684         set mode compile
685     } else {
686         set mode link
687     }
688     set args [libjava_arguments $mode]
689     if {! [info exists opts(no-link)]} {
690         # Add the --main flag
691         lappend args "additional_flags=--main=[file rootname [file tail $srcfile]]"
692         if { $compile_args != "" } {
693             lappend args "additional_flags=$compile_args"
694         }
695     }
696
697     regsub "^.*/(\[^/.\]+)\[.\]\[^/]*$" "$srcfile" "\\1" out
698     set executable "${objdir}/$out"
699     if {[info exists opts(no-link)]} {
700         append executable ".o"
701         set target object
702     } else {
703         # DOS/win32 targets default to .exe if no suffix is given
704         # We then try to delete a file that doesn't exist.  It is
705         # simpler to add the suffix everywhere.
706         append executable ".exe"
707         set target executable
708     }
709     if { $compile_args != "" } {
710         set errname "$errname $compile_args"
711     }
712
713     set removeList [list $executable]
714
715     set x [libjava_prune_warnings \
716              [libjava_tcompile $srcfile "$executable" $target $args]]
717     if {[info exists opts(xfail-gcj)]} {
718         setup_xfail *-*-*
719     }
720     if { $x != "" } {
721         verbose "target_compile failed: $x" 2
722
723         if {[info exists opts(shouldfail)]} {
724             pass "$errname compilation from source"
725             eval gcj_cleanup $removeList
726             return
727         }
728
729         fail "$errname compilation from source"
730         if {[info exists opts(xfail-gcj)]
731             || ! [info exists opts(no-exec)]
732             || [info exists opts(need-threads)]} {
733             untested "$errname execution from source compiled test"
734             untested "$errname output from source compiled test"
735         }
736         return
737     }
738     if {[info exists opts(shouldfail)]} {
739         fail "$errname compilation from source"
740         return
741     }
742     pass "$errname compilation from source"
743
744     # Set up the options the way they are expected by libjava_invoke.
745     if {[info exists opts(xfail-source-output)]} {
746         set opts(xfail-output) x
747     }
748     if {[libjava_invoke $errname "source compiled test" opts $executable \
749            $inpfile $resultfile ""]} {
750         # Everything ok, so clean up.
751         eval gcj_cleanup $removeList
752     }
753 }
754
755 #
756 # Run the test specified by srcfile and resultfile. compile_args and
757 # exec_args are options telling this proc how to work.
758 #   `no-link'     don't try to link the program
759 #   `no-exec'     don't try to run the test
760 #   `xfail-gcj'   compilation from source will fail
761 #   `xfail-javac' compilation with javac will fail
762 #   `xfail-gcjC'  compilation with gcj -C will fail
763 #   `shouldfail'  compilation from source is supposed to fail
764 #                 This is different from xfail, which marks a known
765 #                 failure that we just haven't fixed.
766 #                 A compilation marked this way should fail with any
767 #                 front end.
768 #   `xfail-byte'  compilation from bytecode will fail
769 #   `xfail-exec'  exec will fail
770 #   `xfail-output'
771 #                 output will be wrong
772 #   `xfail-byte-output'
773 #                 output will be wrong when compiled from bytecode
774 #   `xfail-source-output'
775 #                 output will be wrong when compiled from source code
776 #   `need-threads'
777 #                 test relies on thread support
778 #
779 proc test_libjava { options srcfile compile_args inpfile resultfile exec_args } {
780     test_libjava_from_source $options $srcfile $compile_args $inpfile $resultfile $exec_args
781
782     # Test BC-ABI compilation.
783     set compile_args_bcabi $compile_args
784     lappend compile_args_bcabi "-findirect-dispatch"
785     test_libjava_from_source $options $srcfile $compile_args_bcabi $inpfile $resultfile $exec_args
786 }
787
788 #
789 # libjava_version -- extract and print the version number of libjavap
790 #
791 proc default_libjava_version {} {
792 }
793
794 proc default_libjava_start { } {
795 }
796
797 # Local Variables:
798 # tcl-indent-level:4
799 # End: