aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java
diff options
context:
space:
mode:
authorGravatar cpeyser <cpeyser@google.com>2018-02-26 12:03:24 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-02-26 12:04:56 -0800
commita457b87fe12d732f57a0bf20e8423b6c19cb4830 (patch)
tree5ed64cbd2409e8c16bc80a875207403bd1443336 /src/test/java
parentaea01efa1eae35edb597dc17b386c3764d56441f (diff)
Expose SimpleCycleDetector. Also, allow MemoizingEvaluatorTest to support evaluators that do not store errors alongside values, but which still support error transience.
PiperOrigin-RevId: 187058808
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java31
1 files changed, 26 insertions, 5 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 b1518fc3b9..7521dd3ea6 100644
--- a/src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java
+++ b/src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java
@@ -1207,11 +1207,25 @@ public class MemoizingEvaluatorTest {
}
}
- /** {@link ParallelEvaluator} can be configured to not store errors alongside recovered values. */
+ /**
+ * {@link ParallelEvaluator} can be configured to not store errors alongside recovered values.
+ *
+ * @param errorsStoredAlongsideValues true if we expect Skyframe to store the error for the
+ * cycle in ErrorInfo. If true, supportsTransientExceptions must be true as well.
+ * @param supportsTransientExceptions true if we expect Skyframe to mark an ErrorInfo as transient
+ * for certain exception types.
+ * @param useTransientError true if the test should set the {@link TestFunction} it creates to
+ * throw a transient error.
+ */
protected void parentOfCycleAndErrorInternal(
- boolean errorsStoredAlongsideValues, boolean useTransientError)
+ boolean errorsStoredAlongsideValues,
+ boolean supportsTransientExceptions,
+ boolean useTransientError)
throws Exception {
initializeTester();
+ if (errorsStoredAlongsideValues) {
+ Preconditions.checkArgument(supportsTransientExceptions);
+ }
SkyKey cycleKey1 = GraphTester.toSkyKey("cycleKey1");
SkyKey cycleKey2 = GraphTester.toSkyKey("cycleKey2");
SkyKey mid = GraphTester.toSkyKey("mid");
@@ -1247,8 +1261,13 @@ public class MemoizingEvaluatorTest {
} else {
// When errors are not stored alongside values, transient errors that are recovered from do
// not make the parent transient
- assertThatErrorInfo(errorInfo).isNotTransient();
- assertThatErrorInfo(errorInfo).hasExceptionThat().isNull();
+ if (supportsTransientExceptions) {
+ assertThatErrorInfo(errorInfo).isTransient();
+ assertThatErrorInfo(errorInfo).hasExceptionThat().isNotNull();
+ } else {
+ assertThatErrorInfo(errorInfo).isNotTransient();
+ assertThatErrorInfo(errorInfo).hasExceptionThat().isNull();
+ }
}
if (cyclesDetected()) {
assertThatErrorInfo(errorInfo)
@@ -1267,7 +1286,9 @@ public class MemoizingEvaluatorTest {
@Test
public void parentOfCycleAndError() throws Exception {
parentOfCycleAndErrorInternal(
- /*errorsStoredAlongsideValues=*/ true, /*useTransientError=*/ true);
+ /*errorsStoredAlongsideValues=*/ true,
+ /*supportsTransientExceptions=*/ true,
+ /*useTransientError=*/ true);
}
/**