Merge
authorjwilhelm
Mon, 09 Jan 2017 15:10:25 +0100
changeset 43528 977dab1b9ce9
parent 43009 5af9f7aa93e5 (current diff)
parent 43527 3ea9823cb503 (diff)
child 43529 d6c3cdeedf6d
child 43530 f444d3f438dd
Merge
--- a/jdk/test/ProblemList.txt	Fri Jan 06 02:03:47 2017 +0000
+++ b/jdk/test/ProblemList.txt	Mon Jan 09 15:10:25 2017 +0100
@@ -150,8 +150,6 @@
 com/sun/management/OperatingSystemMXBean/GetProcessCpuLoad.java 8030957 aix-all
 com/sun/management/OperatingSystemMXBean/GetSystemCpuLoad.java  8030957 aix-all
 
-com/sun/management/DiagnosticCommandMBean/DcmdMBeanPermissionsTest.java 8169575 generic-all
-
 ############################################################################
 
 # jdk_jmx
--- a/jdk/test/com/sun/jdi/ShellScaffold.sh	Fri Jan 06 02:03:47 2017 +0000
+++ b/jdk/test/com/sun/jdi/ShellScaffold.sh	Mon Jan 09 15:10:25 2017 +0100
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 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
@@ -276,10 +276,10 @@
             # treat them as control chars on mks (eg \t is tab)
             # Oops; windows mks really seems to want this cat line
             # to start in column 1
-            if [ -w "$SystemRoot" ] ; then
-                tmpFile=$SystemRoot/tmp.$$
-            elif [ -w "$SYSTEMROOT" ] ; then
-                tmpFile=$SYSTEMROOT/tmp.$$
+            if [ -w "$Temp" ] ; then
+                tmpFile=$Temp/tmp.$$
+            elif [ -w "$TEMP" ] ; then
+                tmpFile=$TEMP/tmp.$$
             else
                 tmpFile=tmp.$$
             fi
--- a/jdk/test/tools/launcher/VersionCheck.java	Fri Jan 06 02:03:47 2017 +0000
+++ b/jdk/test/tools/launcher/VersionCheck.java	Mon Jan 09 15:10:25 2017 +0100
@@ -36,6 +36,8 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
+import java.util.HashSet;
+import java.util.Set;
 
 public class VersionCheck extends TestHelper {
 
@@ -148,31 +150,44 @@
     }
 
     /*
-     * this tests if the tool can take a version string and returns
-     * a 0 exit code, it is not possible to validate the contents
-     * of the -version output as they are inconsistent.
+     * Checks if the tools accept "-version" option (exit code is zero).
+     * The output of the tools run with "-version" is not verified.
      */
