Merge ihse-testmakefiles-branch
authorihse
Mon, 27 Nov 2017 19:36:51 +0100
branchihse-testmakefiles-branch
changeset 55894 6da4c12646f3
parent 55893 9991393c7b3a (current diff)
parent 47942 06652ffab955 (diff)
child 55895 2a99e6a5dd01
Merge
test/Makefile
--- a/make/Main.gmk	Mon Nov 27 19:04:36 2017 +0100
+++ b/make/Main.gmk	Mon Nov 27 19:36:51 2017 +0100
@@ -1049,7 +1049,7 @@
 # file.
 
 CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
-    images make-support test-make bundles buildjdk
+    images make-support test-make bundles buildjdk test-results test-support
 CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
 CLEAN_SUPPORT_DIRS += demos
 CLEAN_SUPPORT_DIR_TARGETS := $(addprefix clean-, $(CLEAN_SUPPORT_DIRS))
@@ -1094,6 +1094,8 @@
 # while classes and touch files end up in jdk.
 clean-support: clean-jdk
 
+clean-test: clean-test-results clean-test-support
+
 # Remove everything, including configure configuration. If the output
 # directory was created by configure and now becomes empty, remove it as well.
 dist-clean: clean
--- a/make/RunTests.gmk	Mon Nov 27 19:04:36 2017 +0100
+++ b/make/RunTests.gmk	Mon Nov 27 19:36:51 2017 +0100
@@ -38,6 +38,11 @@
 TEST_RESULTS_DIR := $(OUTPUTDIR)/test-results
 TEST_SUPPORT_DIR := $(OUTPUTDIR)/test-support
 
+ifeq ($(CUSTOM_ROOT), )
+  JTREG_TOPDIR := $(TOPDIR)
+else
+  JTREG_TOPDIR := $(CUSTOM_ROOT)
+endif
 
 ################################################################################
 # Parse control variables
@@ -84,6 +89,11 @@
 hotspot_JTREG_NATIVEPATH := $(TEST_IMAGE_DIR)/hotspot/jtreg/native
 jdk_JTREG_NATIVEPATH := $(TEST_IMAGE_DIR)/jdk/jtreg/native
 
+jdk_JTREG_PROBLEM_LIST += $(TOPDIR)/test/jdk/ProblemList.txt
+jaxp_JTREG_PROBLEM_LIST += $(TOPDIR)/test/jaxp/ProblemList.txt
+langtools_JTREG_PROBLEM_LIST += $(TOPDIR)/test/langtools/ProblemList.txt
+nashorn_JTREG_PROBLEM_LIST += $(TOPDIR)/test/nashorn/ProblemList.txt
+hotspot_JTREG_PROBLEM_LIST += $(TOPDIR)/test/hotspot/jtreg/ProblemList.txt
 
 ################################################################################
 # Parse test selection
@@ -116,17 +126,23 @@
   )
 endef
 
+# Helper function that removes the TOPDIR part
+CleanupJtregPath = \
+  $(strip $(patsubst %/, %, $(subst $(JTREG_TOPDIR)/,, $1)))
+
 # Take a partial Jtreg root path and return a full, absolute path to that Jtreg
 # root. Also support having "hotspot" as an alias for "hotspot/jtreg".
 ExpandJtregRoot = \
-  $(strip $(wildcard $(patsubst %/, %, \
+  $(call CleanupJtregPath, $(wildcard \
     $(if $(filter /%, $1), \
-      $1 \
+      $(if $(wildcard $(strip $1)/TEST.ROOT), \
+        $1 \
+      ) \
     , \
       $(filter $(addprefix %, $1), $(JTREG_TESTROOTS) $(addsuffix /, $(JTREG_TESTROOTS))) \
       $(filter $(addprefix %, $(strip $1)/jtreg), $(JTREG_TESTROOTS) $(addsuffix /, $(JTREG_TESTROOTS))) \
     ) \
-  )))
+  ))
 
 # Take a partial Jtreg test path and return a full, absolute path to that Jtreg
 # test. Also support having "hotspot" as an alias for "hotspot/jtreg".
