diff --git a/scripts/releng/BuildDropDataGenerator.java b/scripts/releng/BuildDropDataGenerator.java index 5a9a39eddac..48b725d3462 100644 --- a/scripts/releng/BuildDropDataGenerator.java +++ b/scripts/releng/BuildDropDataGenerator.java @@ -151,7 +151,7 @@ void buildLogsPageData() throws IOException { JSON.Array comparatorLogs = colleFilesInDirectory(comparatorLogsDirectory, _ -> true, files); logFiles.add("comparator", comparatorLogs); - Path file = DIRECTORY.resolve("buildlogs/logFiles.json"); + Path file = DIRECTORY.resolve("buildlogs/logs.json"); IO.println("Write RelEng logs data to: " + file); JSON.write(logFiles, file); } diff --git a/scripts/releng/TestResultsGenerator.java b/scripts/releng/TestResultsGenerator.java index ede48fec8eb..40943fd3b96 100644 --- a/scripts/releng/TestResultsGenerator.java +++ b/scripts/releng/TestResultsGenerator.java @@ -15,6 +15,8 @@ * Hannes Wellmann - split TestResultsGenerator and CompilerSummaryGenerator *******************************************************************************/ +import static utilities.XmlProcessorFactoryRelEng.elements; + import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -33,7 +35,6 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; @@ -69,14 +70,14 @@ public class TestResultsGenerator { * if the file is missing or something is wrong with the file (such as is * incomplete). */ - private int countErrors(Path fileName) throws ParserConfigurationException, SAXException, IOException { + private void collectErrors(Path fileName, JSON.Object test) + throws ParserConfigurationException, SAXException, IOException { int errorCount = -99; // File should exists, since we are "driving" this based on file list // ... but, just in case. if (!Files.exists(fileName)) { errorCount = -1; } else { - if (Files.size(fileName) == 0) { errorCount = -2; } else { @@ -93,16 +94,16 @@ private int countErrors(Path fileName) throws ParserConfigurationException, SAXE // need to // loop through each to count all errors and failures. errorCount = 0; - for (int i = 0; i < elementCount; i++) { - final Element element = (Element) elements.item(i); - final NamedNodeMap attributes = element.getAttributes(); - Node aNode = attributes.getNamedItem("errors"); - if (aNode != null) { - errorCount = errorCount + Integer.parseInt(aNode.getNodeValue()); - } - aNode = attributes.getNamedItem("failures"); - errorCount = errorCount + Integer.parseInt(aNode.getNodeValue()); + JSON.Array suites = JSON.Array.create(); + for (Element element : elements(elements)) { + String errorsValue = element.getAttribute("errors"); + String failuresValue = element.getAttribute("failures"); + errorCount += errorsValue.isEmpty() ? 0 : Integer.parseInt(errorsValue); + errorCount += failuresValue.isEmpty() ? 0 : Integer.parseInt(failuresValue); + String testSuiteFQN = element.getAttribute("package") + "." + element.getAttribute("name"); + suites.add(JSON.String.create(testSuiteFQN)); } + test.add("suites", suites); } } catch (final IOException e) { println("ERROR: IOException: " + fileName); @@ -118,7 +119,7 @@ private int countErrors(Path fileName) throws ParserConfigurationException, SAXE } } } - return errorCount; + test.add("errors", JSON.Integer.create(errorCount)); } public static void main(String[] args) throws Exception { @@ -160,14 +161,12 @@ private void parseJUnitTestsXml() throws Exception { for (Path junitResultsFile : allFiles) { checkIfMissingFromTestManifestFile(junitResultsFile); String filename = junitResultsFile.getFileName().toString(); - int errorCount = countErrors(junitResultsFile); - String displayName = computeDisplayName(computeCoreName(filename)); - String configuration = computeConfig(filename); - JSON.Object test = JSON.Object.create(); - test.add("errors", JSON.Integer.create(errorCount)); + collectErrors(junitResultsFile, test); + String testPluginName = computeCoreName(filename); + String configuration = computeConfig(filename); JSON.Object summary = summaries.computeIfAbsent(configuration, c -> JSON.Object.create()); - summary.add(displayName, test); + summary.add(testPluginName, test); } println("DEBUG: End: Parsing XML JUnit results files"); @@ -242,15 +241,6 @@ private static String computeCoreName(String fname) { return firstUnderscorepos == -1 ? fname : fname.substring(0, firstUnderscorepos); } - private static final String ECLIPSE_PREFIX = "org.eclipse."; - - private static String computeDisplayName(String name) { - if (name.startsWith(ECLIPSE_PREFIX)) { - return name.substring(ECLIPSE_PREFIX.length()); - } - throw new IllegalArgumentException(); - } - private static String computeConfig(String fname) { int firstUnderscorepos = fname.indexOf('_'); if (firstUnderscorepos == -1) { diff --git a/scripts/releng/utilities/XmlProcessorFactoryRelEng.java b/scripts/releng/utilities/XmlProcessorFactoryRelEng.java index d4bbc4e7aa8..2c793735bdc 100644 --- a/scripts/releng/utilities/XmlProcessorFactoryRelEng.java +++ b/scripts/releng/utilities/XmlProcessorFactoryRelEng.java @@ -14,11 +14,14 @@ package utilities; import java.io.ByteArrayInputStream; +import java.util.stream.IntStream; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; @@ -102,4 +105,9 @@ public static synchronized DocumentBuilder createDocumentBuilderIgnoringDOCTYPE( return builder; } + public static Iterable elements(NodeList list) { + return () -> IntStream.range(0, list.getLength()).mapToObj(list::item).filter(Element.class::isInstance) + .map(Element.class::cast).iterator(); + } + } \ No newline at end of file diff --git a/sites/eclipse/build/buildlogs/logs.html b/sites/eclipse/build/buildlogs/logs.html index 0e9943f8b5e..a8693a297d1 100644 --- a/sites/eclipse/build/buildlogs/logs.html +++ b/sites/eclipse/build/buildlogs/logs.html @@ -3,7 +3,7 @@ - RelEng Logs + RelEng Logs @@ -39,7 +39,7 @@

Comparator Logs

+ + + +
+ Downloads + ${label} + Test Logs +
+ +
+

Test Console Logs for ${label}

+

Console Logs

+

These logs contain the console output captured while running the JUnit automated tests.

+ +
+ +
+ + + + + \ No newline at end of file diff --git a/sites/eclipse/build/tests.html b/sites/eclipse/build/tests.html index 5d06409099b..de498da1b46 100644 --- a/sites/eclipse/build/tests.html +++ b/sites/eclipse/build/tests.html @@ -22,7 +22,7 @@

Logs