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