summaryrefslogtreecommitdiffstats
path: root/tests/auto/testlib
diff options
context:
space:
mode:
authorSamuli Piippo <samuli.piippo@qt.io>2021-02-11 10:51:55 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-02-13 10:14:16 +0000
commit83dcbf75ad232421070fbe1b461c54b5ffe9783d (patch)
tree1279dade2c2e94277bc34e1557b40786a180ad52 /tests/auto/testlib
parent1c0073ba72f92ba96db05230d1c8e896cc85c821 (diff)
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 <edward.welbourne@qt.io> (cherry picked from commit 0ce443691fac1188103e5eaa66be40278d5d5e97) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests/auto/testlib')
-rw-r--r--tests/auto/testlib/selftests/CMakeLists.txt3
-rw-r--r--tests/auto/testlib/selftests/float/CMakeLists.txt4
-rw-r--r--tests/auto/testlib/selftests/float/tst_float.cpp4
-rw-r--r--tests/auto/testlib/selftests/tst_selftests.cpp6
4 files changed, 6 insertions, 11 deletions
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"