-    static boolean testToolVersion() {
-        TestHelper.testExitValue = 0;
+    static String testToolVersion() {
+        System.out.println("=== testToolVersion === ");
+        Set<String> failed = new HashSet<>();
         for (File f : new File(JAVA_BIN).listFiles(new ToolFilter(BLACKLIST_VERSION))) {
             String x = f.getAbsolutePath();
-            System.out.println("Testing (-version): " + x);
             TestResult tr = doExec(x, "-version");
-            tr.checkPositive();
+            System.out.println("Testing " + f.getName());
+            System.out.println("#> " + x + " -version");
+            tr.testOutput.forEach(System.out::println);
+            System.out.println("#> echo $?");
+            System.out.println(tr.exitValue);
+            if (!tr.isOK()) {
+                System.out.println("failed");
+                failed.add(f.getName());
+            }
         }
-        return TestHelper.testExitValue == 0;
+        if (failed.isEmpty()) {
+            System.out.println("testToolVersion passed");
+            return "";
+        } else {
+            System.out.println("testToolVersion failed");
+            return "testToolVersion: " + failed + "; ";
+        }
+
     }
 
-    static boolean compareJVersionStrings() {
-        int failcount = 0;
+    static String testJVersionStrings() {
+        System.out.println("=== testJVersionStrings === ");
+        Set<String> failed = new HashSet<>();
         for (File f : new File(JAVA_BIN).listFiles(new ToolFilter(BLACKLIST_JOPTION))) {
+            System.out.println("Testing " + f.getName());
             String x = f.getAbsolutePath();
-            System.out.println("Testing (-J-version): " + x);
-            String testStr;
-
-            testStr = getVersion(x, "-J-version");
+            String testStr = getVersion(x, "-J-version");
             if (refVersion.compareTo(testStr) != 0) {
-                failcount++;
+                failed.add(f.getName());
                 System.out.println("Error: " + x +
                                    " fails -J-version comparison");
                 System.out.println("Expected:");
@@ -183,7 +198,7 @@
 
             testStr = getVersion(x, "-J-fullversion");
             if (refFullVersion.compareTo(testStr) != 0) {
-                failcount++;
+                failed.add(f.getName());
                 System.out.println("Error: " + x +
                                    " fails -J-fullversion comparison");
                 System.out.println("Expected:");
@@ -192,12 +207,17 @@
                 System.out.print(testStr);
             }
         }
-        System.out.println("Version Test: " + failcount);
-        return failcount == 0;
+        if (failed.isEmpty()) {
+            System.out.println("testJVersionStrings passed");
+            return "";
+        } else {
+            System.out.println("testJVersionStrings failed");
+            return "testJVersionStrings: " + failed + "; ";
+        }
     }
 
-    static boolean compareInternalStrings() {
-        int failcount = 0;
+    static String testInternalStrings() {
+        System.out.println("=== testInternalStrings === ");
         String bStr = refVersion.substring(refVersion.indexOf("build") +
                                            "build".length() + 1,
                                            refVersion.lastIndexOf(")"));
@@ -208,20 +228,21 @@
         envMap.put(TestHelper.JLDEBUG_KEY, "true");
         TestHelper.TestResult tr = doExec(envMap, javaCmd, "-version");
         List<String> alist = new ArrayList<>();
-        alist.addAll(tr.testOutput);
-        for (String x : tr.testOutput) {
-            alist.add(x.trim());
-        }
+        tr.testOutput.stream().map(String::trim).forEach(alist::add);
 
-        if (!alist.contains(expectedFullVersion)) {
+        if (alist.contains(expectedFullVersion)) {
+            System.out.println("testInternalStrings passed");
+            return "";
+        } else {
             System.out.println("Error: could not find " + expectedFullVersion);
-            failcount++;
+            tr.testOutput.forEach(System.out::println);
+            System.out.println("testInternalStrings failed");
+            return "testInternalStrings; ";
         }
-        System.out.println("Internal Strings Test: " + failcount);
-        return failcount == 0;
     }
 
-    static boolean testDebugVersion() {
+    static String testDebugVersion() {
+        System.out.println("=== testInternalStrings === ");
         String jdkType = System.getProperty("jdk.debug", "release");
         String versionLines = getAllVersionLines(javaCmd, "-version");
         if ("release".equals(jdkType)) {
@@ -229,18 +250,23 @@
         } else {
             jdkType = jdkType + " ";
         }
+
         String tofind = "(" + jdkType + "build";
+
         int idx = versionLines.indexOf(tofind);
         if (idx < 0) {
+            System.out.println("versionLines " + versionLines);
             System.out.println("Did not find first instance of " + tofind);
-            return false;
+            return "testDebugVersion; ";
         }
         idx =  versionLines.indexOf(tofind, idx + 1);
         if (idx < 0) {
-            System.out.println("Did not find first instance of " + tofind);
-            return false;
+            System.out.println("versionLines " + versionLines);
+            System.out.println("Did not find second instance of " + tofind);
+            return "testDebugVersion; ";
         }
-        return true;
+        System.out.println("testDebugVersion passed");
+        return "";
     }
 
     // Initialize
@@ -251,13 +277,15 @@
 
     public static void main(String[] args) {
         init();
-        if (compareJVersionStrings() &&
-                compareInternalStrings() &&
-                testToolVersion() &&
-                testDebugVersion()) {
+        String errorMessage = "";
+        errorMessage += testJVersionStrings();
+        errorMessage += testInternalStrings();
+        errorMessage += testToolVersion();
+        errorMessage += testDebugVersion();
+        if (errorMessage.isEmpty()) {
             System.out.println("All Version string comparisons: PASS");
         } else {
-            throw new AssertionError("Some tests failed");
+            throw new AssertionError("VersionCheck failed: " + errorMessage);
         }
     }