8171413: jdk/javadoc/doclet/testModules/TestModules.java failed due to some subtests failed
authorjjg
Tue, 20 Dec 2016 06:06:01 -0800
changeset 42842 2f0b2a65b284
parent 42841 1768507dae6b
child 42843 a8d83044a192
8171413: jdk/javadoc/doclet/testModules/TestModules.java failed due to some subtests failed Reviewed-by: bpatel
langtools/test/ProblemList.txt
langtools/test/jdk/javadoc/doclet/lib/JavadocTester.java
langtools/test/jdk/javadoc/doclet/testHelpOption/TestHelpOption.java
langtools/test/jdk/javadoc/doclet/testIndentation/p/IndentAnnot.java
langtools/test/jdk/javadoc/doclet/testModules/TestModules.java
--- a/langtools/test/ProblemList.txt	Tue Dec 20 05:50:39 2016 -0800
+++ b/langtools/test/ProblemList.txt	Tue Dec 20 06:06:01 2016 -0800
@@ -32,8 +32,6 @@
 jdk/javadoc/tool/varArgs/Main.java                                              8152313    generic-all    convert to doclet test framework
 jdk/javadoc/doclet/testIOException/TestIOException.java                         8164597    windows-all
 
-jdk/javadoc/doclet/testModules/TestModules.java                                 8171413    generic-all    jdk/javadoc/doclet/testModules/TestModules.java failed due to some subtests failed
-
 ###########################################################################
 #
 # jshell
--- a/langtools/test/jdk/javadoc/doclet/lib/JavadocTester.java	Tue Dec 20 05:50:39 2016 -0800
+++ b/langtools/test/jdk/javadoc/doclet/lib/JavadocTester.java	Tue Dec 20 06:06:01 2016 -0800
@@ -373,6 +373,25 @@
      *  or the name of one of the output buffers, identifying
      *  where to look for the search strings.
      * @param expectedFound true if all of the search strings are expected
