Fix expected messages in test
[official-gcc.git] / libjava / testsuite / libjava.jvmti / jvmti.exp
blob571952e807cf3a470d63325be1bd79dfd964b474
1 # Tests for JVMTI code.
3 # Compile a single C++ file and produce a .o file. OPTIONS is a list
4 # of options to pass to the compiler. Returns 0 on failure, 1 on
5 # success.
6 proc gcj_jvmti_compile_cxx_to_o {file {options {}}} {
7 global srcdir
8 global objdir
10 set name [file rootname [file tail $file]]
11 set oname ${name}.o
13 # Find the generated header.
14 lappend options "additional_flags=-g -I. -I.. -fdollars-in-identifiers"
15 # Find libgcj headers.
16 lappend options "additional_flags=-I$srcdir/.."
17 # Find jvmti.h, jvmti_md.h, jvmti-int.h, jvm.h requirements
18 lappend options "additional_flags=-I$srcdir/../include -I$srcdir/../classpath/include -I$objdir/../include -I$objdir/../../boehm-gc/include "
19 # ARM C++ emits an ABI warning for varargs.
20 if { [istarget "arm*"] } {
21 lappend options "additional_flags=-Wno-abi"
24 set x [libjava_prune_warnings \
25 [target_compile $file $oname object $options]]
26 if {$x != ""} {
27 verbose "target_compile failed: $x" 2
28 fail "[file tail $file] compilation"
29 return 0
32 pass "[file tail $file] compilation"
33 return 1
36 # Build header files given name of .java file. Return 0 on failure.
37 proc gcj_jvmti_build_headers {file} {
38 global libgcj_jar
40 set gcjh [find_gcjh]
42 # Currently we only build a header file for the main class from the
43 # .java file. If we need more than this, we'll have to figure
44 # something out.
45 set file [file rootname [file tail $file]]
47 set x [string trim [libjava_prune_warnings \
48 [lindex [local_exec "$gcjh -cni -force -classpath .:$libgcj_jar $file" "" "" 300] 1]]]
49 if {$x != ""} {
50 verbose "local_exec failed: $x" 2
51 fail "$file header generation"
52 return 0
55 pass "$file header generation"
56 return 1
59 # Do all the work for a single JVMTI test. Return 0 on failure.
60 proc gcj_jvmti_test_one {file} {
61 global runtests
63 # The base name. We use it for several purposes.
64 set main [file rootname [file tail $file]]
65 if {! [runtest_file_p $runtests $main]} {
66 # Simply skip it.
67 return 1
70 # if {! [bytecompile_file $file [pwd]]} {
71 # fail "bytecompile $file"
72 # # FIXME - should use `untested' on all remaining tests.
73 # # But that is hard.
74 # return 0
75 # }
76 # pass "bytecompile $file"
78 # if {! [gcj_jvmti_build_headers $file]} {
79 # # FIXME
80 # return 0
81 # }
83 set cfile [file join [file dirname $file] nat$main.cc]
84 if {! [gcj_jvmti_compile_cxx_to_o $cfile]} {
85 # FIXME
86 return 0
89 if {! [gcj_link $main $main [list $file nat$main.o]]} {
90 # FIXME
91 return 0
94 if {! [gcj_invoke $main [file rootname $file].out {}]} {
95 # FIXME
96 return 0
99 # When we succeed we remove all our clutter.
100 eval gcj_cleanup [glob -nocomplain -- ${main}.*] [list $main nat$main.o]
102 return 1
105 # Run the JVMTI tests.
106 proc gcj_jvmti_run {} {
107 global srcdir subdir
108 global build_triplet host_triplet
110 # For now we only test JVMTI on native builds.
111 if {$build_triplet == $host_triplet} {
112 catch { lsort [glob -nocomplain ${srcdir}/${subdir}/*.jar] } srcfiles
114 foreach x $srcfiles {
115 gcj_jvmti_test_one $x
117 } else {
118 verbose "JVMTI tests not run in cross-compilation environment"
122 gcj_jvmti_run