@@ -119,6 +119,7 @@ public class TestRunnerAction extends AbstractAction
119
119
private final BuildConfigurationValue configuration ;
120
120
private final TestConfiguration testConfiguration ;
121
121
private final Artifact testLog ;
122
+ private final ActionInput testXml ;
122
123
private final Artifact cacheStatus ;
123
124
private final PathFragment testWarningsPath ;
124
125
private final PathFragment unusedRunfilesLogPath ;
@@ -129,7 +130,6 @@ public class TestRunnerAction extends AbstractAction
129
130
private final PathFragment undeclaredOutputsManifestPath ;
130
131
private final PathFragment undeclaredOutputsAnnotationsPath ;
131
132
private final PathFragment undeclaredOutputsAnnotationsPbPath ;
132
- private final PathFragment xmlOutputPath ;
133
133
@ Nullable private final PathFragment testShard ;
134
134
private final PathFragment testExitSafe ;
135
135
private final PathFragment testStderr ;
@@ -199,6 +199,7 @@ private static ImmutableSet<Artifact> nonNullAsSet(Artifact... artifacts) {
199
199
@ Nullable
200
200
FilesToRunProvider collectCoverageScript , // filesToRun must be in input, if not null
201
201
Artifact testLog ,
202
+ ActionInput testXml ,
202
203
Artifact cacheStatus ,
203
204
Artifact coverageArtifact ,
204
205
@ Nullable Artifact coverageDirectory ,
@@ -219,7 +220,13 @@ private static ImmutableSet<Artifact> nonNullAsSet(Artifact... artifacts) {
219
220
owner ,
220
221
inputs ,
221
222
nonNullAsSet (
222
- testLog , cacheStatus , coverageArtifact , coverageDirectory , undeclaredOutputsDir ));
223
+ testLog ,
224
+ // See TestActionBuilder.TEST_XML_IS_ACTION_OUTPUT for details.
225
+ testXml instanceof Artifact testXmlArtifact ? testXmlArtifact : null ,
226
+ cacheStatus ,
227
+ coverageArtifact ,
228
+ coverageDirectory ,
229
+ undeclaredOutputsDir ));
223
230
Preconditions .checkState ((collectCoverageScript == null ) == (coverageArtifact == null ));
224
231
this .runfilesTree = runfilesTree ;
225
232
this .testSetupScript = testSetupScript ;
@@ -228,6 +235,7 @@ private static ImmutableSet<Artifact> nonNullAsSet(Artifact... artifacts) {
228
235
this .configuration = checkNotNull (configuration );
229
236
this .testConfiguration = checkNotNull (configuration .getFragment (TestConfiguration .class ));
230
237
this .testLog = testLog ;
238
+ this .testXml = testXml ;
231
239
this .cacheStatus = cacheStatus ;
232
240
this .coverageData = coverageArtifact ;
233
241
this .coverageDirectory = coverageDirectory ;
@@ -246,7 +254,6 @@ private static ImmutableSet<Artifact> nonNullAsSet(Artifact... artifacts) {
246
254
this .testExitSafe = baseDir .getChild ("test.exited_prematurely" );
247
255
// testShard Path should be set only if sharding is enabled.
248
256
this .testShard = totalShards > 1 ? baseDir .getChild ("test.shard" ) : null ;
249
- this .xmlOutputPath = baseDir .getChild ("test.xml" );
250
257
this .testWarningsPath = baseDir .getChild ("test.warnings" );
251
258
this .unusedRunfilesLogPath = baseDir .getChild ("test.unused_runfiles_log" );
252
259
this .testStderr = baseDir .getChild ("test.err" );
@@ -282,7 +289,6 @@ private static ImmutableSet<Artifact> nonNullAsSet(Artifact... artifacts) {
282
289
ImmutableSet .Builder <PathFragment > filesToDeleteBuilder =
283
290
ImmutableSet .<PathFragment >builder ()
284
291
.add (
285
- xmlOutputPath ,
286
292
testWarningsPath ,
287
293
unusedRunfilesLogPath ,
288
294
testStderr ,
@@ -292,6 +298,9 @@ private static ImmutableSet<Artifact> nonNullAsSet(Artifact... artifacts) {
292
298
// instead.
293
299
baseDir .getChild ("coverage.dat" ),
294
300
baseDir .getChild ("test.zip" )); // Delete files fetched from remote execution.
301
+ if (!(testXml instanceof Artifact )) {
302
+ filesToDeleteBuilder .add (testXml .getExecPath ());
303
+ }
295
304
if (testShard != null ) {
296
305
filesToDeleteBuilder .add (testShard );
297
306
}
@@ -360,7 +369,7 @@ public boolean checkShardingSupport() {
360
369
361
370
public List <ActionInput > getSpawnOutputs () {
362
371
final List <ActionInput > outputs = new ArrayList <>();
363
- outputs .add (ActionInputHelper . fromPath ( getXmlOutputPath ()) );
372
+ outputs .add (testXml );
364
373
outputs .add (ActionInputHelper .fromPath (getExitSafeFile ()));
365
374
if (isSharded ()) {
366
375
outputs .add (ActionInputHelper .fromPath (getTestShard ()));
@@ -767,7 +776,7 @@ public void setupEnvVariables(Map<String, String> env) {
767
776
env .put ("TEST_TOTAL_SHARDS" , Integer .toString (getExecutionSettings ().getTotalShards ()));
768
777
env .put ("TEST_SHARD_STATUS_FILE" , getTestShard ().getPathString ());
769
778
}
770
- env .put ("XML_OUTPUT_FILE" , getXmlOutputPath (). getPathString ());
779
+ env .put ("XML_OUTPUT_FILE" , testXml . getExecPathString ());
771
780
772
781
if (!configuration .runfilesEnabled ()) {
773
782
// If runfiles are disabled, tell remote-runtest.sh/local-runtest.sh about that.
@@ -826,6 +835,10 @@ public Artifact getTestLog() {
826
835
return testLog ;
827
836
}
828
837
838
+ public ActionInput getTestXml () {
839
+ return testXml ;
840
+ }
841
+
829
842
/** Returns all environment variables which must be set in order to run this test. */
830
843
public ActionEnvironment getExtraTestEnv () {
831
844
return extraTestEnv ;
@@ -900,11 +913,6 @@ public PathFragment getInfrastructureFailureFile() {
900
913
return testInfrastructureFailure ;
901
914
}
902
915
903
- /** Returns path to the optionally created XML output file created by the test. */
904
- public PathFragment getXmlOutputPath () {
905
- return xmlOutputPath ;
906
- }
907
-
908
916
/** Returns coverage data artifact or null if code coverage was not requested. */
909
917
@ Nullable
910
918
public Artifact getCoverageData () {
@@ -1184,7 +1192,7 @@ public Path getInfrastructureFailureFile() {
1184
1192
1185
1193
/** Returns path to the optionally created XML output file created by the test. */
1186
1194
public Path getXmlOutputPath () {
1187
- return getPath (xmlOutputPath );
1195
+ return getPath (testXml . getExecPath () );
1188
1196
}
1189
1197
1190
1198
public Path getCoverageDirectory () {
0 commit comments