diff options
26 files changed, 58 insertions, 67 deletions
diff --git a/src/testlib/CMakeLists.txt b/src/testlib/CMakeLists.txt index 56ab1eb4c5..a2307045e7 100644 --- a/src/testlib/CMakeLists.txt +++ b/src/testlib/CMakeLists.txt @@ -22,6 +22,7 @@ qt_internal_add_module(Test qbenchmarkperfevents.cpp qbenchmarkperfevents_p.h qbenchmarktimemeasurers_p.h qcsvbenchmarklogger.cpp qcsvbenchmarklogger_p.h + qemulationdetector_p.h qjunittestlogger.cpp qjunittestlogger_p.h qplaintestlogger.cpp qplaintestlogger_p.h qsignaldumper.cpp qsignaldumper_p.h diff --git a/tests/shared/emulationdetector.h b/src/testlib/qemulationdetector_p.h index f691118464..3ae3d07839 100644 --- a/tests/shared/emulationdetector.h +++ b/src/testlib/qemulationdetector_p.h @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the test suite of the Qt Toolkit. +** This file is part of the QtTest module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage @@ -26,8 +26,19 @@ ** ****************************************************************************/ -#ifndef EMULATIONDETECTOR_H -#define EMULATIONDETECTOR_H +#ifndef QEMULATIONDETECTOR_P_H +#define QEMULATIONDETECTOR_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// #include <QtCore/qglobal.h> @@ -46,7 +57,7 @@ QT_BEGIN_NAMESPACE // Helper functions for detecting if running emulated -namespace EmulationDetector { +namespace QTestPrivate { #ifdef SHOULD_CHECK_ARM_ON_X86 static bool isX86SpecificFileAvailable(void); @@ -115,7 +126,7 @@ static bool isReportedArchitectureX86(void) } #endif // SHOULD_CHECK_ARM_ON_X86 -} // EmulationDetector namespace +} // QTestPrivate namespace QT_END_NAMESPACE diff --git a/tests/auto/corelib/io/largefile/CMakeLists.txt b/tests/auto/corelib/io/largefile/CMakeLists.txt index be4b21033f..a82aa0c985 100644 --- a/tests/auto/corelib/io/largefile/CMakeLists.txt +++ b/tests/auto/corelib/io/largefile/CMakeLists.txt @@ -6,8 +6,7 @@ qt_internal_add_test(tst_largefile SOURCES - ../../../../shared/emulationdetector.h tst_largefile.cpp - INCLUDE_DIRECTORIES - ../../../../shared + PUBLIC_LIBRARIES + Qt::TestPrivate ) diff --git a/tests/auto/corelib/io/largefile/tst_largefile.cpp b/tests/auto/corelib/io/largefile/tst_largefile.cpp index 98bb985c02..fcc0a31763 100644 --- a/tests/auto/corelib/io/largefile/tst_largefile.cpp +++ b/tests/auto/corelib/io/largefile/tst_largefile.cpp @@ -48,7 +48,7 @@ # endif #endif // Q_OS_WIN -#include "emulationdetector.h" +#include <QtTest/private/qemulationdetector_p.h> class tst_LargeFile : public QObject @@ -73,7 +73,7 @@ public: #endif // QEMU only supports < 4GB files - if (EmulationDetector::isRunningArmOnX86()) + if (QTestPrivate::isRunningArmOnX86()) maxSizeBits = qMin(maxSizeBits, 28); } diff --git a/tests/auto/corelib/io/qfile/CMakeLists.txt b/tests/auto/corelib/io/qfile/CMakeLists.txt index 7a0102bfd9..4d9a0d2598 100644 --- a/tests/auto/corelib/io/qfile/CMakeLists.txt +++ b/tests/auto/corelib/io/qfile/CMakeLists.txt @@ -19,12 +19,10 @@ list(APPEND test_data "resources/file1.ext1") qt_internal_add_test(tst_qfile SOURCES - ../../../../shared/emulationdetector.h tst_qfile.cpp - INCLUDE_DIRECTORIES - ../../../../shared PUBLIC_LIBRARIES Qt::CorePrivate + Qt::TestPrivate TESTDATA ${test_data} ) diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 2019afaf66..bdfcc2d350 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -46,7 +46,7 @@ #include <private/qfsfileengine_p.h> #include <private/qfilesystemengine_p.h> -#include "emulationdetector.h" +#include <QtTest/private/qemulationdetector_p.h> #ifdef Q_OS_WIN QT_BEGIN_NAMESPACE @@ -2553,10 +2553,10 @@ void tst_QFile::virtualFile() // open the file QFile f(fname); QVERIFY2(f.open(QIODevice::ReadOnly), msgOpenFailed(f).constData()); - if (EmulationDetector::isRunningArmOnX86()) + if (QTestPrivate::isRunningArmOnX86()) QEXPECT_FAIL("","QEMU does not read /proc/self/maps size correctly", Continue); QCOMPARE(f.size(), Q_INT64_C(0)); - if (EmulationDetector::isRunningArmOnX86()) + if (QTestPrivate::isRunningArmOnX86()) QEXPECT_FAIL("","QEMU does not read /proc/self/maps size correctly", Continue); QVERIFY(f.atEnd()); diff --git a/tests/auto/corelib/io/qprocess/test/CMakeLists.txt b/tests/auto/corelib/io/qprocess/test/CMakeLists.txt index 249cb089cf..75cddf41a8 100644 --- a/tests/auto/corelib/io/qprocess/test/CMakeLists.txt +++ b/tests/auto/corelib/io/qprocess/test/CMakeLists.txt @@ -7,13 +7,11 @@ qt_internal_add_test(tst_qprocess OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../" SOURCES - ../../../../../shared/emulationdetector.h ../tst_qprocess.cpp - INCLUDE_DIRECTORIES - ../../../../../shared PUBLIC_LIBRARIES Qt::CorePrivate Qt::Network + Qt::TestPrivate ) #### Keys ignored in scope 1:.:.:test.pro:<TRUE>: diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index b6ba4e546c..41172a10dd 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -27,11 +27,10 @@ ** ****************************************************************************/ -#include <emulationdetector.h> - #include <QTest> #include <QTestEventLoop> #include <QSignalSpy> +#include <QtTest/private/qemulationdetector_p.h> #include <QtCore/QProcess> #include <QtCore/QDir> @@ -1237,7 +1236,7 @@ void tst_QProcess::processInAThread() void tst_QProcess::processesInMultipleThreads() { - if (EmulationDetector::isRunningArmOnX86()) + if (QTestPrivate::isRunningArmOnX86()) QSKIP("Flakily hangs in QEMU. QTBUG-67760"); for (int i = 0; i < 10; ++i) { // run from 1 to 10 threads, but run at least some tests diff --git a/tests/auto/corelib/serialization/qtextstream/test/CMakeLists.txt b/tests/auto/corelib/serialization/qtextstream/test/CMakeLists.txt index 61d594900f..c90a6f12c5 100644 --- a/tests/auto/corelib/serialization/qtextstream/test/CMakeLists.txt +++ b/tests/auto/corelib/serialization/qtextstream/test/CMakeLists.txt @@ -15,12 +15,10 @@ list(APPEND test_data "../BLACKLIST") qt_internal_add_test(tst_qtextstream OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../" SOURCES - ../../../../../shared/emulationdetector.h ../tst_qtextstream.cpp - INCLUDE_DIRECTORIES - ../../../../../shared PUBLIC_LIBRARIES Qt::Network + Qt::TestPrivate TESTDATA ${test_data} ) diff --git a/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp index 3ab095827f..c02da8efe1 100644 --- a/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp +++ b/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp @@ -45,7 +45,7 @@ # include <QProcess> #endif #include "../../../network-settings.h" -#include "emulationdetector.h" +#include <QtTest/private/qemulationdetector_p.h> QT_BEGIN_NAMESPACE template<> struct QMetaTypeId<QIODevice::OpenModeFlag> @@ -1417,7 +1417,7 @@ void tst_QTextStream::pos2() // ------------------------------------------------------------------------------ void tst_QTextStream::pos3LargeFile() { - if (EmulationDetector::isRunningArmOnX86()) + if (QTestPrivate::isRunningArmOnX86()) QSKIP("Running QTextStream::pos() in tight loop is too slow on emulator"); { diff --git a/tests/auto/corelib/thread/qthread/CMakeLists.txt b/tests/auto/corelib/thread/qthread/CMakeLists.txt index b3662f31da..96c649f106 100644 --- a/tests/auto/corelib/thread/qthread/CMakeLists.txt +++ b/tests/auto/corelib/thread/qthread/CMakeLists.txt @@ -6,10 +6,9 @@ qt_internal_add_test(tst_qthread SOURCES - ../../../../shared/emulationdetector.h tst_qthread.cpp - INCLUDE_DIRECTORIES - ../../../../shared + PUBLIC_LIBRARIES + Qt::TestPrivate ) ## Scopes: diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp index a34129d59a..7e06e7f51f 100644 --- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp +++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp @@ -55,7 +55,7 @@ #include <exception> #endif -#include "emulationdetector.h" +#include <QtTest/private/qemulationdetector_p.h> class tst_QThread : public QObject { @@ -951,7 +951,7 @@ void tst_QThread::adoptMultipleThreadsOverlap() // Disconnects on WinCE void tst_QThread::stressTest() { - if (EmulationDetector::isRunningArmOnX86()) + if (QTestPrivate::isRunningArmOnX86()) QSKIP("Qemu uses too much memory for each thread. Test would run out of memory."); QElapsedTimer timer; diff --git a/tests/auto/gui/itemmodels/qfilesystemmodel/CMakeLists.txt b/tests/auto/gui/itemmodels/qfilesystemmodel/CMakeLists.txt index 375eb5b245..31fd8ca32d 100644 --- a/tests/auto/gui/itemmodels/qfilesystemmodel/CMakeLists.txt +++ b/tests/auto/gui/itemmodels/qfilesystemmodel/CMakeLists.txt @@ -6,15 +6,13 @@ qt_internal_add_test(tst_qfilesystemmodel SOURCES - ../../../../shared/emulationdetector.h tst_qfilesystemmodel.cpp - INCLUDE_DIRECTORIES - ../../../../shared PUBLIC_LIBRARIES Qt::CorePrivate Qt::Gui Qt::Widgets Qt::WidgetsPrivate + Qt::TestPrivate ) ## Scopes: diff --git a/tests/auto/gui/itemmodels/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/gui/itemmodels/qfilesystemmodel/tst_qfilesystemmodel.cpp index a096fcd324..b9c44aa4c2 100644 --- a/tests/auto/gui/itemmodels/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/gui/itemmodels/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -27,11 +27,11 @@ ****************************************************************************/ -#include <emulationdetector.h> #include <QTest> #include <QSignalSpy> #include <QTemporaryFile> #include <QLoggingCategory> +#include <QtTest/private/qemulationdetector_p.h> #ifdef QT_BUILD_INTERNAL #include <private/qfilesystemmodel_p.h> @@ -792,7 +792,7 @@ void tst_QFileSystemModel::sort() QTreeView tree; tree.setWindowTitle(QTest::currentTestFunction()); - if (fileDialogMode && EmulationDetector::isRunningArmOnX86()) + if (fileDialogMode && QTestPrivate::isRunningArmOnX86()) QSKIP("Crashes in QEMU. QTBUG-70572"); #ifdef QT_BUILD_INTERNAL diff --git a/tests/auto/gui/text/qfont/CMakeLists.txt b/tests/auto/gui/text/qfont/CMakeLists.txt index 32cbed7aaf..05c6ca8270 100644 --- a/tests/auto/gui/text/qfont/CMakeLists.txt +++ b/tests/auto/gui/text/qfont/CMakeLists.txt @@ -11,8 +11,7 @@ qt_internal_add_test(tst_qfont Qt::CorePrivate Qt::Gui Qt::GuiPrivate - INCLUDE_DIRECTORIES - ../../../../shared + Qt::TestPrivate ) # Resources: diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp index efd1215d70..aa9f8a8ce4 100644 --- a/tests/auto/gui/text/qfont/tst_qfont.cpp +++ b/tests/auto/gui/text/qfont/tst_qfont.cpp @@ -41,7 +41,7 @@ #include <qwidget.h> #endif #include <qlist.h> -#include "emulationdetector.h" +#include <QtTest/private/qemulationdetector_p.h> class tst_QFont : public QObject { @@ -578,7 +578,7 @@ void tst_QFont::defaultFamily() } } #ifdef Q_PROCESSOR_ARM_32 - if (EmulationDetector::isRunningArmOnX86()) + if (QTestPrivate::isRunningArmOnX86()) QEXPECT_FAIL("", "Fails on ARMv7 QEMU (QTQAINFRA-4127)", Continue); #endif diff --git a/tests/auto/network/access/http2/CMakeLists.txt b/tests/auto/network/access/http2/CMakeLists.txt index 7ac1c8001c..735f95deff 100644 --- a/tests/auto/network/access/http2/CMakeLists.txt +++ b/tests/auto/network/access/http2/CMakeLists.txt @@ -6,15 +6,13 @@ qt_internal_add_test(tst_http2 SOURCES - ../../../../shared/emulationdetector.h http2srv.cpp http2srv.h tst_http2.cpp DEFINES SRCDIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/\\\" - INCLUDE_DIRECTORIES - ../../../../shared PUBLIC_LIBRARIES Qt::CorePrivate Qt::Network Qt::NetworkPrivate + Qt::TestPrivate ) diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp index d4ef1520a7..1aa012c6ac 100644 --- a/tests/auto/network/access/http2/tst_http2.cpp +++ b/tests/auto/network/access/http2/tst_http2.cpp @@ -55,7 +55,7 @@ #include <memory> #include <string> -#include "emulationdetector.h" +#include <QtTest/private/qemulationdetector_p.h> #if (!defined(QT_NO_OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_TLSEXT)) \ || QT_CONFIG(schannel) @@ -379,7 +379,7 @@ void tst_Http2::flowControlServerSide() // to let all replies finish without any error. using namespace Http2; - if (EmulationDetector::isRunningArmOnX86()) + if (QTestPrivate::isRunningArmOnX86()) QSKIP("Test is too slow to run on emulator"); clearHTTP2State(); diff --git a/tests/auto/network/socket/qudpsocket/test/CMakeLists.txt b/tests/auto/network/socket/qudpsocket/test/CMakeLists.txt index 7bd9bd80fb..6a781aadc4 100644 --- a/tests/auto/network/socket/qudpsocket/test/CMakeLists.txt +++ b/tests/auto/network/socket/qudpsocket/test/CMakeLists.txt @@ -8,10 +8,9 @@ qt_internal_add_test(tst_qudpsocket OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../" # special case SOURCES ../tst_qudpsocket.cpp - INCLUDE_DIRECTORIES - ../../../../../shared PUBLIC_LIBRARIES Qt::Network + Qt::TestPrivate QT_TEST_SERVER_LIST "danted" "echo" # special case ) diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index 1f3c8583f2..22f5f3f4c7 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -52,7 +52,7 @@ #include <qstringlist.h> #include "../../../network-settings.h" -#include "emulationdetector.h" +#include <QtTest/private/qemulationdetector_p.h> #if defined(Q_OS_LINUX) #define SHOULD_CHECK_SYSCALL_SUPPORT @@ -302,7 +302,7 @@ void tst_QUdpSocket::initTestCase() qDebug() << "Will use multicast groups" << multicastGroup4 << multicastGroup6 << linklocalMulticastGroups; m_workaroundLinuxKernelBug = shouldWorkaroundLinuxKernelBug(); - if (EmulationDetector::isRunningArmOnX86()) + if (QTestPrivate::isRunningArmOnX86()) QSKIP("This test is unreliable due to QEMU emulation shortcomings."); } diff --git a/tests/auto/other/qobjectrace/CMakeLists.txt b/tests/auto/other/qobjectrace/CMakeLists.txt index 8069b40ad7..7a2be39d81 100644 --- a/tests/auto/other/qobjectrace/CMakeLists.txt +++ b/tests/auto/other/qobjectrace/CMakeLists.txt @@ -6,8 +6,7 @@ qt_internal_add_test(qobjectrace SOURCES - ../../../shared/emulationdetector.h tst_qobjectrace.cpp - INCLUDE_DIRECTORIES - ../../../shared + PUBLIC_LIBRARIES + Qt::TestPrivate ) diff --git a/tests/auto/other/qobjectrace/tst_qobjectrace.cpp b/tests/auto/other/qobjectrace/tst_qobjectrace.cpp index cdf51f5d0c..ac33fa3ec3 100644 --- a/tests/auto/other/qobjectrace/tst_qobjectrace.cpp +++ b/tests/auto/other/qobjectrace/tst_qobjectrace.cpp @@ -30,7 +30,7 @@ #include <QtCore> #include <QTest> -#include "emulationdetector.h" +#include <QtTest/private/qemulationdetector_p.h> enum { OneMinute = 60 * 1000, TwoMinutes = OneMinute * 2 }; @@ -260,7 +260,7 @@ public: void tst_QObjectRace::destroyRace() { - if (EmulationDetector::isRunningArmOnX86()) + if (QTestPrivate::isRunningArmOnX86()) QSKIP("Test is too slow to run on emulator"); enum { ThreadCount = 10, ObjectCountPerThread = 2777, diff --git a/tests/auto/testlib/selftests/CMakeLists.txt b/tests/auto/testlib/selftests/CMakeLists.txt index 7a352740da..ec321dc282 100644 --- a/tests/auto/testlib/selftests/CMakeLists.txt +++ b/tests/auto/testlib/selftests/CMakeLists.txt @@ -10,11 +10,8 @@ qt_internal_add_test(tst_selftests EXCEPTIONS CATCH SOURCES - ../../../shared/emulationdetector.h tst_selftests.cpp catch.cpp - INCLUDE_DIRECTORIES - ../../../shared PUBLIC_LIBRARIES Qt::TestPrivate # special case begin diff --git a/tests/auto/testlib/selftests/float/CMakeLists.txt b/tests/auto/testlib/selftests/float/CMakeLists.txt index 375cfe1e65..02c61acff3 100644 --- a/tests/auto/testlib/selftests/float/CMakeLists.txt +++ b/tests/auto/testlib/selftests/float/CMakeLists.txt @@ -8,12 +8,10 @@ qt_internal_add_executable(float NO_INSTALL # special case OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} # special case SOURCES - ../../../../shared/emulationdetector.h tst_float.cpp - INCLUDE_DIRECTORIES - ../../../../shared PUBLIC_LIBRARIES Qt::Test + Qt::TestPrivate ) ## Scopes: diff --git a/tests/auto/testlib/selftests/float/tst_float.cpp b/tests/auto/testlib/selftests/float/tst_float.cpp index 97b76ccf47..6084b464e2 100644 --- a/tests/auto/testlib/selftests/float/tst_float.cpp +++ b/tests/auto/testlib/selftests/float/tst_float.cpp @@ -31,7 +31,7 @@ #include <QTest> #include <QDebug> -#include "emulationdetector.h" +#include <QtTest/private/qemulationdetector_p.h> // Test proper handling of floating-point types class tst_float: public QObject @@ -182,7 +182,7 @@ void tst_float::float16Comparisons_data() const QTest::addColumn<qfloat16>("operandLeft"); QTest::addColumn<qfloat16>("operandRight"); const qfloat16 zero(0), one(1); - const qfloat16 tiny(EmulationDetector::isRunningArmOnX86() ? 0.00099f : 0.001f); + const qfloat16 tiny(QTestPrivate::isRunningArmOnX86() ? 0.00099f : 0.001f); QTest::newRow("should FAIL 1") << one << qfloat16(3); QTest::newRow("should PASS 1") << zero << zero; diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index 4c5e56b97b..1b1ad50e9b 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -48,7 +48,7 @@ #include <private/cycle_p.h> -#include "emulationdetector.h" +#include <QtTest/private/qemulationdetector_p.h> struct BenchmarkResult { @@ -345,7 +345,7 @@ bool compareLine(const QString &logger, const QString &subdir, return true; } - if (EmulationDetector::isRunningArmOnX86() && subdir == QLatin1String("float")) { + if (QTestPrivate::isRunningArmOnX86() && subdir == QLatin1String("float")) { // QEMU cheats at qfloat16, so outputs it as if it were a float. if (actualLine.endsWith(QLatin1String("Actual (operandLeft) : 0.001")) && expectedLine.endsWith(QLatin1String("Actual (operandLeft) : 0.000999"))) { @@ -787,7 +787,7 @@ void checkErrorOutput(const QString &test, const QByteArray &errorOutput) #ifdef Q_OS_LINUX // QEMU outputs to stderr about uncaught signals - if (EmulationDetector::isRunningArmOnX86() && + if (QTestPrivate::isRunningArmOnX86() && (test == "assert" || test == "blacklisted" || test == "crashes" |