This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[ecj] Patch: FYI: fix test suite for ecj-less build


I'm checking this in on gcj-eclipse-merge branch.

This adds all the .jar and .h files needed for the test suite, and
updates the .exp files themselves to use these.

This makes it possible to 'make check' gcj without having a working
ecj1.

In the future all new tests must be accompanied by the corresponding
generated files.

I've omitted the jar and header files from the patch.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* testsuite/*: Added many .jar and .h files.
	* testsuite/libjava.special/special.exp
	(gcj_special_try_compiler): New proc.
	* testsuite/libjava.loader/loader.exp (gcj_loader_run): Don't
	bytecompile source.  Search for .jar files.
	(gcj_loader_test_one): Don't look for MyLoader.java.
	* testsuite/libjava.jvmti/jvmti.exp (gcj_jvmti_test_one): Don't
	bytecompile sources or build headers.
	(gcj_jvmti_run): Look for .jar files.
	* testsuite/libjava.jni/jni.exp (gcj_jni_run): Compile .jar
	files.
	(gcj_jni_test_one): Don't bytecompile sources or build headers.
	Set classpath when invoking gij.
	(gcj_jni_invocation_test_one): Likewise.
	* testsuite/libjava.cni/cni.exp (gcj_cni_test_one): Don't build
	headers or bytecompile sources.
	(gcj_cni_run): Use .jar files, not .java files.
	* testsuite/libjava.lang/lang.exp: Compile .jar files.

