From 8e9a0e92906742b17eb08d7fb83cca91965f9b8e Mon Sep 17 00:00:00 2001 From: Narayan Kamath Date: Tue, 28 Apr 2015 11:40:00 +0100 Subject: Update JSR166 tck tests. The following tests have been omitted because they are unsupported : - Atomic8Test.java - CompletableFutureTest.java - ConcurrentHashMap8Test.java - DoubleAccumulatorTest.java - DoubleAdderTest.java - ForkJoinPool8Test.java - ForkJoinTask8Test.java - LongAccumulatorTest.java - LongAdderTest.java - SplittableRandomTest.java - StampedLockTest.java - ThreadLocalRandom8Test.java - ThreadPoolExecutor9Test.java A package declaration has been added to all files (package jsr166;) and the base-class JSR166Test has been changed not to rely on features that aren't available on android / junit in the android environment. We also avoid using junit4 style TestSuite declarations. While the CTS test runner handles them properly usually, it trips over itself when it encounters a failure and tries to run each test in an invidual process and fails each test for no good reason (needs investigation on the CTS side of things) bug: 20628776 (cherry picked from commit 5da8b2b3cac51f0f592a5e1941bd84eade9648cd) Change-Id: If35be0881ad8da4c604ce6683149b15c1a85f289 --- .../src/test/java/jsr166/AtomicReferenceTest.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'jsr166-tests/src/test/java/jsr166/AtomicReferenceTest.java') diff --git a/jsr166-tests/src/test/java/jsr166/AtomicReferenceTest.java b/jsr166-tests/src/test/java/jsr166/AtomicReferenceTest.java index 8032546..457182f 100644 --- a/jsr166-tests/src/test/java/jsr166/AtomicReferenceTest.java +++ b/jsr166-tests/src/test/java/jsr166/AtomicReferenceTest.java @@ -8,10 +8,21 @@ package jsr166; -import junit.framework.*; import java.util.concurrent.atomic.AtomicReference; +import junit.framework.Test; +import junit.framework.TestSuite; + public class AtomicReferenceTest extends JSR166TestCase { + // android-note: Removed because the CTS runner does a bad job of + // retrying tests that have suite() declarations. + // + // public static void main(String[] args) { + // main(suite(), args); + // } + // public static Test suite() { + // return new TestSuite(...); + // } /** * constructor initializes to given value @@ -92,10 +103,10 @@ public class AtomicReferenceTest extends JSR166TestCase { */ public void testWeakCompareAndSet() { AtomicReference ai = new AtomicReference(one); - while (!ai.weakCompareAndSet(one, two)); - while (!ai.weakCompareAndSet(two, m4)); + do {} while (!ai.weakCompareAndSet(one, two)); + do {} while (!ai.weakCompareAndSet(two, m4)); assertSame(m4, ai.get()); - while (!ai.weakCompareAndSet(m4, seven)); + do {} while (!ai.weakCompareAndSet(m4, seven)); assertSame(seven, ai.get()); } -- cgit v1.1