Skip to content

Commit

Permalink
Consider memory-minimizing flags in conflict checking tests.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 617122179
Change-Id: I3d515cedbe0994d197ff2656347de7160079307a
  • Loading branch information
joeleba authored and copybara-github committed Mar 19, 2024
1 parent 3838620 commit f07c26e
Showing 1 changed file with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
public class OutputArtifactConflictTest extends BuildIntegrationTestCase {

@TestParameter boolean skymeld;
@TestParameter boolean minimizeMemory;

static class AnalysisFailureEventListener extends BlazeModule {

Expand Down Expand Up @@ -80,6 +81,13 @@ protected BlazeRuntime.Builder getRuntimeBuilder() throws Exception {
@Before
public void setup() {
addOptions("--experimental_merged_skyframe_analysis_execution=" + skymeld);
if (minimizeMemory) {
addOptions(
"--notrack_incremental_state",
"--discard_analysis_cache",
"--nokeep_state_after_build",
"--heuristically_drop_nodes");
}
}

private void writeConflictBzl() throws IOException {
Expand Down Expand Up @@ -648,6 +656,14 @@ public void testTwoConflictingTargets_keepGoing_behaviorDifferences() throws Exc

Code errorCode =
assertThrowsExceptionWhenBuildingTargets(/*keepGoing=*/ true, "//x:y", "//x/y:y");

assertThat(errorCode).isEqualTo(Code.NOT_ALL_TARGETS_ANALYZED);

if (minimizeMemory) {
// The states might have been dropped, so we can't check further here.
return;
}

Path outputXY = Iterables.getOnlyElement(getArtifacts("//x:y")).getPath();
Path outputXYY = Iterables.getOnlyElement(getArtifacts("//x/y:y")).getPath();

Expand All @@ -659,11 +675,12 @@ public void testTwoConflictingTargets_keepGoing_behaviorDifferences() throws Exc
assertThat(outputXY.exists()).isFalse();
assertThat(outputXYY.exists()).isFalse();
}
assertThat(errorCode).isEqualTo(Code.NOT_ALL_TARGETS_ANALYZED);
}

@Test
public void dependencyHasConflict_keepGoing_bothTopLevelTargetsFail() throws Exception {
// TODO(b/326363176) Known bug.
assume().that(minimizeMemory).isFalse();
addOptions("--keep_going");
writeConflictBzl();
write(
Expand Down Expand Up @@ -710,7 +727,7 @@ public void dependencyHasConflict_keepGoing_bothTopLevelTargetsFail() throws Exc

@Test
public void conflict_noTrackIncrementalState_detected() throws Exception {
addOptions("--notrack_incremental_state");
assume().that(minimizeMemory).isTrue();
writeConflictBzl();
write(
"foo/BUILD",
Expand Down

0 comments on commit f07c26e

Please sign in to comment.