changeset 180:3a587a6e9064

Migrate unsafe.* tests to annotation API.
author shade
date Tue, 12 Aug 2014 12:17:58 +0400
parents 6c1def241e13
children 134b69f489d9
files tests-custom/src/main/java/org/openjdk/jcstress/tests/unsafe/UnsafeAddLong1.java tests-custom/src/main/java/org/openjdk/jcstress/tests/unsafe/UnsafeAddLong42.java tests-custom/src/main/resources/org/openjdk/jcstress/desc/unsafe.xml
diffstat 3 files changed, 14 insertions(+), 85 deletions(-) [+]
line wrap: on
line diff
--- a/tests-custom/src/main/java/org/openjdk/jcstress/tests/unsafe/UnsafeAddLong1.java	Tue Aug 12 12:12:57 2014 +0400
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/unsafe/UnsafeAddLong1.java	Tue Aug 12 12:17:58 2014 +0400
@@ -25,13 +25,20 @@
 package org.openjdk.jcstress.tests.unsafe;
 
 import org.openjdk.jcstress.annotations.Actor;
+import org.openjdk.jcstress.annotations.Description;
+import org.openjdk.jcstress.annotations.Expect;
 import org.openjdk.jcstress.annotations.JCStressTest;
+import org.openjdk.jcstress.annotations.Outcome;
 import org.openjdk.jcstress.annotations.State;
 import org.openjdk.jcstress.infra.results.LongResult2;
 import org.openjdk.jcstress.util.UnsafeHolder;
 import sun.misc.Contended;
 
 @JCStressTest
+@Description("Tests if Unsafe.getAndAddLong is racy")
+@Outcome(id = "[1, 2]", expect = Expect.ACCEPTABLE, desc = "T1 -> T2 execution")
+@Outcome(id = "[0, 0]", expect = Expect.ACCEPTABLE, desc = "T2 -> T1 execution")
+@Outcome(id = "[0, 2]", expect = Expect.ACCEPTABLE, desc = "T2 reads the result early")
 @State
 public class UnsafeAddLong1 {
 
--- a/tests-custom/src/main/java/org/openjdk/jcstress/tests/unsafe/UnsafeAddLong42.java	Tue Aug 12 12:12:57 2014 +0400
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/unsafe/UnsafeAddLong42.java	Tue Aug 12 12:17:58 2014 +0400
@@ -25,13 +25,20 @@
 package org.openjdk.jcstress.tests.unsafe;
 
 import org.openjdk.jcstress.annotations.Actor;
+import org.openjdk.jcstress.annotations.Description;
+import org.openjdk.jcstress.annotations.Expect;
 import org.openjdk.jcstress.annotations.JCStressTest;
+import org.openjdk.jcstress.annotations.Outcome;
 import org.openjdk.jcstress.annotations.State;
 import org.openjdk.jcstress.infra.results.LongResult2;
 import org.openjdk.jcstress.util.UnsafeHolder;
 import sun.misc.Contended;
 
 @JCStressTest
+@Description("Tests if Unsafe.getAndAddLong is racy")
+@Outcome(id = "[1, 4398046511104]", expect = Expect.ACCEPTABLE, desc = "T1 -> T2 execution")
+@Outcome(id = "[0, 0]",             expect = Expect.ACCEPTABLE, desc = "T2 -> T1 execution")
+@Outcome(id = "[0, 4398046511104]", expect = Expect.ACCEPTABLE, desc = "T2 reads the result early")
 @State
 public class UnsafeAddLong42 {
 
--- a/tests-custom/src/main/resources/org/openjdk/jcstress/desc/unsafe.xml	Tue Aug 12 12:12:57 2014 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-<!--
-
-    Copyright (c) 2005, 2013, 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.
-
--->
-<testsuite>
-
-    <test name="org.openjdk.jcstress.tests.unsafe.UnsafeAddLong1">
-        <contributed-by>Aleksey Shipilev (aleksey.shipilev@oracle.com)</contributed-by>
-        <description>
-            Tests if Unsafe.getAndAddLong is racy.
-        </description>
-        <case>
-            <match>[0, 0]</match>
-            <match>[1, 2]</match>
-            <expect>ACCEPTABLE</expect>
-            <description>
-                T1 -> T2, or T2 -> T1 execution.
-            </description>
-        </case>
-        <case>
-            <match>[0, 2]</match>
-            <expect>ACCEPTABLE</expect>
-            <description>
-                T2 reads the result early.
-            </description>
-        </case>
-        <unmatched>
-            <expect>FORBIDDEN</expect>
-            <description>
-                This case is not expected.
-            </description>
-        </unmatched>
-    </test>
-
-    <test name="org.openjdk.jcstress.tests.unsafe.UnsafeAddLong42">
-        <contributed-by>Aleksey Shipilev (aleksey.shipilev@oracle.com)</contributed-by>
-        <description>
-            Tests if Unsafe.getAndAddLong is racy.
-        </description>
-        <case>
-            <match>[0, 0]</match>
-            <match>[1, 4398046511104]</match>
-            <expect>ACCEPTABLE</expect>
-            <description>
-                T1 -> T2, or T2 -> T1 execution.
-            </description>
-        </case>
-        <case>
-            <match>[0, 4398046511104]</match>
-            <expect>ACCEPTABLE</expect>
-            <description>
-                T2 reads the result early.
-            </description>
-        </case>
-        <unmatched>
-            <expect>FORBIDDEN</expect>
-            <description>
-                This case is not expected.
-            </description>
-        </unmatched>
-    </test>
-
-</testsuite>