# HG changeset patch # User jjg # Date 1482242761 28800 # Node ID 2f0b2a65b2848b9bb7f3d88593df1cb1ec9f6969 # Parent 1768507dae6b3621fa27852cf271e6117e8f2e32 8171413: jdk/javadoc/doclet/testModules/TestModules.java failed due to some subtests failed Reviewed-by: bpatel diff -r 1768507dae6b -r 2f0b2a65b284 langtools/test/ProblemList.txt --- 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 diff -r 1768507dae6b -r 2f0b2a65b284 langtools/test/jdk/javadoc/doclet/lib/JavadocTester.java --- 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); } } diff -r 1768507dae6b -r 2f0b2a65b284 langtools/test/jdk/javadoc/doclet/testHelpOption/TestHelpOption.java --- 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, "