4444import com .google .devtools .build .lib .actions .SpawnResult .Status ;
4545import com .google .devtools .build .lib .actions .UserExecException ;
4646import com .google .devtools .build .lib .actions .util .ActionsTestUtil ;
47- import com .google .devtools .build .lib .events .Event ;
4847import com .google .devtools .build .lib .events .ExtendedEventHandler ;
4948import com .google .devtools .build .lib .exec .ExecutionPolicy ;
5049import com .google .devtools .build .lib .exec .util .SpawnBuilder ;
@@ -308,7 +307,6 @@ public void exec_runAnywhereSpawn_allowsIgnoringFailure() throws Exception {
308307 new DynamicExecutionOptions (),
309308 ignored -> ExecutionPolicy .ANYWHERE ,
310309 ignored -> Optional .empty (),
311- false ,
312310 10 ,
313311 10 ,
314312 (s , context , exitCode , errorMsg , outErr , isLocal ) ->
@@ -355,7 +353,6 @@ public void exec_runAnywhereSpawn_notAlwaysIgnoringFailure() throws Exception {
355353 new DynamicExecutionOptions (),
356354 ignored -> ExecutionPolicy .ANYWHERE ,
357355 ignored -> Optional .empty (),
358- false ,
359356 10 ,
360357 10 ,
361358 (s , context , exitCode , errorMsg , outErr , isLocal ) ->
@@ -389,53 +386,6 @@ public void exec_runAnywhereSpawn_notAlwaysIgnoringFailure() throws Exception {
389386 assertThat (results ).containsExactly (SUCCESSFUL_SPAWN_RESULT , SUCCESSFUL_SPAWN_RESULT );
390387 }
391388
392- @ Test
393- public void exec_localOnlySpawn_skipFirst_isRun () throws Exception {
394- Spawn spawn =
395- new SpawnBuilder ().withMnemonic ("TheThing" ).withOwnerPrimaryOutput (output1 ).build ();
396- DynamicExecutionOptions options = new DynamicExecutionOptions ();
397- options .skipFirstBuild = true ;
398- DynamicSpawnStrategy dynamicSpawnStrategy =
399- createDynamicSpawnStrategy (
400- ExecutionPolicy .LOCAL_EXECUTION_ONLY , (s ) -> Optional .empty (), options , true );
401-
402- SandboxedSpawnStrategy local = createMockSpawnStrategy ();
403- when (local .exec (eq (spawn ), any (), any ())).thenReturn (ImmutableList .of (SUCCESSFUL_SPAWN_RESULT ));
404- SandboxedSpawnStrategy remote = createMockSpawnStrategy ();
405- ActionExecutionContext actionExecutionContext = createMockActionExecutionContext (local , remote );
406-
407- assertThat (dynamicSpawnStrategy .exec (spawn , actionExecutionContext ))
408- .containsExactly (SUCCESSFUL_SPAWN_RESULT );
409- verifyNoInteractions (remote );
410- }
411-
412- @ Test
413- public void exec_runAnywhereSpawn_skipFirst_onlyRemote () throws Exception {
414- Spawn spawn =
415- new SpawnBuilder ().withMnemonic ("TheThing" ).withOwnerPrimaryOutput (output1 ).build ();
416- DynamicExecutionOptions options = new DynamicExecutionOptions ();
417- options .skipFirstBuild = true ;
418- DynamicSpawnStrategy dynamicSpawnStrategy =
419- createDynamicSpawnStrategy (
420- ExecutionPolicy .ANYWHERE , (s ) -> Optional .empty (), options , true );
421-
422- SandboxedSpawnStrategy local = createMockSpawnStrategy ();
423- SandboxedSpawnStrategy remote = createMockSpawnStrategy ();
424- when (remote .exec (eq (spawn ), any (), any ()))
425- .thenReturn (ImmutableList .of (SUCCESSFUL_SPAWN_RESULT ));
426- ActionExecutionContext actionExecutionContext = createMockActionExecutionContext (local , remote );
427- when (actionExecutionContext .getEventHandler ()).thenReturn (reporter );
428-
429- assertThat (dynamicSpawnStrategy .exec (spawn , actionExecutionContext ))
430- .containsExactly (SUCCESSFUL_SPAWN_RESULT );
431- verify (local , never ()).exec (any (), any (), any ());
432- verify (reporter )
433- .handle (
434- Event .info (
435- "Disabling dynamic execution until we have seen a successful build, see"
436- + " --experimental_dynamic_skip_first_build." ));
437- }
438-
439389 @ Test
440390 public void exec_runAnywhereSpawn_excludeTools_onlyRemote () throws Exception {
441391 Spawn spawn =
@@ -448,8 +398,7 @@ public void exec_runAnywhereSpawn_excludeTools_onlyRemote() throws Exception {
448398 options .excludeTools = true ;
449399 options .localExecutionDelay = 0 ;
450400 DynamicSpawnStrategy dynamicSpawnStrategy =
451- createDynamicSpawnStrategy (
452- ExecutionPolicy .ANYWHERE , (s ) -> Optional .empty (), options , true );
401+ createDynamicSpawnStrategy (ExecutionPolicy .ANYWHERE , (s ) -> Optional .empty (), options );
453402
454403 SandboxedSpawnStrategy local = createMockSpawnStrategy ();
455404 SandboxedSpawnStrategy remote = createMockSpawnStrategy ();
@@ -581,17 +530,13 @@ private DynamicSpawnStrategy createDynamicSpawnStrategy(
581530 ExecutionPolicy executionPolicy ,
582531 Function <Spawn , Optional <Spawn >> getPostProcessingSpawnForLocalExecution ) {
583532 return createDynamicSpawnStrategy (
584- executionPolicy ,
585- getPostProcessingSpawnForLocalExecution ,
586- new DynamicExecutionOptions (),
587- false );
533+ executionPolicy , getPostProcessingSpawnForLocalExecution , new DynamicExecutionOptions ());
588534 }
589535
590536 private DynamicSpawnStrategy createDynamicSpawnStrategy (
591537 ExecutionPolicy executionPolicy ,
592538 Function <Spawn , Optional <Spawn >> getPostProcessingSpawnForLocalExecution ,
593- DynamicExecutionOptions options ,
594- boolean isFirst ) {
539+ DynamicExecutionOptions options ) {
595540 checkState (
596541 executorServiceForCleanup == null ,
597542 "Creating the DynamicSpawnStrategy twice in the same test is not supported." );
@@ -601,7 +546,6 @@ private DynamicSpawnStrategy createDynamicSpawnStrategy(
601546 options ,
602547 ignored -> executionPolicy ,
603548 getPostProcessingSpawnForLocalExecution ,
604- isFirst ,
605549 10 ,
606550 10 ,
607551 null );
0 commit comments