diff options
Diffstat (limited to 'tests/auto/corelib/thread/qatomicint')
-rw-r--r-- | tests/auto/corelib/thread/qatomicint/BLACKLIST | 3 | ||||
-rw-r--r-- | tests/auto/corelib/thread/qatomicint/CMakeLists.txt | 9 | ||||
-rw-r--r-- | tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp | 50 |
3 files changed, 13 insertions, 49 deletions
diff --git a/tests/auto/corelib/thread/qatomicint/BLACKLIST b/tests/auto/corelib/thread/qatomicint/BLACKLIST deleted file mode 100644 index 406fb7cc1c..0000000000 --- a/tests/auto/corelib/thread/qatomicint/BLACKLIST +++ /dev/null @@ -1,3 +0,0 @@ -# QTBUG-87422 -[alignment] -android diff --git a/tests/auto/corelib/thread/qatomicint/CMakeLists.txt b/tests/auto/corelib/thread/qatomicint/CMakeLists.txt index 867388cfbf..239f3cce87 100644 --- a/tests/auto/corelib/thread/qatomicint/CMakeLists.txt +++ b/tests/auto/corelib/thread/qatomicint/CMakeLists.txt @@ -1,9 +1,16 @@ -# Generated from qatomicint.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## tst_qatomicint Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qatomicint LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qatomicint SOURCES tst_qatomicint.cpp diff --git a/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp b/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp index 1f0d9e7779..63cb494c11 100644 --- a/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp +++ b/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp @@ -1,31 +1,6 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Intel Corporation. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2016 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> @@ -186,23 +161,19 @@ void tst_QAtomicInt::warningFreeHelper() constexprFunctionsHelperTemplate<QBasicAtomicInteger<long int> >(); constexprFunctionsHelperTemplate<QBasicAtomicInteger<unsigned long int> >(); -#ifdef Q_ATOMIC_INT16_IS_SUPPORTED warningFreeHelperTemplate<qint16, QBasicAtomicInteger<qint16> >(); warningFreeHelperTemplate<quint16, QBasicAtomicInteger<quint16> >(); constexprFunctionsHelperTemplate<QBasicAtomicInteger<qint16> >(); constexprFunctionsHelperTemplate<QBasicAtomicInteger<quint16> >(); warningFreeHelperTemplate<qint16, QBasicAtomicInteger<char16_t> >(); constexprFunctionsHelperTemplate<QBasicAtomicInteger<char16_t> >(); -#endif -#ifdef Q_ATOMIC_INT8_IS_SUPPORTED warningFreeHelperTemplate<char, QBasicAtomicInteger<char> >(); warningFreeHelperTemplate<signed char, QBasicAtomicInteger<signed char> >(); warningFreeHelperTemplate<unsigned char, QBasicAtomicInteger<unsigned char> >(); constexprFunctionsHelperTemplate<QBasicAtomicInteger<char> >(); constexprFunctionsHelperTemplate<QBasicAtomicInteger<signed char> >(); constexprFunctionsHelperTemplate<QBasicAtomicInteger<unsigned char> >(); -#endif #ifdef Q_ATOMIC_INT64_IS_SUPPORTED #if !defined(__i386__) || (defined(Q_CC_GNU) && defined(__OPTIMIZE__)) @@ -230,19 +201,12 @@ void tst_QAtomicInt::alignment() static_assert(alignof(QBasicAtomicInt) == alignof(TypeInStruct<int>)); static_assert(alignof(QBasicAtomicInt) == alignof(TypeInStruct<int>)); -#ifdef Q_ATOMIC_INT32_IS_SUPPORTED QCOMPARE(alignof(QBasicAtomicInteger<int>), alignof(TypeInStruct<int>)); -#endif - -#ifdef Q_ATOMIC_INT16_IS_SUPPORTED QCOMPARE(alignof(QBasicAtomicInteger<short>), alignof(TypeInStruct<short>)); -#endif - -#ifdef Q_ATOMIC_INT8_IS_SUPPORTED QCOMPARE(alignof(QBasicAtomicInteger<char>), alignof(TypeInStruct<char>)); -#endif -#ifdef Q_ATOMIC_INT64_IS_SUPPORTED +#if !defined(Q_PROCESSOR_X86_32) && defined(Q_ATOMIC_INT64_IS_SUPPORTED) + // The alignment is different on x86_32 QCOMPARE(alignof(QBasicAtomicInteger<qlonglong>), alignof(TypeInStruct<qlonglong>)); #endif } @@ -517,7 +481,6 @@ void tst_QAtomicInt::testAndSet() QTEST(atomic.testAndSetOrdered(expected, newval), "result"); } -#ifdef Q_ATOMIC_INT32_IS_SUPPORTED QFETCH(bool, result); // the new implementation has the version that loads the current value @@ -552,7 +515,6 @@ void tst_QAtomicInt::testAndSet() if (!result) QCOMPARE(currentval, value); } -#endif } void tst_QAtomicInt::isFetchAndStoreNative() @@ -714,7 +676,6 @@ void tst_QAtomicInt::fetchAndAdd_data() QTest::newRow("7272+2181") << 7272 << 2181; QTest::newRow("0+-1") << 0 << -1; - QTest::newRow("1+0") << 1 << 0; QTest::newRow("1+-2") << 1 << -2; QTest::newRow("2+-1") << 2 << -1; QTest::newRow("10+-21") << 10 << -21; @@ -730,7 +691,6 @@ void tst_QAtomicInt::fetchAndAdd_data() QTest::newRow("5451+-4362") << 5451 << -4362; QTest::newRow("7272+-2181") << 7272 << -2181; - QTest::newRow("0+1") << 0 << 1; QTest::newRow("-1+0") << -1 << 0; QTest::newRow("-1+2") << -1 << 2; QTest::newRow("-2+1") << -2 << 1; |