changeset 311:92056492425b

tests-custom: sample CountDownLatch tests.
author shade
date Thu, 21 Jul 2016 23:04:16 +0300
parents a6d41e7168f1
children 187018b03218
files tests-custom/src/main/java/org/openjdk/jcstress/tests/countdownlatch/effects/IntBoundedTest.java tests-custom/src/main/java/org/openjdk/jcstress/tests/countdownlatch/effects/IntUnboundedTest.java tests-custom/src/main/java/org/openjdk/jcstress/tests/countdownlatch/effects/StringBoundedTest.java tests-custom/src/main/java/org/openjdk/jcstress/tests/countdownlatch/effects/StringUnboundedTest.java tests-custom/src/main/java/org/openjdk/jcstress/tests/countdownlatch/racy/BoundedSingleTest.java tests-custom/src/main/java/org/openjdk/jcstress/tests/countdownlatch/racy/UnboundedSingleTest.java tests-custom/src/main/java/org/openjdk/jcstress/tests/countdownlatch/waits/BoundedDoubleTest.java tests-custom/src/main/java/org/openjdk/jcstress/tests/countdownlatch/waits/BoundedSingleTest.java tests-custom/src/main/java/org/openjdk/jcstress/tests/countdownlatch/waits/UnboundedDoubleTest.java tests-custom/src/main/java/org/openjdk/jcstress/tests/countdownlatch/waits/UnboundedSingleTest.java
diffstat 10 files changed, 633 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/countdownlatch/effects/IntBoundedTest.java	Thu Jul 21 23:04:16 2016 +0300
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jcstress.tests.countdownlatch.effects;
+
+import org.openjdk.jcstress.annotations.*;
+import org.openjdk.jcstress.infra.results.IntResult2;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+@JCStressTest
+@Outcome(id = "1, 1", expect = Expect.ACCEPTABLE, desc = "Unlocked fine, and observed the happens-before result")
+@State
+public class IntBoundedTest {
+
+    int x;
+    CountDownLatch latch = new CountDownLatch(1);
+
+
+    @Actor
+    public void actor1() {
+        x = 1;
+        latch.countDown();
+    }
+
+    @Actor
+    public void actor2(IntResult2 r) {
+        try {
+            latch.await(1, TimeUnit.DAYS);
+            r.r1 = x;
+            r.r2 = 1;
+        } catch (InterruptedException e) {
+            r.r1 = -1;
+            r.r2 = -1;
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/countdownlatch/effects/IntUnboundedTest.java	Thu Jul 21 23:04:16 2016 +0300
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jcstress.tests.countdownlatch.effects;
+
+import org.openjdk.jcstress.annotations.*;
+import org.openjdk.jcstress.infra.results.IntResult2;
+
+import java.util.concurrent.CountDownLatch;
+
+@JCStressTest
+@Outcome(id = "1, 1", expect = Expect.ACCEPTABLE, desc = "Unlocked fine, and observed the happens-before result")
+@State
+public class IntUnboundedTest {
+
+    int x;
+    CountDownLatch latch = new CountDownLatch(1);
+
+    @Actor
+    public void actor1() {
+        x = 1;
+        latch.countDown();
+    }
+
+    @Actor
+    public void actor2(IntResult2 r) {
+        try {
+            latch.await();
+            r.r1 = x;
+            r.r2 = 1;
+        } catch (InterruptedException e) {
+            r.r1 = -1;
+            r.r2 = -1;
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/countdownlatch/effects/StringBoundedTest.java	Thu Jul 21 23:04:16 2016 +0300
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jcstress.tests.countdownlatch.effects;
+
+import org.openjdk.jcstress.annotations.*;
+import org.openjdk.jcstress.infra.results.IntResult2;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+@JCStressTest
+@Outcome(id = "1, 1", expect = Expect.ACCEPTABLE, desc = "Unlocked fine, and observed the happens-before result")
+@State
+public class StringBoundedTest {
+
+    String x;
+    CountDownLatch latch = new CountDownLatch(1);
+
+
+    @Actor
+    public void actor1() {
+        x = new String("data");
+        latch.countDown();
+    }
+
+    @Actor
+    public void actor2(IntResult2 r) {
+        try {
+            latch.await(1, TimeUnit.DAYS);
+            r.r1 = x.equals("data") ? 1 : 0;
+            r.r2 = 1;
+        } catch (InterruptedException e) {
+            r.r1 = -1;
+            r.r2 = -1;
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/countdownlatch/effects/StringUnboundedTest.java	Thu Jul 21 23:04:16 2016 +0300
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jcstress.tests.countdownlatch.effects;
+
+import org.openjdk.jcstress.annotations.*;
+import org.openjdk.jcstress.infra.results.IntResult2;
+
+import java.util.concurrent.CountDownLatch;
+
+@JCStressTest
+@Outcome(id = "1, 1", expect = Expect.ACCEPTABLE, desc = "Unlocked fine, and observed the happens-before result")
+@State
+public class StringUnboundedTest {
+
+    String x;
+    CountDownLatch latch = new CountDownLatch(1);
+
+    @Actor
+    public void actor1() {
+        x = new String("data");
+        latch.countDown();
+    }
+
+    @Actor
+    public void actor2(IntResult2 r) {
+        try {
+            latch.await();
+            r.r1 = x.equals("data") ? 1 : 0;
+            r.r2 = 1;
+        } catch (InterruptedException e) {
+            r.r1 = -1;
+            r.r2 = -1;
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/countdownlatch/racy/BoundedSingleTest.java	Thu Jul 21 23:04:16 2016 +0300
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jcstress.tests.countdownlatch.racy;
+
+import org.openjdk.jcstress.annotations.*;
+import org.openjdk.jcstress.infra.results.IntResult1;
+
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.VarHandle;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+@JCStressTest
+@Outcome(id = "1", expect = Expect.ACCEPTABLE, desc = "Received racy CDL, and unlocked fine")
+@State
+public class BoundedSingleTest {
+
+    CountDownLatch latch;
+
+    static final VarHandle VH;
+
+    static {
+        try {
+            VH = MethodHandles.lookup().findVarHandle(BoundedSingleTest.class, "latch", CountDownLatch.class);
+        } catch (NoSuchFieldException | IllegalAccessException e) {
+            throw new IllegalStateException(e);
+        }
+    }
+
+    @Actor // TODO: There should be the jcstress API for this...
+    public void preparer() {
+        latch = new CountDownLatch(1);
+    }
+
+    @Actor
+    public void actor1() {
+        CountDownLatch latch = getLatch();
+        latch.countDown();
+    }
+
+    @Actor
+    public void actor2(IntResult1 r) {
+        try {
+            CountDownLatch latch = getLatch();
+            latch.await(1, TimeUnit.DAYS);
+            r.r1 = 1;
+        } catch (InterruptedException e) {
+            r.r1 = -1;
+        }
+    }
+
+    private CountDownLatch getLatch() {
+        CountDownLatch latch;
+        do {
+            latch = (CountDownLatch) VH.getOpaque(this);
+        } while (latch == null);
+        return latch;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/countdownlatch/racy/UnboundedSingleTest.java	Thu Jul 21 23:04:16 2016 +0300
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jcstress.tests.countdownlatch.racy;
+
+import org.openjdk.jcstress.annotations.*;
+import org.openjdk.jcstress.infra.results.IntResult1;
+
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.VarHandle;
+import java.util.concurrent.CountDownLatch;
+
+@JCStressTest
+@Outcome(id = "1", expect = Expect.ACCEPTABLE, desc = "Received racy CDL, and unlocked fine")
+@State
+public class UnboundedSingleTest {
+
+    CountDownLatch latch;
+
+    static final VarHandle VH;
+
+    static {
+        try {
+            VH = MethodHandles.lookup().findVarHandle(UnboundedSingleTest.class, "latch", CountDownLatch.class);
+        } catch (NoSuchFieldException | IllegalAccessException e) {
+            throw new IllegalStateException(e);
+        }
+    }
+
+    @Actor // TODO: There should be the jcstress API for this...
+    public void preparer() {
+        latch = new CountDownLatch(1);
+    }
+
+    @Actor
+    public void actor1() {
+        CountDownLatch latch = getLatch();
+        latch.countDown();
+    }
+
+    @Actor
+    public void actor2(IntResult1 r) {
+        try {
+            CountDownLatch latch = getLatch();
+            latch.await();
+            r.r1 = 1;
+        } catch (InterruptedException e) {
+            r.r1 = -1;
+        }
+    }
+
+    private CountDownLatch getLatch() {
+        CountDownLatch latch;
+        do {
+            latch = (CountDownLatch) VH.getOpaque(this);
+        } while (latch == null);
+        return latch;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/countdownlatch/waits/BoundedDoubleTest.java	Thu Jul 21 23:04:16 2016 +0300
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jcstress.tests.countdownlatch.waits;
+
+import org.openjdk.jcstress.annotations.*;
+import org.openjdk.jcstress.infra.results.IntResult3;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+@JCStressTest
+@Outcome(id = "1, 1, 1", expect = Expect.ACCEPTABLE, desc = "Unlocked fine")
+@State
+public class BoundedDoubleTest {
+
+    CountDownLatch latch = new CountDownLatch(2);
+
+    @Actor
+    public void actor1(IntResult3 r) {
+        r.r1 = 1;
+        latch.countDown();
+    }
+
+    @Actor
+    public void actor2(IntResult3 r) {
+        r.r2 = 1;
+        latch.countDown();
+    }
+
+    @Actor
+    public void actor3(IntResult3 r) {
+        try {
+            latch.await(1, TimeUnit.DAYS);
+            r.r3 = 1;
+        } catch (InterruptedException e) {
+            r.r3 = -1;
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/countdownlatch/waits/BoundedSingleTest.java	Thu Jul 21 23:04:16 2016 +0300
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jcstress.tests.countdownlatch.waits;
+
+import org.openjdk.jcstress.annotations.*;
+import org.openjdk.jcstress.infra.results.IntResult2;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+@JCStressTest
+@Outcome(id = "1, 1", expect = Expect.ACCEPTABLE, desc = "Unlocked fine")
+@State
+public class BoundedSingleTest {
+
+    CountDownLatch latch = new CountDownLatch(1);
+
+    @Actor
+    public void actor1(IntResult2 r) {
+        r.r1 = 1;
+        latch.countDown();
+    }
+
+    @Actor
+    public void actor2(IntResult2 r) {
+        try {
+            latch.await(1, TimeUnit.DAYS);
+            r.r2 = 1;
+        } catch (InterruptedException e) {
+            r.r2 = -1;
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/countdownlatch/waits/UnboundedDoubleTest.java	Thu Jul 21 23:04:16 2016 +0300
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jcstress.tests.countdownlatch.waits;
+
+import org.openjdk.jcstress.annotations.*;
+import org.openjdk.jcstress.infra.results.IntResult3;
+
+import java.util.concurrent.CountDownLatch;
+
+@JCStressTest
+@Outcome(id = "1, 1, 1", expect = Expect.ACCEPTABLE, desc = "Unlocked fine")
+@State
+public class UnboundedDoubleTest {
+
+    CountDownLatch latch = new CountDownLatch(2);
+
+    @Actor
+    public void actor1(IntResult3 r) {
+        r.r1 = 1;
+        latch.countDown();
+    }
+
+    @Actor
+    public void actor2(IntResult3 r) {
+        r.r2 = 1;
+        latch.countDown();
+    }
+
+    @Actor
+    public void actor3(IntResult3 r) {
+        try {
+            latch.await();
+            r.r3 = 1;
+        } catch (InterruptedException e) {
+            r.r3 = -1;
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/countdownlatch/waits/UnboundedSingleTest.java	Thu Jul 21 23:04:16 2016 +0300
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jcstress.tests.countdownlatch.waits;
+
+import org.openjdk.jcstress.annotations.*;
+import org.openjdk.jcstress.infra.results.IntResult2;
+
+import java.util.concurrent.CountDownLatch;
+
+@JCStressTest
+@Outcome(id = "1, 1", expect = Expect.ACCEPTABLE, desc = "Unlocked fine")
+@State
+public class UnboundedSingleTest {
+
+    CountDownLatch latch = new CountDownLatch(1);
+
+    @Actor
+    public void actor1(IntResult2 r) {
+        r.r1 = 1;
+        latch.countDown();
+    }
+
+    @Actor
+    public void actor2(IntResult2 r) {
+        try {
+            latch.await();
+            r.r2 = 1;
+        } catch (InterruptedException e) {
+            r.r2 = -1;
+        }
+    }
+
+}