summaryrefslogtreecommitdiffstats
path: root/libjava
diff options
context:
space:
mode:
authorkseitz <kseitz@138bc75d-0d04-0410-961f-82ee72b054a4>2006-09-19 23:28:29 +0000
committerkseitz <kseitz@138bc75d-0d04-0410-961f-82ee72b054a4>2006-09-19 23:28:29 +0000
commitaea6bed72c89f8bf7e06fc1933f5b8d635366ccf (patch)
tree998d3799d25291b60f5bab09380d30f7fa49a05a /libjava
parent308909af5be9623f8d17c47420c5b642aa85524a (diff)
downloadppe42-gcc-aea6bed72c89f8bf7e06fc1933f5b8d635366ccf.tar.gz
ppe42-gcc-aea6bed72c89f8bf7e06fc1933f5b8d635366ccf.zip
* testsuite/libjava.jvmti/jvmti.exp: New file.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117065 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog4
-rw-r--r--libjava/testsuite/libjava.jvmti/jvmti.exp122
2 files changed, 126 insertions, 0 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 4dd7bacb68a..222fc79f0e7 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,5 +1,9 @@
2006-09-19 Keith Seitz <keiths@redhat.com>
+ * testsuite/libjava.jvmti/jvmti.exp: New file.
+
+2006-09-19 Keith Seitz <keiths@redhat.com>
+
* jvmti.cc (THREAD_DEFAULT_TO_CURRENT): Clarify parameter list.
(THREAD_CHECK_VALID): Likewise.
(THREAD_CHECK_ALIVE): Likewise.
diff --git a/libjava/testsuite/libjava.jvmti/jvmti.exp b/libjava/testsuite/libjava.jvmti/jvmti.exp
new file mode 100644
index 00000000000..18be872741b
--- /dev/null
+++ b/libjava/testsuite/libjava.jvmti/jvmti.exp
@@ -0,0 +1,122 @@
+# 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.."
+ # 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"
+
+ 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} {
+ set gcjh [find_gcjh]
+ set jvscan [find_jvscan]
+
+ set class_out [string trim \
+ [libjava_prune_warnings \
+ [lindex [local_exec "$jvscan --encoding=UTF-8 $file --list-class" "" "" 300] 1]]]
+ if {[string match "*parse error*" $class_out]} {
+ fail "$file header generation"
+ return 0
+ }
+
+ foreach file [split $class_out] {
+ set x [string trim [libjava_prune_warnings \
+ [lindex [local_exec "$gcjh $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}/*.java] } srcfiles
+
+ foreach x $srcfiles {
+ gcj_jvmti_test_one $x
+ }
+ } else {
+ verbose "JVMTI tests not run in cross-compilation environment"
+ }
+}
+
+gcj_jvmti_run
OpenPOWER on IntegriCloud