+     *  to be found, or false if the file is not expected to be found
+     * @param strings the strings to be searched for
+     */
+    public void checkFileAndOutput(String path, boolean expectedFound, String... strings) {
+        if (expectedFound) {
+            checkOutput(path, true, strings);
+        } else {
+            checkFiles(false, path);
+        }
+    }
+
+    /**
+     * Check for content in (or not in) the generated output.
+     * Within the search strings, the newline character \n
+     * will be translated to the platform newline character sequence.
+     * @param path a path within the most recent output directory
+     *  or the name of one of the output buffers, identifying
+     *  where to look for the search strings.
+     * @param expectedFound true if all of the search strings are expected
      *  to be found, or false if all of the strings are expected to be
      *  not found
      * @param strings the strings to be searched for
@@ -383,11 +402,9 @@
         try {
             fileString = readFile(outputDir, path);
         } catch (Error e) {
-            if (!expectedFound) {
-                failed("Error reading file: " + e);
-                return;
-            }
-            throw e;
+            checking("Read file");
+            failed("Error reading file: " + e);
+            return;
         }
         checkOutput(path, fileString, expectedFound, strings);
     }
@@ -413,10 +430,10 @@
             // Find string in file's contents
             boolean isFound = findString(fileString, stringToFind);
             if (isFound == expectedFound) {
-                passed(path + ": " + (isFound ? "found:" : "not found:") + "\n"
+                passed(path + ": following text " + (isFound ? "found:" : "not found:") + "\n"
                         + stringToFind + "\n");
             } else {
-                failed(path + ": " + (isFound ? "found:" : "not found:") + "\n"
+                failed(path + ": following text " + (isFound ? "found:" : "not found:") + "\n"
                         + stringToFind + "\n");
             }
         }
@@ -464,9 +481,9 @@
             File file = new File(outputDir, path);
             boolean isFound = file.exists();
             if (isFound == expectedFound) {
-                passed(path + ": " + (isFound ? "found:" : "not found:") + "\n");
+                passed(path + ": file " + (isFound ? "found:" : "not found:") + "\n");
             } else {
-                failed(path + ": " + (isFound ? "found:" : "not found:") + "\n");
+                failed(path + ": file " + (isFound ? "found:" : "not found:") + "\n");
             }
         }
     }
@@ -619,11 +636,9 @@
             fileContentCache.put(file, new SoftReference<>(content));
             return content;
         } catch (FileNotFoundException e) {
-            System.err.println(e);
-            throw new Error("File not found: " + fileName);
+            throw new Error("File not found: " + fileName + ": " + e);
         } catch (IOException e) {
-            System.err.println(e);
-            throw new Error("Error reading file: " + fileName);
+            throw new Error("Error reading file: " + fileName + ": " + e);
         }
     }
 
--- a/langtools/test/jdk/javadoc/doclet/testHelpOption/TestHelpOption.java	Tue Dec 20 05:50:39 2016 -0800
+++ b/langtools/test/jdk/javadoc/doclet/testHelpOption/TestHelpOption.java	Tue Dec 20 06:06:01 2016 -0800
@@ -171,7 +171,7 @@
                 "-notimestamp ",
                 "-sourcetab ");
 
-        checkOutput("Sample.html", !withOption,
+        checkFileAndOutput("Sample.html", !withOption,
                 "<li><a href=\"help-doc.html\">Help</a></li>");
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testIndentation/p/IndentAnnot.java	Tue Dec 20 06:06:01 2016 -0800
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package p;
+
+public class IndentAnnot {
+    public void f1(int a, int b) {}
+
+    public void f2(int a, Object... b) {}
+
+    @Deprecated
+    public void f3(int a, int b) {}
+
+    @SafeVarargs
+    public void f4(int a, Object... b) {}
+
+    @SafeVarargs
+    @Deprecated
+    public void f5(int a, Object... b) {}
+}
--- a/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java	Tue Dec 20 05:50:39 2016 -0800
+++ b/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java	Tue Dec 20 06:06:01 2016 -0800
@@ -550,11 +550,11 @@
     }
 
     void checkModuleFilesAndLinks(boolean found) {
-        checkOutput("testpkgmdlA/package-summary.html", found,
+        checkFileAndOutput("testpkgmdlA/package-summary.html", found,
                 "<li><a href=\"../moduleA-summary.html\">Module</a></li>",
                 "<div class=\"subTitle\"><span class=\"moduleLabelInClass\">Module</span>&nbsp;"
                 + "<a href=\"../moduleA-summary.html\">moduleA</a></div>");
-        checkOutput("testpkgmdlA/TestClassInModuleA.html", found,
+        checkFileAndOutput("testpkgmdlA/TestClassInModuleA.html", found,
                 "<li><a href=\"../moduleA-summary.html\">Module</a></li>",
                 "<div class=\"subTitle\"><span class=\"moduleLabelInClass\">Module</span>&nbsp;"
                 + "<a href=\"../moduleA-summary.html\">moduleA</a></div>");
@@ -618,14 +618,9 @@
                 + "<tr>\n"
                 + "<th class=\"colFirst\" scope=\"col\">Module</th>\n"
                 + "<th class=\"colLast\" scope=\"col\">Packages</th>\n"
-                + "</tr>\n"
-                + "<tbody>\n"
-                + "<tr class=\"altColor\">\n"
-                + "<th class=\"colFirst\" scope=\"row\"><a href=\"moduleB-summary.html\">moduleB</a></th>\n"
-                + "<td class=\"colLast\"><a href=\"testpkgmdlB/package-summary.html\">testpkgmdlB</a></td>\n"
-                + "</tr>\n"
-                + "</tbody>\n"
-                + "</table>");
+                + "</tr>\n",
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"moduleB-summary.html\">moduleB</a></th>\n"
+                + "<td class=\"colLast\"><a href=\"testpkgmdlB/package-summary.html\">testpkgmdlB</a></td>\n");
         checkOutput("moduleB-summary.html", true,
                 "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlB/TestClassInModuleB.html\" title=\"class in testpkgmdlB\">TestClassInModuleB</a></th>\n"
                 + "<td class=\"colLast\">With a test description for uses.&nbsp;</td>");
@@ -663,14 +658,9 @@
                 + "<tr>\n"
                 + "<th class=\"colFirst\" scope=\"col\">Module</th>\n"
                 + "<th class=\"colLast\" scope=\"col\">Packages</th>\n"
-                + "</tr>\n"
-                + "<tbody>\n"
-                + "<tr class=\"altColor\">\n"
-                + "<th class=\"colFirst\" scope=\"row\"><a href=\"moduleB-summary.html\">moduleB</a></th>\n"
-                + "<td class=\"colLast\"><a href=\"testpkgmdlB/package-summary.html\">testpkgmdlB</a></td>\n"
-                + "</tr>\n"
-                + "</tbody>\n"
-                + "</table>");
+                + "</tr>\n",
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"moduleB-summary.html\">moduleB</a></th>\n"
+                + "<td class=\"colLast\"><a href=\"testpkgmdlB/package-summary.html\">testpkgmdlB</a></td>\n");
     }
 
     void checkModuleModeApi(boolean found) {