aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java
diff options
context:
space:
mode:
authorGravatar janakr <janakr@google.com>2017-11-21 05:45:25 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2017-11-21 05:47:21 -0800
commit34d02ef1a47cdb7847fdd12e96d7532dc7e0d7df (patch)
treef75cf9c6dded0dcb065dd165cc7c35605a5cafce /src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java
parent9bb93ee8c0edae911f9e2adeaca8aebd406788b6 (diff)
Clear interrupted bit in thread when throwing an interrupted exception that came from an AbstractParallelEvaluator evaluation. It's against the standard Java contract to throw but still have the thread's interrupted bit set.
Also get rid of some unnecessary initializeTester() calls in MemoizingEvaluatorTest: we already call it via a @Before annotation. PiperOrigin-RevId: 176496034
Diffstat (limited to 'src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java')
-rw-r--r--src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java16
1 files changed, 13 insertions, 3 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 061357af77..f82719dfaf 100644
--- a/src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java
+++ b/src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java
@@ -241,6 +241,19 @@ public class MemoizingEvaluatorTest {
}
@Test
+ public void interruptBitCleared() throws Exception {
+ SkyKey interruptKey = GraphTester.skyKey("interrupt");
+ tester.getOrCreate(interruptKey).setBuilder(INTERRUPT_BUILDER);
+ try {
+ tester.eval(/*keepGoing=*/ true, interruptKey);
+ fail("Expected interrupt");
+ } catch (InterruptedException e) {
+ // Expected.
+ }
+ assertThat(Thread.interrupted()).isFalse();
+ }
+
+ @Test
public void crashAfterInterruptCrashes() throws Exception {
SkyKey failKey = GraphTester.skyKey("fail");
SkyKey badInterruptkey = GraphTester.skyKey("bad-interrupt");
@@ -1736,7 +1749,6 @@ public class MemoizingEvaluatorTest {
@Test
public void continueWithErrorDepTurnedGood() throws Exception {
- initializeTester();
SkyKey errorKey = GraphTester.toSkyKey("my_error_value");
tester.getOrCreate(errorKey).setHasError(true);
tester.set("after", new StringValue("after"));
@@ -2664,7 +2676,6 @@ public class MemoizingEvaluatorTest {
@Test
public void changePruning() throws Exception {
- initializeTester();
SkyKey leaf = GraphTester.toSkyKey("leaf");
SkyKey mid = GraphTester.toSkyKey("mid");
SkyKey top = GraphTester.toSkyKey("top");
@@ -2722,7 +2733,6 @@ public class MemoizingEvaluatorTest {
@Test
public void changePruningAfterParentPrunes() throws Exception {
- initializeTester();
final SkyKey leaf = GraphTester.toSkyKey("leaf");
SkyKey top = GraphTester.toSkyKey("top");
tester.set(leaf, new StringValue("leafy"));