Skip to content

Commit

Permalink
Pass execution info to xml generating spawn. Fixes #7794
Browse files Browse the repository at this point in the history
Change [1] splits test execution into two spawns. The first spawn runs
the test and the second spawn generates the test.xml from the test.log
file. This change makes it so that the test.xml-generating spawn also
inherits the execution info from the test target. In particular, if a
test target is tagged with "no-remote" then the test.xml-generating
spawn will also be tagged.

[1] 0858ae1

Closes #7796.

PiperOrigin-RevId: 239608851
  • Loading branch information
buchgr authored and katre committed Mar 21, 2019
1 parent 607d78d commit dfd6e99
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,9 @@ private Spawn createXmlGeneratingSpawn(TestRunnerAction action, SpawnResult resu
"TEST_TOTAL_SHARDS", Integer.toString(action.getExecutionSettings().getTotalShards()),
"TEST_NAME", action.getTestName(),
"TEST_BINARY", testBinaryName),
ImmutableMap.of(),
// Pass the execution info of the action which is identical to the supported tags set on the
// test target. In particular, this does not set the test timeout on the spawn.
ImmutableMap.copyOf(action.getExecutionInfo()),
null,
ImmutableMap.of(),
/*inputs=*/ ImmutableList.of(action.getTestXmlGeneratorScript(), action.getTestLog()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ public void testThatTestLogAndOutputAreReturnedWithSplitXmlGeneration() throws E
" name = \"failing_test\",",
" size = \"small\",",
" srcs = [\"failing_test.sh\"],",
" tags = [\"local\"],",
")");
TestRunnerAction testRunnerAction = getTestAction("//standalone:failing_test");

Expand All @@ -538,6 +539,8 @@ public void testThatTestLogAndOutputAreReturnedWithSplitXmlGeneration() throws E
.thenAnswer(
(invocation) -> {
Spawn spawn = invocation.getArgumentAt(0, Spawn.class);
// Test that both spawns have the local tag attached as a execution info
assertThat(spawn.getExecutionInfo()).containsKey("local");
FileOutErr outErr =
invocation.getArgumentAt(1, ActionExecutionContext.class).getFileOutErr();
called.add(outErr);
Expand Down

0 comments on commit dfd6e99

Please sign in to comment.