Index: testsuite/libjava.cni/cni.exp
===================================================================
--- testsuite/libjava.cni/cni.exp	(revision 120150)
+++ testsuite/libjava.cni/cni.exp	(working copy)
@@ -69,18 +69,18 @@
     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 {! [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_cni_build_headers $file]} {
-    # FIXME
-    return 0
-  }
+#   if {! [gcj_cni_build_headers $file]} {
+#     # FIXME
+#     return 0
+#   }
 
   set cfile [file join [file dirname $file] nat$main.cc]
   if {! [gcj_cni_compile_cxx_to_o $cfile]} {
@@ -111,7 +111,7 @@
 
   # For now we only test CNI on native builds.
   if {$build_triplet == $host_triplet} {
-    catch { lsort [glob -nocomplain ${srcdir}/${subdir}/*.java] } srcfiles
+    catch { lsort [glob -nocomplain ${srcdir}/${subdir}/*.jar] } srcfiles
 
     foreach x $srcfiles {
       gcj_cni_test_one $x
Index: testsuite/libjava.jvmti/jvmti.exp
===================================================================
--- testsuite/libjava.jvmti/jvmti.exp	(revision 120082)
+++ testsuite/libjava.jvmti/jvmti.exp	(working copy)
@@ -63,18 +63,18 @@
     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 {! [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
-  }
+#   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]} {
@@ -105,7 +105,7 @@
 
   # For now we only test JVMTI on native builds.
   if {$build_triplet == $host_triplet} {
-    catch { lsort [glob -nocomplain ${srcdir}/${subdir}/*.java] } srcfiles
+    catch { lsort [glob -nocomplain ${srcdir}/${subdir}/*.jar] } srcfiles
 
     foreach x $srcfiles {
       gcj_jvmti_test_one $x
Index: testsuite/libjava.special/special.exp
===================================================================
--- testsuite/libjava.special/special.exp	(revision 120082)
+++ testsuite/libjava.special/special.exp	(working copy)
@@ -1,5 +1,10 @@
 # Special test cases.  These require tricky build procedures.
 
+proc gcj_special_try_compiler {} {
+  global srcdir subdir
+  return [bytecompile_file ${srcdir}/${subdir}/pr21115I.java [pwd]]
+}
+
 proc gcj_special_pr21115 {} {
   global srcdir subdir env
 
@@ -94,5 +99,10 @@
   return 1
 }
 
-gcj_special_pr21115
-gcj_special_lazy_illegal_access
+# For these tests it is simpler to require that gcj work.  So we try
+# the compiler and if it fails, we simply skip the tests.
+
+if {[gcj_special_try_compiler]} {
+  gcj_special_pr21115
+  gcj_special_lazy_illegal_access
+}
Index: testsuite/libjava.jni/jni.exp
===================================================================
--- testsuite/libjava.jni/jni.exp	(revision 120082)
+++ testsuite/libjava.jni/jni.exp	(working copy)
@@ -4,7 +4,7 @@
 # of options to pass to the compiler.  Returns 0 on failure, 1 on
 # success.
 proc gcj_jni_compile_c_to_so {file {options {}}} {
-  global srcdir
+  global srcdir subdir
   global host_triplet
   verbose "options: $options"
   set options_cxx $options
@@ -31,7 +31,7 @@
 
   lappend options "additional_flags=${so_flag} -fPIC"
   # Find the generated header.
-  lappend options "additional_flags=-I. -I.."
+  lappend options "additional_flags=-I. -I.. -I$srcdir/$subdir"
 
   # Ensure that the generated header has correct prototypes.
   set cfile [file rootname $file].c
@@ -106,19 +106,19 @@
     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 {! [bytecompile_file $file [pwd]]} {
+#     fail "bytecompile $file"
+#     # FIXME - should use `untested' on all remaining tests.
+#     # But that is hard.
+#     return 0
+#   }
+#   pass "bytecompile $file"
 
-  set bytefile [file rootname [file tail $file]].class
-  if {! [gcj_jni_build_header $bytefile]} {
-    # FIXME
-    return 0
-  }
+#   set bytefile [file rootname [file tail $file]].class
+#   if {! [gcj_jni_build_header $bytefile]} {
+#     # FIXME
+#     return 0
+#   }
 
   set cfile [file rootname $file].c
   set cxxflags ""
@@ -186,7 +186,8 @@
   # cxxldlibflags to libjava_invoke.
   if {$INTERPRETER == "yes" && $gij != ""} {
     libjava_invoke $errname "gij test" opts $gij \
-      "" $resultfile $cxxldlibflags $main
+      "" $resultfile $cxxldlibflags \
+      -classpath $file $main
   }
 
   # When we succeed we remove all our clutter.
@@ -200,7 +201,7 @@
 # options to pass to the compiler.  Returns 0 on failure, 1 on
 # success.
 proc gcj_jni_invocation_compile_c_to_binary {file {options {}}} {
-  global srcdir
+  global srcdir subdir
   global host_triplet
   verbose "options: $options"
   set options_cxx $options
@@ -214,7 +215,7 @@
       lappend options "additional_flags= -bind_at_load -multiply_defined suppress"
   }
   # Find the generated header.
-  lappend options "additional_flags=-I. -I.."
+  lappend options "additional_flags=-I. -I.. -I$srcdir/$subdir"
 
   # Find jni.h and jni_md.h.
   lappend options "additional_flags=-I$srcdir/../include -I$srcdir/../classpath/include"
@@ -237,6 +238,7 @@
 # Do all the work for a single invocation API test.  Return 0 on
 # failure.
 proc gcj_jni_invocation_test_one {file} {
+  global env
   global runtests
   global host_triplet
   global INTERPRETER
@@ -248,13 +250,13 @@
     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 {! [bytecompile_file $file [pwd]]} {
+#     fail "bytecompile $file"
+#     # FIXME - should use `untested' on all remaining tests.
+#     # But that is hard.
+#     return 0
+#   }
+#   pass "bytecompile $file"
 
   set cfile [file rootname $file].c
   # Darwin needs -liconv linked, otherwise we get some unresolved.
@@ -287,10 +289,14 @@
 
   set resultfile [file rootname $file].out
 
+  set env(CLASSPATH) $file
+  verbose "CLASSPATH = $env(CLASSPATH)"
   if {! [gcj_invoke $main $resultfile ""]} {
+    unset env(CLASSPATH)
     # FIXME
     return 0
   }
+  unset env(CLASSPATH)
 
   # We purposely ignore errors here; we still want to run the other
   # appropriate tests.
@@ -310,14 +316,14 @@
 
   # For now we only test JNI on native builds.
   if {$build_triplet == $host_triplet} {
-    catch { lsort [glob -nocomplain ${srcdir}/${subdir}/*.java] } srcfiles
+    catch { lsort [glob -nocomplain ${srcdir}/${subdir}/*.jar] } srcfiles
 
     foreach x $srcfiles {
       gcj_jni_test_one $x
     }
 
     # Run JNI invocation API tests
-    catch { lsort [glob -nocomplain ${srcdir}/${subdir}/invocation/*.java] } srcfiles
+    catch { lsort [glob -nocomplain ${srcdir}/${subdir}/invocation/*.jar] } srcfiles
 
     foreach x $srcfiles {
       gcj_jni_invocation_test_one $x
Index: testsuite/libjava.lang/lang.exp
===================================================================
--- testsuite/libjava.lang/lang.exp	(revision 120082)
+++ testsuite/libjava.lang/lang.exp	(working copy)
@@ -26,8 +26,8 @@
 
     verbose "inpfile is $inpfile"
 
-    test_libjava $options "${prefix}.java" "" $inpfile $resfile $args
-    test_libjava $options "${prefix}.java" "-O3" $inpfile $resfile $args
+    test_libjava $options "${prefix}.jar" "" $inpfile $resfile $args
+    test_libjava $options "${prefix}.jar" "-O3" $inpfile $resfile $args
 }
 
 # Local Variables:
Index: testsuite/libjava.loader/loader.exp
===================================================================
--- testsuite/libjava.loader/loader.exp	(revision 120082)
+++ testsuite/libjava.loader/loader.exp	(working copy)
@@ -21,7 +21,7 @@
 
   set errname [file rootname [file tail $srcfile]]
   set args [libjava_arguments link]
-  lappend args "additional_flags=--main=[file rootname [file tail $srcfile]] $srcdir/$subdir/MyLoader.java $objdir/[gcj_object_file_name $args dummy]"
+  lappend args "additional_flags=--main=[file rootname [file tail $srcfile]] [gcj_object_file_name $args dummy]"
   set x [libjava_prune_warnings \
 	     [libjava_tcompile $srcfile "$executable" executable $args]]
 
@@ -45,17 +45,17 @@
   global build_triplet host_triplet
   global GCJ_UNDER_TEST
 
-  set file "${srcdir}/${subdir}/dummy.java"
-  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"
+#   set file "${srcdir}/${subdir}/dummy.java"
+#   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"
 
   set args [libjava_arguments compile]
-  lappend args "additional_flags=--resource $objdir/dummy.class"
+  lappend args "additional_flags=--resource $srcdir/$subdir/dummy.class"
   set x [libjava_prune_warnings \
 	   [libjava_tcompile "$objdir/dummy.class" "$objdir/[gcj_object_file_name $args dummy]" object $args]]
 
@@ -67,7 +67,7 @@
     }
   pass "resource compilation: dummy.class"
 
-  catch { lsort [glob -nocomplain ${srcdir}/${subdir}/Test*.java] } srcfiles
+  catch { lsort [glob -nocomplain ${srcdir}/${subdir}/Test*.jar] } srcfiles
 
   foreach x $srcfiles {
     gcj_loader_test_one $x


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]