view tests-custom/src/main/resources/org/openjdk/jcstress/desc/singletons.xml @ 0:dd797d922f1c

Initial import.
author shade
date Thu, 04 Jul 2013 12:32:04 +0400
parents
children d7f7a93800e4
line wrap: on
line source
<!--

    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>

    <template name="singleton">
        <contributed-by>Aleksey Shipilev (aleksey.shipilev@oracle.com)</contributed-by>
        <description>
            Default description
        </description>
        <case>
            <match>[0]</match>
            <expect>FORBIDDEN</expect>
            <description>
                Factory returned null singleton. This is the major correctness issue.
            </description>
        </case>
        <case>
            <match>[1]</match>
            <expect>FORBIDDEN</expect>
            <description>
                The reference field in singleton is null.
                This is forbidden by JMM.
            </description>
        </case>
        <case>
            <match>[42]</match>
            <expect>ACCEPTABLE</expect>
            <description>
                The singleton is observed in fully-constructed way.
            </description>
        </case>
        <unmatched>
            <expect>KNOWN_ACCEPTABLE</expect>
            <description>
                This should be under-uninitialized case. This is a correct JMM behavior.
            </description>
        </unmatched>
    </template>

    <test template="singleton" name="org.openjdk.jcstress.tests.singletons.UnsafeDCLSingletonTest">
        <description>Tests the broken DCL-style singleton.</description>
        <case>
            <match>[1]</match>
            <expect>KNOWN_ACCEPTABLE</expect>
            <description>
                The reference field in singleton is null.
                This is the violation of singleton contract, but legal JMM behavior.
            </description>
        </case>
        <case>
            <match>[0]</match>
            <expect>KNOWN_ACCEPTABLE</expect>
            <description>
                Singleton return the null instance. This is counter-intuitive, but there is the race on $instance,
                and second read in the return can indeed return the null reference.
            </description>
        </case>
    </test>

    <test template="singleton" name="org.openjdk.jcstress.tests.singletons.UnsafeLocalDCLSingletonTest">
        <description>Tests the broken DCL-style singleton.</description>
        <case>
            <match>[1]</match>
            <expect>KNOWN_ACCEPTABLE</expect>
            <description>
                The reference field in singleton is null.
                This is the violation of singleton contract, but legal JMM behavior.
            </description>
        </case>
    </test>

    <test template="singleton" name="org.openjdk.jcstress.tests.singletons.SafeDCLSingletonTest">
        <description>Tests the safe DCL-style singleton.</description>
    </test>

    <test template="singleton" name="org.openjdk.jcstress.tests.singletons.HolderSingletonTest">
        <description>Tests the Holder-idiom singleton.</description>
    </test>

    <test template="singleton"  name="org.openjdk.jcstress.tests.singletons.FinalWrapperSingletonTest">
        <description>Tests the final wrapper case.</description>
    </test>

</testsuite>