summaryrefslogtreecommitdiffstats
path: root/tests/auto/testlib/selftests/tst_selftests.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2020-04-15 13:10:31 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2020-04-30 13:44:08 +0200
commitc78a960198d59fb9a9ddd83ad7098b1db396edfd (patch)
tree3e8eec0b57cd67796743ebb56fa883ca24ee2f69 /tests/auto/testlib/selftests/tst_selftests.cpp
parent91d18c646443c812addf6d1cdada99d3c2d3a3ec (diff)
QCOMPARE: treat values as equal if qFuzzyIsNull(each)
We hope this shall avoid some flaky failures noticed in quick tests, e.g. tst_QQuickMenu::Material::subMenuPosition(cascading,flip) was recently seen failing with 3.88e-11 != 0. This required some revision to test data in the testlib selftest for floats; the resulting expected output differs in details but not in which tests pass or fail. QEMU, naturally, made life difficult, requiring special-case code in the test-driver. [ChangeLog][QtTestLib][QCOMPARE] QCOMPARE() now treats its values as equal when qFuzzyIsNull() is true for both of them. Change-Id: Icc6ad5164b609937eddbe39cc69120f0abf0f3b4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/testlib/selftests/tst_selftests.cpp')
-rw-r--r--tests/auto/testlib/selftests/tst_selftests.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp
index cab6589984..84090c22ca 100644
--- a/tests/auto/testlib/selftests/tst_selftests.cpp
+++ b/tests/auto/testlib/selftests/tst_selftests.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Copyright (C) 2016 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
@@ -940,6 +940,14 @@ bool tst_Selftests::compareLine(const QString &logger, const QString &subdir,
return true;
}
+ if (EmulationDetector::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"))) {
+ return true;
+ }
+ }
+
*errorMessage = msgMismatch(actualLine, expectedLine);
return false;
}