@@ -134,14 +150,14 @@
   $(if $(call ExpandJtregRoot, $1), \
     $(call ExpandJtregRoot, $1) \
   , \
-    $(strip $(wildcard $(patsubst %/, %, \
+    $(call CleanupJtregPath, $(wildcard \
       $(if $(filter /%, $1), \
         $1 \
       , \
         $(addsuffix /$(strip $1), $(JTREG_TESTROOTS) $(TEST_BASEDIRS)) \
         $(addsuffix $(strip $(patsubst hotspot/%, /hotspot/jtreg/%, $1)), $(JTREG_TESTROOTS) $(TEST_BASEDIRS)) \
       ) \
-    ))) \
+    )) \
   )
 
 # Helper function to determine if a test specification is a Jtreg test
@@ -165,20 +181,18 @@
       $(eval TEST_ROOTS := $(call ExpandJtregRoot, $(TEST_PATH))) \
     ) \
     $(foreach test_root, $(TEST_ROOTS), \
-      $(if $(filter $(TEST_GROUP), $($(test_root)_JTREG_TEST_GROUPS)), \
+      $(if $(filter /%, $(test_root)), \
         jtreg:$(test_root):$(TEST_GROUP) \
+      , \
+        $(if $(filter $(TEST_GROUP), $($(JTREG_TOPDIR)/$(test_root)_JTREG_TEST_GROUPS)), \
+          jtreg:$(test_root):$(TEST_GROUP) \
+        ) \
       ) \
     ) \
   , \
-    $(if $(filter /%, $(TEST_NAME)), \
-      $(if $(wildcard $(TEST_NAME)), \
-        jtreg:$(TEST_NAME) \
-      ) \
-    , \
-      $(eval TEST_PATHS := $(call ExpandJtregPath, $(TEST_NAME))) \
-      $(foreach test_path, $(TEST_PATHS), \
-        jtreg:$(test_path) \
-      ) \
+    $(eval TEST_PATHS := $(call ExpandJtregPath, $(TEST_NAME))) \
+    $(foreach test_path, $(TEST_PATHS), \
+      jtreg:$(test_path) \
     ) \
   )
 endef
@@ -326,7 +340,7 @@
 
   $1_COMPONENT := \
       $$(strip $$(foreach root, $$(JTREG_TESTROOTS), \
-        $$(if $$(filter $$(root)%, $$($1_TEST_NAME)), \
+        $$(if $$(filter $$(root)%, $$(JTREG_TOPDIR)/$$($1_TEST_NAME)), \
           $$(lastword $$(subst /, $$(SPACE), $$(root))) \
         ) \
       ))
@@ -350,6 +364,7 @@
   $$(eval $$(call SetJtregValue,$1,JTREG_MAX_MEM,512m))
   $$(eval $$(call SetJtregValue,$1,JTREG_NATIVEPATH))
   $$(eval $$(call SetJtregValue,$1,JTREG_BASIC_OPTIONS))
+  $$(eval $$(call SetJtregValue,$1,JTREG_PROBLEM_LIST))
 
   ifneq ($(TEST_JOBS), 0)
     # User has specified TEST_JOBS, use that as fallback default
@@ -359,11 +374,6 @@
     $$(eval $$(call SetJtregValue,$1,JTREG_JOBS,$$(JOBS)))
   endif
 
-  ifeq ($$(shell $$(EXPR) $$($1_JTREG_JOBS) \> 50), 1)
-    # Until CODETOOLS-7901892 is fixed, JTreg cannot handle more than 50 jobs
-    $1_JTREG_JOBS := 50
-  endif
-
   # Make sure MaxRAMPercentage is high enough to not cause OOM or swapping since
   # we may end up with a lot of JVM's
   $1_JTREG_MAX_RAM_PERCENTAGE := $$(shell $$(EXPR) 25 / $$($1_JTREG_JOBS))
@@ -403,11 +413,18 @@
     $1_JTREG_BASIC_OPTIONS += -nativepath:$$($1_JTREG_NATIVEPATH)
   endif
 
+  ifneq ($$($1_JTREG_PROBLEM_LIST), )
+    $1_JTREG_BASIC_OPTIONS += $$(addprefix -exclude:, $$($1_JTREG_PROBLEM_LIST))
+  endif
+
   ifneq ($$(JIB_JAR), )
     $1_JTREG_BASIC_OPTIONS += -cpa:$$(JIB_JAR)
   endif
 
-  run-test-$1:
+  clean-workdir-$1:
+	$$(RM) -r $$($1_TEST_SUPPORT_DIR)
+
+  run-test-$1: clean-workdir-$1
 	$$(call LogWarn)
 	$$(call LogWarn, Running test '$$($1_TEST)')
 	$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
@@ -416,7 +433,7 @@
 	        -Dprogram=jtreg -jar $$(JT_HOME)/lib/jtreg.jar \
 	        $$($1_JTREG_BASIC_OPTIONS) \
 	        -testjdk:$$(JDK_IMAGE_DIR) \
-	        -dir:$$(TOPDIR) \
+	        -dir:$$(JTREG_TOPDIR) \
 	        -reportDir:$$($1_TEST_RESULTS_DIR) \
 	        -workDir:$$($1_TEST_SUPPORT_DIR) \
 	        $$(JTREG_OPTIONS) \
@@ -514,12 +531,19 @@
 	$(foreach test, $(TESTS_TO_RUN), \
 	  $(eval TEST_ID := $(shell $(ECHO) $(strip $(test)) | \
 	      $(TR) -cs '[a-z][A-Z][0-9]\n' '_')) \
+	  $(eval NAME_PATTERN := $(shell $(ECHO) $(test) | $(TR) -c \\n _)) \
+	  $(if $(filter __________________________________________________%, $(NAME_PATTERN)), \
+	    $(eval TEST_NAME := ) \
+	    $(PRINTF) "%2s %-49s\n" "  " "$(test)"  $(NEWLINE) \
+	  , \
+	    $(eval TEST_NAME := $(test)) \
+	  ) \
 	  $(if $(filter $($(TEST_ID)_PASSED), $($(TEST_ID)_TOTAL)), \
-	    $(PRINTF) "%2s %-49s %5d %5d %5d %5d %2s\n" "  " "$(test)" \
+	    $(PRINTF) "%2s %-49s %5d %5d %5d %5d %2s\n" "  " "$(TEST_NAME)" \
 	        $($(TEST_ID)_TOTAL) $($(TEST_ID)_PASSED) $($(TEST_ID)_FAILED) \
 	        $($(TEST_ID)_ERROR) "  " $(NEWLINE) \
 	  , \
-	    $(PRINTF) "%2s %-49s %5d %5d %5d %5d %2s\n" ">>" "$(test)" \
+	    $(PRINTF) "%2s %-49s %5d %5d %5d %5d %2s\n" ">>" "$(TEST_NAME)" \
 	        $($(TEST_ID)_TOTAL) $($(TEST_ID)_PASSED) $($(TEST_ID)_FAILED) \
 	        $($(TEST_ID)_ERROR) "<<" $(NEWLINE) \
 	    $(eval TEST_FAILURE := true) \
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Mon Nov 27 19:04:36 2017 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Mon Nov 27 19:36:51 2017 +0100
@@ -1548,7 +1548,8 @@
                       boolean allowBoxing,
                       boolean useVarargs) {
         if (sym.kind == ERR ||
-                !sym.isInheritedIn(site.tsym, types)) {
+                (site.tsym != sym.owner && !sym.isInheritedIn(site.tsym, types)) ||
+                !notOverriddenIn(site, sym)) {
             return bestSoFar;
         } else if (useVarargs && (sym.flags() & VARARGS) == 0) {
             return bestSoFar.kind.isResolutionError() ?
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Mon Nov 27 19:04:36 2017 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Mon Nov 27 19:36:51 2017 +0100
@@ -1319,6 +1319,9 @@
                         break loop;
                     case DOT:
                         nextToken();
+                        if (token.kind == TokenKind.IDENTIFIER && typeArgs != null) {
+                            return illegal();
+                        }
                         int oldmode = mode;
                         mode &= ~NOPARAMS;
                         typeArgs = typeArgumentsOpt(EXPR);
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/mozilla_compat.js	Mon Nov 27 19:04:36 2017 +0100
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/mozilla_compat.js	Mon Nov 27 19:36:51 2017 +0100
@@ -45,7 +45,7 @@
 // importPackage
 // avoid unnecessary chaining of __noSuchProperty__ again
 // in case user loads this script more than once.
-if (typeof importPackage == 'undefined') {
+if (typeof importPackage == 'undefined' || !(importPackage instanceof Function)) {
 
 Object.defineProperty(this, "importPackage", {
     configurable: true, enumerable: false, writable: true,
--- a/test/Makefile	Mon Nov 27 19:04:36 2017 +0100
+++ b/test/Makefile	Mon Nov 27 19:36:51 2017 +0100
@@ -56,12 +56,7 @@
 all: jdk_all langtools_all jaxp_all
 
 ifeq ($(TEST_JOBS), 0)
-  ifeq ($(shell $(EXPR) $(JOBS) \> 50), 1)
-    # JTReg cannot handle more than 50 in concurrency
-    JDK_TEST_JOBS=50
-  else
-    JDK_TEST_JOBS=$(JOBS)
-  endif
+  JDK_TEST_JOBS=$(JOBS)
 else
   JDK_TEST_JOBS=$(TEST_JOBS)
 endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/T8185451/MisleadingVarArgsErrorMsgTest.java	Mon Nov 27 19:36:51 2017 +0100
@@ -0,0 +1,21 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 8185451
+ * @summary Misleading 'cannot be accessed from outside package' diagnostic for inconsistent varargs override
+ * @compile/fail/ref=MisleadingVarArgsErrorMsgTest.out -XDrawDiagnostics MisleadingVarArgsErrorMsgTest.java
+ */
+
+class MisleadingVarArgsErrorMsgTest {
+    class A {
+        void f(int... x) {}
+    }
+
+    class B extends A {
+        @Override
+        void f(int[] x) {}
+    }
+
+    {
+        new B().f(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/T8185451/MisleadingVarArgsErrorMsgTest.out	Mon Nov 27 19:36:51 2017 +0100
@@ -0,0 +1,2 @@
+MisleadingVarArgsErrorMsgTest.java:19:16: compiler.err.cant.apply.symbol: kindname.method, f, int[], int, kindname.class, MisleadingVarArgsErrorMsgTest.B, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, int[]))
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/T8185983/RejectTypeArgsOnSelectTest.java	Mon Nov 27 19:36:51 2017 +0100
@@ -0,0 +1,12 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 8185983
+ * @summary Javac should reject TypeArguments on field access expression
+ * @compile/fail/ref=RejectTypeArgsOnSelectTest.out -XDrawDiagnostics RejectTypeArgsOnSelectTest.java
+ */
+
+import java.util.*;
+
+class RejectTypeArgsOnSelectTest {
+    Iterator<RejectTypeArgsOnSelectTest> nullIter = Collections.<RejectTypeArgsOnSelectTest>EMPTY_LIST.iterator();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/T8185983/RejectTypeArgsOnSelectTest.out	Mon Nov 27 19:36:51 2017 +0100
@@ -0,0 +1,2 @@
+RejectTypeArgsOnSelectTest.java:11:104: compiler.err.illegal.start.of.expr
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/script/basic/JDK-8135178.js	Mon Nov 27 19:36:51 2017 +0100
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8135178: importPackage not working even with load "Mozilla compatibility script"
+ *
+ * @test
+ * @run
+ */
+
+var ScriptContext = javax.script.ScriptContext;
+var manager = new javax.script.ScriptEngineManager();
+
+var engine1 = manager.getEngineByName("nashorn");
+engine1.eval("load('nashorn:mozilla_compat.js')");
+manager.setBindings(engine1.getBindings(ScriptContext.ENGINE_SCOPE));
+
+var engine2 = manager.getEngineByName("nashorn");
+engine2.eval("load('nashorn:mozilla_compat.js');");
+engine2.eval("importPackage(java.util);");
+
+engine2.eval("var al = new ArrayList()");
+Assert.assertTrue(engine2.eval("al instanceof java.util.ArrayList"));
+Assert.assertTrue(engine2.get("al") instanceof java.util.ArrayList);
+
+engine2.eval("var hm = new HashMap()");
+Assert.assertTrue(engine2.eval("hm instanceof java.util.HashMap"));
+Assert.assertTrue(engine2.get("hm") instanceof java.util.HashMap);