From 97139ce9e373a85280ed10cf1be621d2a0661427 Mon Sep 17 00:00:00 2001 From: Chi Wang Date: Tue, 29 Dec 2020 17:26:21 +0800 Subject: [PATCH] Mark test.xml omitted if it wasn't generated --- .../build/lib/exec/StandaloneTestStrategy.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java b/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java index 5db48704644857..0f31a01ad4dfe6 100644 --- a/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java +++ b/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java @@ -774,18 +774,17 @@ public TestAttemptContinuation execute() } + MetadataHandler metadataHandler = actionExecutionContext.getMetadataHandler(); + Path xmlOutputPath = resolvedPaths.getXmlOutputPath(); boolean testXmlExists = xmlOutputPath.exists(); - if (!testXmlExists) { - MetadataHandler metadataHandler = actionExecutionContext.getMetadataHandler(); - if (metadataHandler != null) { + if (!testXmlExists && metadataHandler != null) { try { // Check whether test.xml exists. If not, an IOException will be thrown. metadataHandler.getMetadata(testAction.getTestXml()); testXmlExists = true; } catch (IOException ignored) { } - } } // If the test did not create a test.xml, and --experimental_split_xml_generation is enabled, @@ -814,6 +813,10 @@ public TestAttemptContinuation execute() } } + if (!testXmlExists && metadataHandler != null) { + metadataHandler.markOmitted(testAction.getTestXml()); + } + TestCase details = parseTestResult(xmlOutputPath); if (details != null) { testResultDataBuilder.setTestCase(details);