8171413: jdk/javadoc/doclet/testModules/TestModules.java failed due to some subtests failed

Reviewed-by: bpatel
This commit is contained in:
Jonathan Gibbons 2016-12-20 06:06:01 -08:00
parent 71b65b06e4
commit 23c1a004ec
5 changed files with 77 additions and 34 deletions
langtools/test
ProblemList.txt
jdk/javadoc/doclet

@ -32,8 +32,6 @@ jdk/javadoc/tool/enum/enumType/Main.java
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

@ -365,6 +365,25 @@ public abstract class JavadocTester {
}
}
/**
* 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 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
@ -383,11 +402,9 @@ public abstract class JavadocTester {
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 @@ public abstract class JavadocTester {
// 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 @@ public abstract class JavadocTester {
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 @@ public abstract class JavadocTester {
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);
}
}

@ -171,7 +171,7 @@ public class TestHelpOption extends JavadocTester {
"-notimestamp ",
"-sourcetab ");
checkOutput("Sample.html", !withOption,
checkFileAndOutput("Sample.html", !withOption,
"<li><a href=\"help-doc.html\">Help</a></li>");
}
}

@ -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) {}
}

@ -550,11 +550,11 @@ public class TestModules extends JavadocTester {
}
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 @@ public class TestModules extends JavadocTester {
+ "<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 @@ public class TestModules extends JavadocTester {
+ "<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) {