Merge
authorlana
Tue, 13 Apr 2010 16:42:58 -0700
changeset 5221 8d57da0c20f6
parent 5212 6bc51ee52f13 (current diff)
parent 5220 1386e31a7fd0 (diff)
child 5222 a430c36e9f2c
Merge
langtools/test/tools/javap/T6305779.java
--- a/langtools/make/Makefile	Thu Apr 08 17:03:01 2010 -0700
+++ b/langtools/make/Makefile	Tue Apr 13 16:42:58 2010 -0700
@@ -188,10 +188,16 @@
 # All ant targets of interest
 ANT_TARGETS = build clean sanity post-sanity diagnostics # for now
 
+# Create diagnostics log (careful, ant 1.8.0 -diagnostics always does an exit 1)
+$(OUTPUTDIR)/build/ant-diagnostics.log:
+	@mkdir -p $(OUTPUTDIR)/build $(ANT_TMPDIR)
+	@$(RM) $@
+	$(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -diagnostics > $@ ; \
+	  $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -version >> $@
+
 # Create a make target for each
-$(ANT_TARGETS):
+$(ANT_TARGETS): $(OUTPUTDIR)/build/ant-diagnostics.log
 	@ mkdir -p $(OUTPUTDIR)/build $(ANT_TMPDIR)
-	$(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -diagnostics > $(OUTPUTDIR)/build/ant-diagnostics.log
 	$(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) $(ANT_OPTIONS) $@
 
 #-------------------------------------------------------------------
--- a/langtools/make/jprt.properties	Thu Apr 08 17:03:01 2010 -0700
+++ b/langtools/make/jprt.properties	Tue Apr 13 16:42:58 2010 -0700
@@ -50,6 +50,5 @@
 jprt.test.targets=
 
 # Directories needed to build
-jprt.bundle.src.dirs=make src
 jprt.bundle.exclude.src.dirs=build dist
 
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java	Thu Apr 08 17:03:01 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java	Tue Apr 13 16:42:58 2010 -0700
@@ -229,23 +229,24 @@
             if (kind == ENUM) {
                 List<Element> enclosedElements =
                     new ArrayList<Element>(e.getEnclosedElements());
+                // Handle any enum constants specially before other entities.
                 List<Element> enumConstants = new ArrayList<Element>();
                 for(Element element : enclosedElements) {
                     if (element.getKind() == ENUM_CONSTANT)
                         enumConstants.add(element);
                 }
-
-                int i;
-                for(i = 0; i < enumConstants.size()-1; i++) {
+                if (!enumConstants.isEmpty()) {
+                    int i;
+                    for(i = 0; i < enumConstants.size()-1; i++) {
+                        this.visit(enumConstants.get(i), true);
+                        writer.print(",");
+                    }
                     this.visit(enumConstants.get(i), true);
-                    writer.print(",");
-                }
-                if (i >= 0 ) {
-                    this.visit(enumConstants.get(i), true);
-                    writer.print(";");
+                    writer.println(";\n");
+
+                    enclosedElements.removeAll(enumConstants);
                 }
 
-                enclosedElements.removeAll(enumConstants);
                 for(Element element : enclosedElements)
                     this.visit(element);
             } else {
--- a/langtools/src/share/classes/com/sun/tools/javah/JavahTask.java	Thu Apr 08 17:03:01 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javah/JavahTask.java	Tue Apr 13 16:42:58 2010 -0700
@@ -318,12 +318,6 @@
     int run(String[] args) {
         try {
             handleOptions(args);
-            if (classes == null || classes.size() == 0) {
-                if (help || version || fullVersion)
-                    return 0;
-                else
-                    return 1;
-            }
             boolean ok = run();
             return ok ? 0 : 1;
         } catch (BadArgs e) {
@@ -355,7 +349,7 @@
             fileManager = getDefaultFileManager(diagnosticListener, log);
 
         Iterator<String> iter = args.iterator();
-        boolean noArgs = !iter.hasNext();
+        noArgs = !iter.hasNext();
 
         while (iter.hasNext()) {
             String arg = iter.next();
@@ -416,9 +410,9 @@
 
         Util util = new Util(log, diagnosticListener);
 
-        if (help) {
+        if (noArgs || help) {
             showHelp();
-            return true;
+            return help; // treat noArgs as an error for purposes of exit code
         }
 
         if (version || fullVersion) {
@@ -636,6 +630,7 @@
     String usercp;
     List<String> classes;
     boolean verbose;
+    boolean noArgs;
     boolean help;
     boolean trace;
     boolean version;
--- a/langtools/src/share/classes/com/sun/tools/javap/ClassWriter.java	Thu Apr 08 17:03:01 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javap/ClassWriter.java	Tue Apr 13 16:42:58 2010 -0700
@@ -225,15 +225,15 @@
         writeModifiers(flags.getFieldModifiers());
         Signature_attribute sigAttr = getSignature(f.attributes);
         if (sigAttr == null)
-            print(getFieldType(f.descriptor));
+            print(getJavaFieldType(f.descriptor));
         else {
             try {
                 Type t = sigAttr.getParsedSignature().getType(constant_pool);
-                print(t);
+                print(getJavaName(t.toString()));
             } catch (ConstantPoolException e) {
                 // report error?
                 // fall back on non-generic descriptor
-                print(getFieldType(f.descriptor));
+                print(getJavaFieldType(f.descriptor));
             }
         }
         print(" ");
@@ -314,14 +314,14 @@
         }
         if (getName(m).equals("<init>")) {
             print(getJavaName(classFile));
-            print(getParameterTypes(d, flags));
+            print(getJavaParameterTypes(d, flags));
         } else if (getName(m).equals("<clinit>")) {
             print("{}");
         } else {
-            print(getReturnType(d));
+            print(getJavaReturnType(d));
             print(" ");
             print(getName(m));
-            print(getParameterTypes(d, flags));
+            print(getJavaParameterTypes(d, flags));
         }
 
         Attribute e_attr = m.attributes.get(Attribute.Exceptions);
@@ -460,9 +460,9 @@
         }
     }
 
-    String getFieldType(Descriptor d) {
+    String getJavaFieldType(Descriptor d) {
         try {
-            return d.getFieldType(constant_pool);
+            return getJavaName(d.getFieldType(constant_pool));
         } catch (ConstantPoolException e) {
             return report(e);
         } catch (DescriptorException e) {
@@ -470,9 +470,9 @@
         }
     }
 
-    String getReturnType(Descriptor d) {
+    String getJavaReturnType(Descriptor d) {
         try {
-            return d.getReturnType(constant_pool);
+            return getJavaName(d.getReturnType(constant_pool));
         } catch (ConstantPoolException e) {
             return report(e);
         } catch (DescriptorException e) {
@@ -480,9 +480,9 @@
         }
     }
 
-    String getParameterTypes(Descriptor d, AccessFlags flags) {
+    String getJavaParameterTypes(Descriptor d, AccessFlags flags) {
         try {
-            return adjustVarargs(flags, d.getParameterTypes(constant_pool));
+            return getJavaName(adjustVarargs(flags, d.getParameterTypes(constant_pool)));
         } catch (ConstantPoolException e) {
             return report(e);
         } catch (DescriptorException e) {
--- a/langtools/test/Makefile	Thu Apr 08 17:03:01 2010 -0700
+++ b/langtools/test/Makefile	Tue Apr 13 16:42:58 2010 -0700
@@ -1,6 +1,20 @@
 #
-# Makefile to run jtreg and any other tests
+# Makefile to run jtreg and other tests
+#
+
+# Product builds and langtools builds
+#
+# A full product build (or "control" build) creates a complete JDK image.
+# To test a product build, set TESTJAVA to the path for the image.
 #
+# A langtools build just builds the langtools components of a JDK. 
+# To test a langtools build, set TESTJAVA to the path for a recent JDK
+# build, and set TESTBOOTCLASSPATH to the compiled langtools classes --
+# for example build/classes or dist/lib/classes.jar.
+
+# JPRT
+# JPRT may invoke this Makefile directly, as part of a langtools build,
+# or indirectly, via FOREST/test/Makefile, as part of a control build.
 
 # Get OS/ARCH specifics
 OSNAME = $(shell uname -s)
@@ -41,8 +55,11 @@
 # Root of this test area (important to use full paths in some places)
 TEST_ROOT := $(shell pwd)
 
-# Default bundle of all test results (passed or not)
-JPRT_ARCHIVE_BUNDLE=$(TEST_ROOT)/JPRT_ARCHIVE_BUNDLE.zip
+# Default bundle of all test results (passed or not) (JPRT only)
+ifdef JPRT_JOB_ID
+  JPRT_CLEAN = clean
+  JPRT_ARCHIVE_BUNDLE = $(TEST_ROOT)/JPRT_ARCHIVE_BUNDLE.zip
+endif
 
 ifeq ($(PLATFORM), windows)
   SLASH_JAVA = J:
@@ -57,8 +74,21 @@
   JTREG_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg
 endif
 JTREG = $(JTREG_HOME)/$(JT_PLATFORM)/bin/jtreg
+JTDIFF = $(JTREG_HOME)/$(JT_PLATFORM)/bin/jtdiff
 
-# Default JDK for JTREG
+# Default JCK to run
+ifdef JPRT_JCK_HOME
+  JCK_HOME = $(JPRT_JCK_HOME)
+else
+  JCK_HOME = $(SLASH_JAVA)/re/jck/7/promoted/latest/binaries
+endif
+
+# Default JDK for JTREG and JCK
+#
+# JT_JAVA is the version of java used to run jtreg/JCK. Since it is now
+# standard to execute tests in sameVM mode, it should normally be set the
+# same as TESTJAVA (although not necessarily so.)
+#
 ifdef JPRT_JAVA_HOME
   JT_JAVA = $(JPRT_JAVA_HOME)
 else
@@ -72,49 +102,275 @@
   TESTJAVA = $(SLASH_JAVA)/re/jdk/1.7.0/promoted/latest/binaries/$(PLATFORM)-$(ARCH)
 endif
 
-TESTBOOTCLASSPATH = $(PRODUCT_HOME)/dist/lib/classes.jar
+# PRODUCT_HOME is a JPRT variable pointing to a directory containing the output from 
+# make/Makefile
+# For langtools, this is a directory containing build and dist
+# For a control build, this is build/$(PRODUCT)-$(ARCH)/j2sdk-image
+ifdef PRODUCT_HOME
+  ifeq ($(shell [ -r $(PRODUCT_HOME)/dist/lib/classes.jar ]; echo $$?),0)
+    TESTBOOTCLASSPATH = $(PRODUCT_HOME)/dist/lib/classes.jar
+  endif
+  ifeq ($(shell [ -r $(PRODUCT_HOME)/lib/tools.jar ]; echo $$?),0)
+    TESTJAVA = $(PRODUCT_HOME)
+  endif
+endif
+
+ifdef TESTBOOTCLASSPATH
+  JTREG_OPTIONS += -Xbootclasspath/p:$(TESTBOOTCLASSPATH)
+### In the following, -refvmoptions is an undocumented option
+### The following does not work JCK 7 b30 2/6/2010. Awaiting b31. 
+  JCK_OPTIONS += \
+	-vmoptions:-Xbootclasspath/p:$(TESTBOOTCLASSPATH) \
+	-refvmoptions:-Xbootclasspath/p:$(TESTBOOTCLASSPATH)
+endif
+
+# Concurrency is the number of tests that can execute at once. 
+# Supported for JCK, not supported for jtreg.
+# On an otherwise empty machine, suggest setting to (#cpus + 2)
+# If unset, the default is (#cpus)
+### RFE: determine and use #cpus
+ifdef JCK_CONCURRENCY
+  JCK_OPTIONS += -concurrency:$(JCK_CONCURRENCY)
+endif
+
+# JCK is executed using "Multi-JVM Group Mode", which is a hybrid
+# of otherVM and sameVM modes. New JVMs are created and reused for
+# a number of tests, then eventually discarded and a new one started.
+# This amortizes the JVM startup time.  The "group size" defines
+# how many tests are run in a JVM before it is replaced.
+# If unset, the default is 100.
+JCK_GROUP_SIZE = 1000
+ifdef JCK_GROUP_SIZE
+  JCK_COMPILER_OPTIONS += \
+    -jtoptions:-Ejck.env.compiler.testCompile.groupMode.groupSize=$(JCK_GROUP_SIZE) \
+    -jtoptions:-Ejck.env.compiler.compRefExecute.groupMode.groupSize=$(JCK_GROUP_SIZE)
+### The following is not supported. Awaiting RFE 6924287
+### 6924287: Jck4Jdk: Allow to configure test group size for group mode via simple command line option
+###  JCK_RUNTIME_OPTIONS += \
+###    -jtoptions:-Ejck.env.runtime.testCompile.groupMode.groupSize=$(JCK_GROUP_SIZE)
+endif
+
+# Assertions: some tests show failures when assertions are enabled.
+# Since javac is typically loaded via the bootclassloader (either via TESTJAVA
+# or TESTBOOTCLASSPATH), you may need -esa to enable assertions in javac.
+JTREG_OPTIONS += $(ASSERTION_OPTIONS)
+JCK_OPTIONS += $(ASSERTION_OPTIONS:%=-vmoptions:%)
+
+# Include shared options
+JCK_COMPILER_OPTIONS += $(JCK_OPTIONS)
+JCK_RUNTIME_OPTIONS += $(JCK_OPTIONS)
+
+# Exit codes:
+# jtreg, jck:   0: OK, 1: tests failed, 2: tests error; 3+: SERIOUS
+FATAL_JTREG_EXIT = 3
+FATAL_JCK_EXIT = 3
+# jtdiff: 0: OK, 1: differences found; 2+: SERIOUS
+FATAL_JTDIFF_EXIT = 2
+#
+# Exit -- used for final "normal" exit from "make". Redefine to "true" to avoid
+# having make exit with non-zero return code.
+EXIT = exit
+# Function to exit shell if exit code of preceding command is greater than or equal 
+# to a given level. Redefine function or preceding FATAL_*_EXIT codes as needed.
+EXIT_IF_FATAL = status=$$?; if [ $$status -ge $(1) ]; then exit $$status ; fi
 
 # The test directories to run
 DEFAULT_TESTDIRS = .
 TESTDIRS = $(DEFAULT_TESTDIRS)
 
 # Root of all test results
-TEST_OUTPUT_DIR = $(TEST_ROOT)/o_$(PLATFORM)-$(ARCH)
+TEST_OUTPUT_DIR = $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools
+ABS_TEST_OUTPUT_DIR := \
+	$(shell mkdir -p $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools; \
+		cd  $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools; \
+		pwd )
+# Subdirectories for different test runs
+JTREG_OUTPUT_DIR = $(ABS_TEST_OUTPUT_DIR)/jtreg
+JCK_COMPILER_OUTPUT_DIR = $(ABS_TEST_OUTPUT_DIR)/jck-compiler
+JCK_RUNTIME_OUTPUT_DIR = $(ABS_TEST_OUTPUT_DIR)/jck-runtime-Xcompile
 
-# Default make rule
-all apt javac javadoc javah javap: clean check jtreg-tests $(JPRT_ARCHIVE_BUNDLE)
+# Default make rule -- warning, may take a while
+all: $(JPRT_CLEAN) jtreg-tests jck-compiler-tests jck-runtime-tests $(JPRT_ARCHIVE_BUNDLE) all-summary
+	@echo "Testing completed successfully"
+
+jtreg apt javac javadoc javah javap: $(JPRT_CLEAN) jtreg-tests $(JPRT_ARCHIVE_BUNDLE) jtreg-summary
+	@echo "Testing completed successfully"
+
+jck-compiler: $(JPRT_CLEAN) jck-compiler-tests $(JPRT_ARCHIVE_BUNDLE) jck-compiler-summary
+	@echo "Testing completed successfully"
+
+jck-runtime: $(JPRT_CLEAN) jck-runtime-tests $(JPRT_ARCHIVE_BUNDLE) jck-runtime-summary
 	@echo "Testing completed successfully"
 
 # for use with JPRT -testrule
-all:		TESTDIRS = .
-apt:		TESTDIRS = tools/apt
-javac: 		TESTDIRS = tools/javac
-javadoc:	TESTDIRS = tools/javadoc com/sun/javadoc
-javah:		TESTDIRS = tools/javah
-javap:		TESTDIRS = tools/javap
+all:		JTREG_TESTDIRS = .
+jtreg:		JTREG_TESTDIRS = .
+apt:		JTREG_TESTDIRS = tools/apt
+javac: 		JTREG_TESTDIRS = tools/javac
+javadoc:	JTREG_TESTDIRS = tools/javadoc com/sun/javadoc
+javah:		JTREG_TESTDIRS = tools/javah
+javap:		JTREG_TESTDIRS = tools/javap
+
+# Run jtreg tests
+#
+# JTREG_HOME
+#	Installed location of jtreg
+# JT_JAVA
+#	Version of java used to run jtreg.  Should normally be the same as TESTJAVA
+# TESTJAVA
+# 	Version of java to be tested.  
+# JTREG_OPTIONS
+#	Additional options for jtreg
+# JTREG_TESTDIRS
+#	Directories of tests to be run
+# JTREG_OUTPUT_DIR
+#	Where to write the results
+# JTREG_REFERENCE
+#	(Optional) reference results (e.g. work, report or summary.txt)
+#
+jtreg-tests: check-jtreg FRC
+	@rm -f -r $(JTREG_OUTPUT_DIR)/JTwork $(JTREG_OUTPUT_DIR)/JTreport \
+	    $(JTREG_OUTPUT_DIR)/diff.html $(JTREG_OUTPUT_DIR)/status.txt
+	@mkdir -p $(JTREG_OUTPUT_DIR)
+	JT_JAVA=$(JT_JAVA) $(JTREG) \
+	  -J-Xmx512m \
+	  -a -samevm -ignore:quiet -v:fail,error,nopass \
+          -r:$(JTREG_OUTPUT_DIR)/JTreport \
+          -w:$(JTREG_OUTPUT_DIR)/JTwork \
+          -jdk:$(TESTJAVA) \
+          $(JAVA_ARGS:%=-vmoption:%) \
+	  $(JTREG_OPTIONS) \
+          $(JTREG_TESTDIRS) \
+	|| ( $(call EXIT_IF_FATAL,$(FATAL_JTREG_EXIT)) ; \
+	    echo $$status > $(JTREG_OUTPUT_DIR)/status.txt \
+	)
+ifdef JTREG_REFERENCE
+	JT_JAVA=$(JT_JAVA) $(JTDIFF) -o $(JTREG_OUTPUT_DIR)/diff.html \
+	    $(JTREG_REFERENCE) $(JTREG_OUTPUT_DIR)/JTreport \
+	|| ( $(call EXIT_IF_FATAL,$(FATAL_JTDIFF_EXIT)) )
+endif
+
+jtreg-summary: FRC
+	if [ -r $(JTREG_OUTPUT_DIR)/status.txt ]; then \
+	    echo ; echo "Summary of jtreg test failures" ; \
+	    cat $(JTREG_OUTPUT_DIR)/JTreport/text/summary.txt | \
+		grep -v 'Not run' | grep -v 'Passed' ; \
+	    echo ; \
+	    $(EXIT) `cat $(JTREG_OUTPUT_DIR)/status.txt` ; \
+	fi
 
 # Check to make sure these directories exist
-check: $(JT_HOME) $(PRODUCT_HOME) $(JTREG)
+check-jtreg: $(JT_HOME) $(PRODUCT_HOME) $(JTREG)
+
+
+# Run JCK-compiler tests
+#
+# JCK_HOME
+#	Installed location of JCK: should include JCK-compiler, and JCK-extras
+# JT_JAVA
+#	Version of java used to run JCK.  Should normally be the same as TESTJAVA
+# TESTJAVA
+# 	Version of java to be tested.  
+# JCK_COMPILER_OPTIONS
+#	Additional options for JCK-compiler
+# JCK_COMPILER_TESTDIRS
+#	Directories of tests to be run
+# JCK_COMPILER_OUTPUT_DIR
+#	Where to write the results
+# JCK_COMPILER_REFERENCE
+#	(Optional) reference results (e.g. work, report or summary.txt)
+#
+jck-compiler-tests: check-jck FRC
+	@rm -f -r $(JCK_COMPILER_OUTPUT_DIR)/work $(JCK_COMPILER_OUTPUT_DIR)/report \
+	    $(JCK_COMPILER_OUTPUT_DIR)/diff.html $(JCK_COMPILER_OUTPUT_DIR)/status.txt
+	@mkdir -p $(JCK_COMPILER_OUTPUT_DIR)
+	$(JT_JAVA)/bin/java -XX:MaxPermSize=256m -Xmx512m \
+	    -jar $(JCK_HOME)/JCK-compiler-7/lib/jtjck.jar \
+	    -v:non-pass \
+            -r:$(JCK_COMPILER_OUTPUT_DIR)/report \
+            -w:$(JCK_COMPILER_OUTPUT_DIR)/work \
+            -jdk:$(TESTJAVA) \
+	    $(JCK_COMPILER_OPTIONS) \
+            $(JCK_COMPILER_TESTDIRS) \
+	|| ( $(call EXIT_IF_FATAL,$(FATAL_JCK_EXIT)) ; \
+	    echo $$status > $(JCK_COMPILER_OUTPUT_DIR)/status.txt \
+	)
+ifdef JCK_COMPILER_REFERENCE
+	JT_JAVA=$(JT_JAVA) $(JTDIFF) -o $(JCK_COMPILER_OUTPUT_DIR)/diff.html \
+	    $(JCK_COMPILER_REFERENCE) $(JCK_COMPILER_OUTPUT_DIR)/report \
+	|| ( $(call EXIT_IF_FATAL,$(FATAL_JTDIFF_EXIT)) )
+endif
+
+jck-compiler-summary: FRC
+	if [ -r $(JCK_COMPILER_OUTPUT_DIR)/status.txt ]; then \
+	    echo ; echo "Summary of JCK-compiler test failures" ; \
+	    cat $(JCK_COMPILER_OUTPUT_DIR)/report/text/summary.txt | \
+		grep -v 'Not run' | grep -v 'Passed' ; \
+	    echo ; \
+	    $(EXIT) `cat $(JCK_COMPILER_OUTPUT_DIR)/status.txt` ; \
+	fi
 
-# Run the tests
-jtreg-tests: FRC
-	@echo "Using export JAVA_TOOL_OPTIONS=$(JAVA_TOOL_OPTIONS)"
-	@rm -f -r $(TEST_OUTPUT_DIR)/JTwork $(TEST_OUTPUT_DIR)/JTreport
-	@mkdir -p $(TEST_OUTPUT_DIR)
-	JT_JAVA=$(JT_JAVA) $(JTREG) \
-	  -a -samevm -k:\!ignore -v:fail,error,nopass \
-          -r:$(TEST_OUTPUT_DIR)/JTreport \
-          -w:$(TEST_OUTPUT_DIR)/JTwork \
-          -jdk:$(TESTJAVA) \
-	  -Xbootclasspath/p:$(TESTBOOTCLASSPATH) \
-          $(JAVA_ARGS:%=-vmoption:%) \
-          $(TESTDIRS) \
-	|| ( status=$$? ; \
-		echo ; echo "Summary of test failures" ; \
-		cat $(TEST_OUTPUT_DIR)/JTreport/text/summary.txt | \
-			grep -v 'Not run' | grep -v 'Passed' ; \
-		echo ; \
-		exit $$status )
+# Run JCK-runtime tests in -Xcompile mode
+# This is a special mode to test javac by compiling the tests in the JCK-runtime test suite
+# Normal JCK-runtime invocation belongs in the jdk/ repository.
+#
+# JCK_HOME
+#	Installed location of JCK: should include JCK-compiler, JCK-runtime and JCK-extras
+# JT_JAVA
+#	Version of java used to run JCK.  Should normally be the same as TESTJAVA
+# TESTJAVA
+# 	Version of java to be tested.  
+# JCK_RUNTIME_OPTIONS
+#	Additional options for JCK-runtime
+# JCK_RUNTIME_TESTDIRS
+#	Directories of tests to be run
+# JCK_RUNTIME_OUTPUT_DIR
+#	Where to write the results
+# JCK_RUNTIME_REFERENCE
+#	(Optional) reference results (e.g. work, report or summary.txt)
+#
+jck-runtime-tests: check-jck FRC
+	@rm -f -r $(JCK_RUNTIME_OUTPUT_DIR)/work $(JCK_RUNTIME_OUTPUT_DIR)/report \
+	    $(JCK_RUNTIME_OUTPUT_DIR)/diff.html $(JCK_RUNTIME_OUTPUT_DIR)/status.txt
+	@mkdir -p $(JCK_RUNTIME_OUTPUT_DIR)
+	$(JT_JAVA)/bin/java -XX:MaxPermSize=256m -Xmx512m \
+	    -jar $(JCK_HOME)/JCK-runtime-7/lib/jtjck.jar \
+	    -v:non-pass \
+            -r:$(JCK_RUNTIME_OUTPUT_DIR)/report \
+            -w:$(JCK_RUNTIME_OUTPUT_DIR)/work \
+            -jdk:$(TESTJAVA) \
+	    -Xcompile \
+	    $(JCK_RUNTIME_OPTIONS) \
+            $(JCK_RUNTIME_TESTDIRS) \
+	|| ( $(call EXIT_IF_FATAL,$(FATAL_JCK_EXIT)) ; \
+	    echo $$status > $(JCK_RUNTIME_OUTPUT_DIR)/status.txt \
+	)
+ifdef JCK_RUNTIME_REFERENCE
+	JT_JAVA=$(JT_JAVA) $(JTDIFF) -o $(JCK_RUNTIME_OUTPUT_DIR)/diff.html \
+	    $(JCK_RUNTIME_REFERENCE) $(JCK_RUNTIME_OUTPUT_DIR)/report \
+	|| ( $(call EXIT_IF_FATAL,$(FATAL_JTDIFF_EXIT)) )
+endif
+
+jck-runtime-summary: FRC
+	if [ -r $(JCK_RUNTIME_OUTPUT_DIR)/status.txt ]; then \
+	    echo ; echo "Summary of JCK-runtime test failures" ; \
+	    cat $(JCK_RUNTIME_OUTPUT_DIR)/report/text/summary.txt | \
+		grep -v 'Not run' | grep -v 'Passed' ; \
+	    echo ; \
+	    $(EXIT) `cat $(JCK_RUNTIME_OUTPUT_DIR)/status.txt` ; \
+	fi
+
+# Check to make sure these directories exist
+check-jck: $(JT_HOME) $(JCK_HOME) $(PRODUCT_HOME)
+
+all-summary: FRC
+	if [ -n "`find $(TEST_OUTPUT_DIR) -name status.txt`" ]; then
+	    echo ; echo "Summary of test failures" ; \
+	    cat `find $(TEST_OUTPUT_DIR) -name summary.txt` | \
+		grep -v 'Not run' | grep -v 'Passed' ; \
+	    echo ; \
+	    $(EXIT) 1
+	fi
 
 # Bundle up the results
 $(JPRT_ARCHIVE_BUNDLE): FRC
@@ -124,12 +380,17 @@
 
 # Cleanup
 clean:
-	rm -f -r $(TEST_OUTPUT_DIR)
 	rm -f $(JPRT_ARCHIVE_BUNDLE)
 
 # Used to force a target rules to run
 FRC:
 
 # Phony targets (e.g. these are not filenames)
-.PHONY: all tests clean check
+.PHONY: all clean \
+	jtreg javac javadoc javah javap jtreg-tests jtreg-summary check-jtreg \
+	jck-compiler jck-compiler-tests jck-compiler-summary \
+	jck-runtime jck-runtime-tests jck-runtime-summary check-jck
 
+# No use of suffix rules
+.SUFFIXES:
+
--- a/langtools/test/tools/javac/OverrideChecks/6738538/T6738538a.java	Thu Apr 08 17:03:01 2010 -0700
+++ b/langtools/test/tools/javac/OverrideChecks/6738538/T6738538a.java	Tue Apr 13 16:42:58 2010 -0700
@@ -41,4 +41,4 @@
         public T m();
     }
     class Crash<T extends C<?> & I> {}
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/OverrideChecks/6738538/T6738538b.java	Thu Apr 08 17:03:01 2010 -0700
+++ b/langtools/test/tools/javac/OverrideChecks/6738538/T6738538b.java	Tue Apr 13 16:42:58 2010 -0700
@@ -44,4 +44,4 @@
     }
 
     class C2<T extends C1<?> & I2> {}
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/api/6731573/Erroneous.java	Thu Apr 08 17:03:01 2010 -0700
+++ b/langtools/test/tools/javac/api/6731573/Erroneous.java	Tue Apr 13 16:42:58 2010 -0700
@@ -1,4 +1,4 @@
 class A {
     boolean b;
     boolean b;
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/api/6731573/T6731573.java	Thu Apr 08 17:03:01 2010 -0700
+++ b/langtools/test/tools/javac/api/6731573/T6731573.java	Tue Apr 13 16:42:58 2010 -0700
@@ -106,4 +106,4 @@
     public static void main(String... args) throws Exception {
         new T6731573().test();
     }
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/cast/6548436/T6548436d.java	Thu Apr 08 17:03:01 2010 -0700
+++ b/langtools/test/tools/javac/cast/6548436/T6548436d.java	Tue Apr 13 16:42:58 2010 -0700
@@ -37,4 +37,4 @@
     static void test(Base<? extends Double> je) {
         Object o = (Base<Integer>)je;
     }
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/cast/6558559/T6558559a.java	Thu Apr 08 17:03:01 2010 -0700
+++ b/langtools/test/tools/javac/cast/6558559/T6558559a.java	Tue Apr 13 16:42:58 2010 -0700
@@ -37,4 +37,4 @@
 
     A<?> x = null;
     B<?> y = (B<?>)x;
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/cast/6558559/T6558559b.java	Thu Apr 08 17:03:01 2010 -0700
+++ b/langtools/test/tools/javac/cast/6558559/T6558559b.java	Tue Apr 13 16:42:58 2010 -0700
@@ -40,4 +40,4 @@
         Object o = unboundList;
         Throwable t3 = (Throwable) o;
     }
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/cast/6586091/T6586091.java	Thu Apr 08 17:03:01 2010 -0700
+++ b/langtools/test/tools/javac/cast/6586091/T6586091.java	Tue Apr 13 16:42:58 2010 -0700
@@ -35,4 +35,4 @@
 
     A<A<?>> t = null;
     B c = (B)t;
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/enum/T6724345.java	Thu Apr 08 17:03:01 2010 -0700
+++ b/langtools/test/tools/javac/enum/T6724345.java	Tue Apr 13 16:42:58 2010 -0700
@@ -48,4 +48,4 @@
     enum E implements I {
         V {public void i() {}};
     }
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/generics/T6557954.java	Thu Apr 08 17:03:01 2010 -0700
+++ b/langtools/test/tools/javac/generics/T6557954.java	Tue Apr 13 16:42:58 2010 -0700
@@ -33,4 +33,4 @@
 class T6557954<T> {
     class Foo<U extends T> {}
     T6557954<Number>.Foo<Integer> f;
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/generics/T6751514.java	Thu Apr 08 17:03:01 2010 -0700
+++ b/langtools/test/tools/javac/generics/T6751514.java	Tue Apr 13 16:42:58 2010 -0700
@@ -79,4 +79,4 @@
                                      " - found: " + found + ")");
         }
     }
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/generics/T6869075.java	Thu Apr 08 17:03:01 2010 -0700
+++ b/langtools/test/tools/javac/generics/T6869075.java	Tue Apr 13 16:42:58 2010 -0700
@@ -64,4 +64,4 @@
                                      " - found: " + found + ")");
         }
     }
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/generics/inference/6569789/T6569789.java	Thu Apr 08 17:03:01 2010 -0700
+++ b/langtools/test/tools/javac/generics/inference/6569789/T6569789.java	Tue Apr 13 16:42:58 2010 -0700
@@ -41,4 +41,4 @@
     }
 
     static <W extends C & I & I1 & I2, T extends W> void testMethod(T t) {}
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/generics/inference/6650759/T6650759a.java	Thu Apr 08 17:03:01 2010 -0700
+++ b/langtools/test/tools/javac/generics/inference/6650759/T6650759a.java	Tue Apr 13 16:42:58 2010 -0700
@@ -42,4 +42,4 @@
         Integer test = getGenericValue(new IntegerInterface());
         testSet(getGenericValue(new IntegerInterface()));
     }
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/generics/wildcards/T6732484.java	Thu Apr 08 17:03:01 2010 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/T6732484.java	Tue Apr 13 16:42:58 2010 -0700
@@ -34,4 +34,4 @@
     class B extends A<B> {}
 
     A<? super B> f;
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/processing/model/util/elements/Foo.java	Thu Apr 08 17:03:01 2010 -0700
+++ b/langtools/test/tools/javac/processing/model/util/elements/Foo.java	Tue Apr 13 16:42:58 2010 -0700
@@ -26,4 +26,4 @@
  * Dummy type to compile.
  */
 public class Foo {
-}
\ No newline at end of file
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/util/elements/VacuousEnum.java	Tue Apr 13 16:42:58 2010 -0700
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6937417
+ * @summary Test -Xprint on enum type with no constants
+ * @author  Joseph D. Darcy
+ * @compile -Xprint VacuousEnum.java
+ */
+public enum VacuousEnum {
+    // But alas, no enum constants!
+}
--- a/langtools/test/tools/javac/varargs/T6746184.java	Thu Apr 08 17:03:01 2010 -0700
+++ b/langtools/test/tools/javac/varargs/T6746184.java	Tue Apr 13 16:42:58 2010 -0700
@@ -36,4 +36,4 @@
 class A {
     public static void m(final Object... varargs) {}
     private static void m(final Object singleArg) {}
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javah/T6893943.java	Thu Apr 08 17:03:01 2010 -0700
+++ b/langtools/test/tools/javah/T6893943.java	Tue Apr 13 16:42:58 2010 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6893943
+ * @bug 6893943 6937318
  * @summary exit code from javah with no args is 0
  */
 
@@ -31,22 +31,32 @@
 import java.util.*;
 
 public class T6893943 {
+    static final String[] NO_ARGS = { };
+    static final String[] HELP = { "-help" };
+    static final String NEWLINE = System.getProperty("line.separator");
+
     public static void main(String... args) throws Exception {
         new T6893943().run();
     }
 
     void run() throws Exception {
-        testSimpleAPI();
-        testCommand();
+        testSimpleAPI(NO_ARGS, 1);
+        testSimpleAPI(HELP, 0);
+        testCommand(NO_ARGS, 1);
+        testCommand(HELP, 0);
     }
 
-    void testSimpleAPI() throws Exception {
-        PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.err));
-        int rc = com.sun.tools.javah.Main.run(new String[] { }, pw);
-        expect("testSimpleAPI", rc, 1);
+    void testSimpleAPI(String[] args, int expect_rc) throws Exception {
+        System.err.println("Test simple api: " + Arrays.asList(args));
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        int rc = com.sun.tools.javah.Main.run(args, pw);
+        pw.close();
+        expect("testSimpleAPI", sw.toString(), rc, expect_rc);
     }
 
-    void testCommand() throws Exception {
+    void testCommand(String[] args, int expect_rc) throws Exception {
+        System.err.println("Test command: " + Arrays.asList(args));
         File javaHome = new File(System.getProperty("java.home"));
         if (javaHome.getName().equals("jre"))
             javaHome = javaHome.getParentFile();
@@ -54,22 +64,32 @@
         List<String> command = new ArrayList<String>();
         command.add(new File(new File(javaHome, "bin"), "javah").getPath());
         command.add("-J-Xbootclasspath:" + System.getProperty("sun.boot.class.path"));
+        command.addAll(Arrays.asList(args));
         //System.err.println("command: " + command);
 
         ProcessBuilder pb = new ProcessBuilder(command);
         pb.redirectErrorStream(true);
         Process p = pb.start();
         p.getOutputStream().close();
+        StringWriter sw = new StringWriter();
         String line;
         BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
         while ((line = in.readLine()) != null)
-            System.err.println("javah: " + line);
+            sw.write(line + NEWLINE);
         int rc = p.waitFor();
-        expect("testCommand", rc, 1);
+        expect("testCommand", sw.toString(), rc, expect_rc);
     }
 
-    void expect(String name, int actual, int expect) throws Exception {
-        if (actual != expect)
-            throw new Exception(name + ": unexpected exit: " + actual + ", expected: " + expect);
+    void expect(String name, String out, int actual_rc, int expect_rc) throws Exception {
+        if (out.isEmpty())
+            throw new Exception("No output from javah");
+
+        if (!out.startsWith("Usage:")) {
+            System.err.println(out);
+            throw new Exception("Unexpected output from javah");
+        }
+
+        if (actual_rc != expect_rc)
+            throw new Exception(name + ": unexpected exit: " + actual_rc + ", expected: " + expect_rc);
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javap/6937244/T6937244.java	Tue Apr 13 16:42:58 2010 -0700
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6937244
+ * @summary fields display with JVMS names, not Java names
+ */
+
+import java.io.*;
+
+public class T6937244 {
+    public static void main(String[] args) throws Exception {
+        new T6937244().run();
+    }
+
+    void run() throws Exception {
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        String[] args = { "java.lang.String" };
+        int rc = com.sun.tools.javap.Main.run(args, pw);
+        pw.close();
+        String out = sw.toString();
+        System.err.println(out);
+        if (rc != 0)
+            throw new Exception("unexpected exit from javap: " + rc);
+        for (String line: out.split("[\r\n]+")) {
+            if (line.contains("CASE_INSENSITIVE_ORDER")) {
+                if (line.matches("\\s*\\Qpublic static final java.util.Comparator<java.lang.String> CASE_INSENSITIVE_ORDER;\\E\\s*"))
+                    return;
+                throw new Exception("declaration not shown as expected");
+            }
+        }
+        throw new Exception("declaration of CASE_INSENSITIVE_ORDER not found");
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javap/6937244/T6937244A.java	Tue Apr 13 16:42:58 2010 -0700
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6937244
+ * @summary fields display with JVMS names, not Java names
+ */
+
+import java.io.*;
+import java.util.*;
+
+public class T6937244A {
+    public static void main(String[] args) throws Exception {
+        new T6937244A().run();
+    }
+
+    void run() throws Exception {
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        String[] args = { "Test" };
+        int rc = com.sun.tools.javap.Main.run(args, pw);
+        pw.close();
+        String out = sw.toString();
+        System.err.println(out);
+        if (rc != 0)
+            throw new Exception("unexpected exit from javap: " + rc);
+
+        int count = 0;
+
+        for (String line: out.split("[\r\n]+")) {
+            if (line.contains("extends")) {
+                verify(line, "extends java.lang.Object implements java.util.List<java.lang.String>");
+                count++;
+            }
+
+            if (line.contains("field")) {
+                verify(line, "java.util.List<java.lang.String> field");
+                count++;
+            }
+
+            if (line.contains("method")) {
+                verify(line, "java.util.List<java.lang.String> method(java.util.List<java.lang.String>) throws java.lang.Exception");
+                count++;
+            }
+        }
+
+        // final backstop check
+        if (out.contains("/"))
+            throw new Exception("unexpected \"/\" in output");
+
+        if (count != 3)
+            throw new Exception("wrong number of matches found: " + count);
+    }
+
+    void verify(String line, String expect) throws Exception {
+        if (!line.contains(expect)) {
+            System.err.println("line:   " + line);
+            System.err.println("expect: " + expect);
+            throw new Exception("expected string not found in line");
+        }
+    }
+}
+
+
+abstract class Test implements List<String> {
+    public List<String> field;
+    public List<String> method(List<String> arg) throws Exception { return null; }
+}
+
--- a/langtools/test/tools/javap/T6715251.java	Thu Apr 08 17:03:01 2010 -0700
+++ b/langtools/test/tools/javap/T6715251.java	Tue Apr 13 16:42:58 2010 -0700
@@ -71,4 +71,4 @@
 
     String log;
     int errors;
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javap/T6715753.java	Thu Apr 08 17:03:01 2010 -0700
+++ b/langtools/test/tools/javap/T6715753.java	Tue Apr 13 16:42:58 2010 -0700
@@ -47,4 +47,4 @@
             throw new Exception("test failed");
         }
     }
-}
\ No newline at end of file
+}