From 5f1087c1799e355d71c32671ccd2d62dd4017da7 Mon Sep 17 00:00:00 2001 From: emilyguo Date: Mon, 21 Mar 2022 06:20:21 -0700 Subject: [PATCH] Change `getValues` to `get(Ordered)ValuesAndExceptions` in Skyframe Test files since `getValues` is going to be removed in Skyfunction. PiperOrigin-RevId: 436186631 --- .../skyframe/MemoizingEvaluatorTest.java | 22 ++++++++++--------- .../build/skyframe/ParallelEvaluatorTest.java | 6 ++--- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java b/src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java index fa869cd5784ab0..78ef0582179eef 100644 --- a/src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java +++ b/src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java @@ -1132,7 +1132,7 @@ public void cycleAboveIndependentCycle() throws Exception { @Nullable @Override public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedException { - env.getValues(ImmutableList.of(leafKey, bKey)); + env.getOrderedValuesAndExceptions(ImmutableList.of(leafKey, bKey)); return null; } }); @@ -1243,8 +1243,8 @@ public void cycleAndSelfEdgeWithDirtyValueInSameGroup() throws Exception { @Override public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedException { // The order here is important -- 2 before 1. - Map result = - env.getValues(ImmutableList.of(cycleKey2, cycleKey1)); + SkyframeIterableResult result = + env.getOrderedValuesAndExceptions(ImmutableList.of(cycleKey2, cycleKey1)); Preconditions.checkState(env.valuesMissing(), result); return null; } @@ -1581,7 +1581,7 @@ public void nodeInvalidatedThenDoubleCycle() throws InterruptedException { @Nullable @Override public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedException { - env.getValues(ImmutableList.of(topKey, depKey)); + env.getOrderedValuesAndExceptions(ImmutableList.of(topKey, depKey)); assertThat(env.valuesMissing()).isTrue(); return null; } @@ -2114,7 +2114,7 @@ public void errorInDependencyGroup() throws Exception { .getOrCreate(topKey) .setBuilder( (skyKey, env) -> { - env.getValues(ImmutableList.of(errorKey, midKey, mid2Key)); + env.getOrderedValuesAndExceptions(ImmutableList.of(errorKey, midKey, mid2Key)); if (env.valuesMissing()) { return null; } @@ -2153,7 +2153,8 @@ public void valueInErrorWithGroups() throws Exception { (skyKey, env) -> { SkyKeyValue val = ((SkyKeyValue) - env.getValues(ImmutableList.of(groupDepA, groupDepB)).get(groupDepA)); + env.getOrderedValuesAndExceptions(ImmutableList.of(groupDepA, groupDepB)) + .next()); if (env.valuesMissing()) { return null; } @@ -2519,7 +2520,8 @@ protected void runResetNodeOnRequest_withDeps(RunResetNodeOnRequestWithDepsMode if (dep1 == null) { return null; } - env.getValues(ImmutableList.of(newlyRequestedDoneDep, newlyRequestedNotDoneDep)); + env.getOrderedValuesAndExceptions( + ImmutableList.of(newlyRequestedDoneDep, newlyRequestedNotDoneDep)); if (numFunctionCalls.get() < 4) { return Restart.SELF; } else if (numFunctionCalls.get() == 4) { @@ -2606,7 +2608,7 @@ private void missingDirtyChild(boolean sameGroup) throws Exception { @Override public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedException { if (sameGroup) { - env.getValues(ImmutableSet.of(presentChild, missingChild)); + env.getOrderedValuesAndExceptions(ImmutableSet.of(presentChild, missingChild)); } else { env.getValue(presentChild); if (env.valuesMissing()) { @@ -2691,14 +2693,14 @@ public void sameDepInTwoGroups() throws Exception { // Request the first group, [leaf0, leaf1, leaf2]. // In the first build, it has values ["leaf2", "leaf3", "leaf4"]. // In the second build it has values ["leaf2", "leaf3", "leaf5"] - Map values = env.getValues(leaves); + SkyframeLookupResult values = env.getValuesAndExceptions(leaves); if (env.valuesMissing()) { return null; } // Request the second group. In the first build it's [leaf2, leaf4]. // In the second build it's [leaf2, leaf5] - env.getValues( + env.getOrderedValuesAndExceptions( ImmutableList.of( leaves.get(2), GraphTester.toSkyKey(((StringValue) values.get(leaves.get(2))).getValue()))); diff --git a/src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java b/src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java index 124a5faf401967..59468932d21701 100644 --- a/src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java +++ b/src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java @@ -923,7 +923,7 @@ public void incrementalCycleWithCatastropheAndFailedBubbleUp() throws Exception @Nullable @Override public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedException { - env.getValues(ImmutableList.of(cycleKey)); + env.getValue(cycleKey); return env.valuesMissing() ? null : topValue; } }); @@ -934,7 +934,7 @@ public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedExcept @Nullable @Override public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedException { - env.getValues(ImmutableList.of(cycleKey, catastropheKey)); + env.getOrderedValuesAndExceptions(ImmutableList.of(cycleKey, catastropheKey)); Preconditions.checkState(env.valuesMissing()); return null; } @@ -2042,7 +2042,7 @@ public void getValueOrThrowWithErrors(@TestParameter boolean keepGoing) throws E } catch (SomeErrorException e) { // Recover from the child error. } - env.getValues(deps); + env.getOrderedValuesAndExceptions(deps); if (env.valuesMissing()) { return null; }