From 83dcbf75ad232421070fbe1b461c54b5ffe9783d Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Thu, 11 Feb 2021 10:51:55 +0200 Subject: Move QEMU emulation detector to QTest The emulation detection has been usable only on qtbase tests, move it to QTest so that it can be used in other modules as well. Change-Id: I4b2321b7856414d7b1cfd5e6b1405a633c6bb878 Reviewed-by: Edward Welbourne (cherry picked from commit 0ce443691fac1188103e5eaa66be40278d5d5e97) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/testlib/selftests/CMakeLists.txt | 3 --- tests/auto/testlib/selftests/float/CMakeLists.txt | 4 +--- tests/auto/testlib/selftests/float/tst_float.cpp | 4 ++-- tests/auto/testlib/selftests/tst_selftests.cpp | 6 +++--- 4 files changed, 6 insertions(+), 11 deletions(-) (limited to 'tests/auto/testlib') 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 #include -#include "emulationdetector.h" +#include // Test proper handling of floating-point types class tst_float: public QObject @@ -182,7 +182,7 @@ void tst_float::float16Comparisons_data() const QTest::addColumn("operandLeft"); QTest::addColumn("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 -#include "emulationdetector.h" +#include 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" -- cgit v1.2.3