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]

Patch: FYI: verifier test suite


I'm checking this in on the trunk.

This adds preliminary support for the mauve verifier tests to the
libgcj test suite.


With the recent licensing discussions, maybe I won't be importing the
verifier tests after all.  So maybe the contents of README.verify will
have to change.  I'll find out.

Tom

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

	* libjava.verify/verify.exp: New file.
	* libjava.verify/README.verify: New file.

Index: libjava.verify/README.verify
===================================================================
RCS file: libjava.verify/README.verify
diff -N libjava.verify/README.verify
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ libjava.verify/README.verify 11 Jul 2003 22:21:15 -0000
@@ -0,0 +1,10 @@
+The verifier tests come from Mauve.
+See http://sources.redhat.com/mauve
+
+You want the "verify" module in the Mauve cvs repository.
+
+In Mauve, only the sources are checked in.  However, these need
+jasmin to be compiled to bytecode.  Since jasmin would require either
+another VM or gcj itself to already be working and installed (just to
+compile it), we've chose to precompile all the .j files to .class
+files and then import the result.
Index: libjava.verify/verify.exp
===================================================================
RCS file: libjava.verify/verify.exp
diff -N libjava.verify/verify.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ libjava.verify/verify.exp 11 Jul 2003 22:21:15 -0000
@@ -0,0 +1,81 @@
+# Tests for class verifier.
+
+global gcj_verify_xfail
+set gcj_verify_xfail("gij verify of call.fail.Static") 1
+set gcj_verify_xfail("gij verify of simple.fail.dupfield") 1
+set gcj_verify_xfail("gij verify of simple.fail.dupinterface") 1
+set gcj_verify_xfail("gij verify of simple.fail.dupmethod") 1
+set gcj_verify_xfail("gij verify of subr.fail.jsr10") 1
+set gcj_verify_xfail("gij verify of subr.fail.jsr8") 1
+
+
+proc gcj_verify_list_tests {srcdir} {
+  set result {}
+  set here [pwd]
+  cd $srcdir
+  foreach item [lsort [glob -nocomplain */*/*.class]] {
+    lappend result [file rootname $item]
+  }
+  cd $here
+  return $result
+}
+
+proc gcj_verify_test_gij {gij srcdir test shouldfail} {
+  global gcj_verify_xfail
+
+  set testname "gij verify of $test"
+  verbose "invoking gij $test  - shouldfail=$shouldfail"
+  set result [libjava_load $gij [list --cp $srcdir $test] ""]
+  set status [lindex $result 0]
+  set output [lindex $result 1]
+
+  if {$shouldfail} {
+    # We match the few exceptions that are allowed.  This may need
+    # updating from time to time.  We do this rather than check the
+    # exit status because we want to catch the case where gij dies in
+    # some inappropriate way.
+    if {[string match *VerifyError* $output]
+	|| [string match *AbstractMethodError* $output]
+	|| [string match *IncompatibleClassChangeError* $output]} {
+      set cmd pass
+    } else {
+      set cmd fail
+    }
+    if {[info exists gcj_verify_xfail($testname)]} {
+      setup_xfail *-*-*
+    }
+  } else {
+    if {$status == "pass"} {
+      set cmd pass
+    } else {
+      set cmd fail
+    }
+  }
+  $cmd $testname
+}
+
+proc gcj_verify_run {} {
+  global INTERPRETER srcdir
+
+  set gij [libjava_find_gij] 
+  set interpret 1
+  # libjava_find_gij will return `gij' if it couldn't find the
+  # program; in this case we want to skip the test.
+  if {$INTERPRETER != "yes" || $gij == "gij"} {
+    set interpret 0
+  }
+
+  set testsdir $srcdir/libjava.verify/verify
+  foreach test [gcj_verify_list_tests $testsdir] {
+    set shouldfail [string match */fail/* $test]
+
+    if {$interpret} {
+      regsub -all -- / $test . gijname
+      gcj_verify_test_gij $gij $testsdir $gijname $shouldfail
+    }
+
+    # FIXME: run gcj --syntax-only here.
+  }
+}
+
+gcj_verify_run


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