--- jsr166/src/test/tck/PhaserTest.java 2017/05/13 23:05:02 1.46 +++ jsr166/src/test/tck/PhaserTest.java 2021/01/26 13:33:06 1.51 @@ -261,7 +261,7 @@ public class PhaserTest extends JSR166Te * the phase number increments correctly when tripping the barrier */ public void testPhaseIncrement1() { - for (int size = 1; size < nine; size++) { + for (int size = 1; size < 9; size++) { final Phaser phaser = new Phaser(size); for (int index = 0; index <= (1 << size); index++) { int phase = phaser.arrive(); @@ -453,7 +453,7 @@ public class PhaserTest extends JSR166Te /** * awaitAdvanceInterruptibly blocks interruptibly */ - public void testAwaitAdvanceInterruptibly_interruptible() throws InterruptedException { + public void testAwaitAdvanceInterruptibly_Interruptible() throws InterruptedException { final Phaser phaser = new Phaser(1); final CountDownLatch pleaseInterrupt = new CountDownLatch(2); @@ -478,14 +478,14 @@ public class PhaserTest extends JSR166Te public void realRun() throws TimeoutException { Thread.currentThread().interrupt(); try { - phaser.awaitAdvanceInterruptibly(0, 2*LONG_DELAY_MS, MILLISECONDS); + phaser.awaitAdvanceInterruptibly(0, randomTimeout(), randomTimeUnit()); shouldThrow(); } catch (InterruptedException success) {} assertFalse(Thread.interrupted()); pleaseInterrupt.countDown(); try { - phaser.awaitAdvanceInterruptibly(0, 2*LONG_DELAY_MS, MILLISECONDS); + phaser.awaitAdvanceInterruptibly(0, LONGER_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) {} assertFalse(Thread.interrupted()); @@ -493,7 +493,8 @@ public class PhaserTest extends JSR166Te await(pleaseInterrupt); assertState(phaser, 0, 1, 1); - assertThreadsStayAlive(t1, t2); + if (randomBoolean()) assertThreadBlocks(t1, Thread.State.WAITING); + if (randomBoolean()) assertThreadBlocks(t2, Thread.State.TIMED_WAITING); t1.interrupt(); t2.interrupt(); awaitTermination(t1);