From 108c9015b960fccd79efc6de4459dbf05f6ced54 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 16 Nov 2018 14:29:42 +0100 Subject: Implement transient locale as instantiating a class A couple of QLocale tests were using setlocale twice to provide a transient locale tweak in tests; however, if the test in between fails, that can leave the program running in the "transient" locale after. So implement a proper class whose destructor ensures the transient is tidied away. Also change the locale in use by one of these transient changes: it purported to be checking things didn't depend on locale, but was using the same local as most of the test-cases for its test. Change-Id: I0d954edcc96019a8c2eb12b7a7c568e8b87a41d5 Reviewed-by: Thiago Macieira Reviewed-by: Ulf Hermann --- tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index b7cb8a1bdc..4803451399 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -153,6 +153,16 @@ private: QString m_decimal, m_thousand, m_sdate, m_ldate, m_time; QString m_sysapp; bool europeanTimeZone; + + class TransientLocale + { + const int m_category; + const char *const m_prior; + public: + TransientLocale(int category, const char *locale) + : m_category(category), m_prior(setlocale(category, locale)) {} + ~TransientLocale() { setlocale(m_category, m_prior); } + }; }; tst_QLocale::tst_QLocale() @@ -806,10 +816,12 @@ void tst_QLocale::stringToDouble() double d = locale.toDouble(num_str, &ok); QCOMPARE(ok, good); - char *currentLocale = setlocale(LC_ALL, "de_DE"); - QCOMPARE(locale.toDouble(num_str, &ok), d); // make sure result is independent of locale - QCOMPARE(ok, good); - setlocale(LC_ALL, currentLocale); + { + // Make sure result is independent of locale: + TransientLocale ignoreme(LC_ALL, "ar_SA"); + QCOMPARE(locale.toDouble(num_str, &ok), d); + QCOMPARE(ok, good); + } if (ok) { double diff = d - num; @@ -939,9 +951,8 @@ void tst_QLocale::doubleToString() const QLocale locale(locale_name); QCOMPARE(locale.toString(num, mode, precision), num_str); - char *currentLocale = setlocale(LC_ALL, "de_DE"); + TransientLocale ignoreme(LC_ALL, "de_DE"); QCOMPARE(locale.toString(num, mode, precision), num_str); - setlocale(LC_ALL, currentLocale); } void tst_QLocale::strtod_data() -- cgit v1.2.3 From 704137f8de49a55a1b21bb6d612d2594562f51ce Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 16 Nov 2018 15:44:44 +0100 Subject: tst_QLocale: Add tests for toFloat() Mirror those for toDouble(). Change-Id: Ide0ef3cd99528d575f6a578ef19547f3b1119c5d Reviewed-by: Ulf Hermann --- tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 55 +++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index 4803451399..fa1a64a045 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -83,6 +83,8 @@ private slots: void matchingLocales(); void stringToDouble_data(); void stringToDouble(); + void stringToFloat_data() { stringToDouble_data(); } + void stringToFloat(); void doubleToString_data(); void doubleToString(); void strtod_data(); @@ -801,7 +803,7 @@ void tst_QLocale::stringToDouble_data() void tst_QLocale::stringToDouble() { -#define MY_DOUBLE_EPSILON (2.22045e-16) +#define MY_DOUBLE_EPSILON (2.22045e-16) // 1/2^{52}; double has a 53-bit mantissa QFETCH(QString, locale_name); QFETCH(QString, num_str); @@ -824,6 +826,8 @@ void tst_QLocale::stringToDouble() } if (ok) { + // First use fuzzy-compare, then a more precise check: + QCOMPARE(d, num); double diff = d - num; if (diff < 0) diff = -diff; @@ -834,11 +838,60 @@ void tst_QLocale::stringToDouble() QCOMPARE(ok, good); if (ok) { + QCOMPARE(d, num); double diff = d - num; if (diff < 0) diff = -diff; QVERIFY(diff <= MY_DOUBLE_EPSILON); } +#undef MY_DOUBLE_EPSILON +} + +void tst_QLocale::stringToFloat() +{ +#define MY_FLOAT_EPSILON (2.384e-7) // 1/2^{22}; float has a 23-bit mantissa + + QFETCH(QString, locale_name); + QFETCH(QString, num_str); + QFETCH(bool, good); + QFETCH(double, num); + QStringRef num_strRef = num_str.leftRef(-1); + float fnum = num; + + QLocale locale(locale_name); + QCOMPARE(locale.name(), locale_name); + + bool ok; + float f = locale.toFloat(num_str, &ok); + QCOMPARE(ok, good); + + { + // Make sure result is independent of locale: + TransientLocale ignoreme(LC_ALL, "ar_SA"); + QCOMPARE(locale.toFloat(num_str, &ok), f); + QCOMPARE(ok, good); + } + + if (ok) { + // First use fuzzy-compare, then a more precise check: + QCOMPARE(f, fnum); + float diff = f - fnum; + if (diff < 0) + diff = -diff; + QVERIFY(diff <= MY_FLOAT_EPSILON); + } + + f = locale.toFloat(num_strRef, &ok); + QCOMPARE(ok, good); + + if (ok) { + QCOMPARE(f, fnum); + float diff = f - fnum; + if (diff < 0) + diff = -diff; + QVERIFY(diff <= MY_FLOAT_EPSILON); + } +#undef MY_FLOAT_EPSILON } void tst_QLocale::doubleToString_data() -- cgit v1.2.3 From a9923674030980706940b3ee11145c38674bb35d Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 19 Nov 2018 16:27:03 +0100 Subject: Change documentation of some toDouble()s to reflect reality They actually return infinity if conversion overflows, while still setting ok to false; they were documented to return 0 on failure, with no mention of this special handling of overflow. Documented reality rather than changing the behavior. Gave underflow as an example of failure other than overflow (toDouble()s do indeed fail on it). Added some tests of out-of-range values, infinities and NaNs. [ChangeLog][QtCore][toDouble] QString, QByteArray and QLocale return an infinity on overflow (since 5.7), while setting ok to false; this was at odds with their documented behavior of returning 0 on failure. The documentation now reflects the actual behavior. Fixes: QTBUG-71256 Change-Id: I8d7e80ba1f06091cf0f1480c341553381103703b Reviewed-by: Ulf Hermann --- tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 56 +++++++++++++++++++----- 1 file changed, 44 insertions(+), 12 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index fa1a64a045..7bf6d1327e 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -83,7 +83,7 @@ private slots: void matchingLocales(); void stringToDouble_data(); void stringToDouble(); - void stringToFloat_data() { stringToDouble_data(); } + void stringToFloat_data(); void stringToFloat(); void doubleToString_data(); void doubleToString(); @@ -155,6 +155,7 @@ private: QString m_decimal, m_thousand, m_sdate, m_ldate, m_time; QString m_sysapp; bool europeanTimeZone; + void toReal_data(); class TransientLocale { @@ -679,7 +680,7 @@ void tst_QLocale::unixLocaleName() #undef TEST_NAME } -void tst_QLocale::stringToDouble_data() +void tst_QLocale::toReal_data() { QTest::addColumn("locale_name"); QTest::addColumn("num_str"); @@ -801,6 +802,32 @@ void tst_QLocale::stringToDouble_data() QTest::newRow("de_DE 9.876543,0e--2") << QString("de_DE") << QString("9.876543,0e")+QChar(8722)+QString("2") << false << 0.0; } +void tst_QLocale::stringToDouble_data() +{ + toReal_data(); + if (std::numeric_limits::has_infinity) { + double huge = std::numeric_limits::infinity(); + QTest::newRow("C inf") << QString("C") << QString("inf") << true << huge; + QTest::newRow("C +inf") << QString("C") << QString("+inf") << true << +huge; + QTest::newRow("C -inf") << QString("C") << QString("-inf") << true << -huge; + // Overflow: + QTest::newRow("C huge") << QString("C") << QString("2e308") << false << huge; + QTest::newRow("C -huge") << QString("C") << QString("-2e308") << false << -huge; + } + if (std::numeric_limits::has_quiet_NaN) + QTest::newRow("C qnan") << QString("C") << QString("NaN") << true << std::numeric_limits::quiet_NaN(); + + // In range (but outside float's range): + QTest::newRow("C big") << QString("C") << QString("3.5e38") << true << 3.5e38; + QTest::newRow("C -big") << QString("C") << QString("-3.5e38") << true << -3.5e38; + QTest::newRow("C small") << QString("C") << QString("1e-45") << true << 1e-45; + QTest::newRow("C -small") << QString("C") << QString("-1e-45") << true << -1e-45; + + // Underflow: + QTest::newRow("C tiny") << QString("C") << QString("2e-324") << false << 0.; + QTest::newRow("C -tiny") << QString("C") << QString("-2e-324") << false << 0.; +} + void tst_QLocale::stringToDouble() { #define MY_DOUBLE_EPSILON (2.22045e-16) // 1/2^{52}; double has a 53-bit mantissa @@ -825,28 +852,33 @@ void tst_QLocale::stringToDouble() QCOMPARE(ok, good); } - if (ok) { + if (ok || std::isinf(num)) { // First use fuzzy-compare, then a more precise check: QCOMPARE(d, num); - double diff = d - num; - if (diff < 0) - diff = -diff; - QVERIFY(diff <= MY_DOUBLE_EPSILON); + if (std::isfinite(num)) { + double diff = d > num ? d - num : num - d; + QVERIFY(diff <= MY_DOUBLE_EPSILON); + } } d = locale.toDouble(num_strRef, &ok); QCOMPARE(ok, good); - if (ok) { + if (ok || std::isinf(num)) { QCOMPARE(d, num); - double diff = d - num; - if (diff < 0) - diff = -diff; - QVERIFY(diff <= MY_DOUBLE_EPSILON); + if (std::isfinite(num)) { + double diff = d > num ? d - num : num - d; + QVERIFY(diff <= MY_DOUBLE_EPSILON); + } } #undef MY_DOUBLE_EPSILON } +void tst_QLocale::stringToFloat_data() +{ + toReal_data(); +} + void tst_QLocale::stringToFloat() { #define MY_FLOAT_EPSILON (2.384e-7) // 1/2^{22}; float has a 23-bit mantissa -- cgit v1.2.3 From ce159d1a3e48308d54300560f024e8501c1395c9 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 19 Nov 2018 19:53:38 +0100 Subject: Fix toFloat()s between float and double ranges and document Revised some toFloat()s to be consistent with the matching toDouble()s; previously, they would return infinity if toDouble() did but return 0 if toDouble() got a finite value outside float's range. That also applied to values that underflowed float's range, succeeding and returning 0 as long as they were within double's range but failing if toDouble() underflowed. Now float-underflow also fails. Amended their documentation to reflect this more consistent reality. Added some tests of out-of-range values, infinities and NaNs. [ChangeLog][QtCore][toFloat] QString, QByteArray and QLocale returned an infinity on double-overflow (since 5.7) but returned 0 on a finite double outside float's range, while setting ok to false; this was at odds with their documented behavior of returning 0 on any failure. They also succeeded, returning zero, on underflow of float's range, unless double underflowed, where they failed. Changed the handling of values outside float's range to match that of values outside double's range: fail, returning an infinity on overflow or zero on underflow. The documentation now reflects the revised behavior, which matches toDouble(). Change-Id: Ia168bcacf7def0df924840d45d8edc5f850449d6 Reviewed-by: Ulf Hermann --- tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 42 ++++++++++++++++++------ 1 file changed, 32 insertions(+), 10 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index 7bf6d1327e..b8f1cc568a 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -877,6 +877,28 @@ void tst_QLocale::stringToDouble() void tst_QLocale::stringToFloat_data() { toReal_data(); + if (std::numeric_limits::has_infinity) { + double huge = std::numeric_limits::infinity(); + QTest::newRow("C inf") << QString("C") << QString("inf") << true << huge; + QTest::newRow("C +inf") << QString("C") << QString("+inf") << true << +huge; + QTest::newRow("C -inf") << QString("C") << QString("-inf") << true << -huge; + // Overflow float, but not double: + QTest::newRow("C big") << QString("C") << QString("3.5e38") << false << huge; + QTest::newRow("C -big") << QString("C") << QString("-3.5e38") << false << -huge; + // Overflow double, too: + QTest::newRow("C huge") << QString("C") << QString("2e308") << false << huge; + QTest::newRow("C -huge") << QString("C") << QString("-2e308") << false << -huge; + } + if (std::numeric_limits::has_quiet_NaN) + QTest::newRow("C qnan") << QString("C") << QString("NaN") << true << double(std::numeric_limits::quiet_NaN()); + + // Underflow float, but not double: + QTest::newRow("C small") << QString("C") << QString("1e-45") << false << 0.; + QTest::newRow("C -small") << QString("C") << QString("-1e-45") << false << 0.; + + // Underflow double, too: + QTest::newRow("C tiny") << QString("C") << QString("2e-324") << false << 0.; + QTest::newRow("C -tiny") << QString("C") << QString("-2e-324") << false << 0.; } void tst_QLocale::stringToFloat() @@ -904,24 +926,24 @@ void tst_QLocale::stringToFloat() QCOMPARE(ok, good); } - if (ok) { + if (ok || std::isinf(fnum)) { // First use fuzzy-compare, then a more precise check: QCOMPARE(f, fnum); - float diff = f - fnum; - if (diff < 0) - diff = -diff; - QVERIFY(diff <= MY_FLOAT_EPSILON); + if (std::isfinite(fnum)) { + float diff = f > fnum ? f - fnum : fnum - f; + QVERIFY(diff <= MY_FLOAT_EPSILON); + } } f = locale.toFloat(num_strRef, &ok); QCOMPARE(ok, good); - if (ok) { + if (ok || std::isinf(fnum)) { QCOMPARE(f, fnum); - float diff = f - fnum; - if (diff < 0) - diff = -diff; - QVERIFY(diff <= MY_FLOAT_EPSILON); + if (std::isfinite(fnum)) { + float diff = f > fnum ? f - fnum : fnum - f; + QVERIFY(diff <= MY_FLOAT_EPSILON); + } } #undef MY_FLOAT_EPSILON } -- cgit v1.2.3 From d8b401959f6f58bc80f767684b250dd4589735d6 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 19 Nov 2018 16:26:02 +0100 Subject: Recognize E along with e as exponent character in asciiToDouble Fixed a misguided condition in the check for bogus texts in the sscanf branch of the decoder; it checked for 'e' but neglected 'E', which is just as valid. Change-Id: I9236c76faea000c92df641930e401bce445e06c8 Reviewed-by: Ulf Hermann --- tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index b8f1cc568a..fd37a03b8e 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -693,6 +693,8 @@ void tst_QLocale::toReal_data() QTest::newRow("C 1.234e-10") << QString("C") << QString("1.234e-10") << true << 1.234e-10; QTest::newRow("C 1.234E10") << QString("C") << QString("1.234E10") << true << 1.234e10; QTest::newRow("C 1e10") << QString("C") << QString("1e10") << true << 1.0e10; + QTest::newRow("C 1e310") << QString("C") << QString("1e310") << false << std::numeric_limits::infinity(); + QTest::newRow("C 1E310") << QString("C") << QString("1E310") << false << std::numeric_limits::infinity(); QTest::newRow("C 1") << QString("C") << QString(" 1") << true << 1.0; QTest::newRow("C 1") << QString("C") << QString(" 1") << true << 1.0; QTest::newRow("C 1 ") << QString("C") << QString("1 ") << true << 1.0; -- cgit v1.2.3 From 71bd06d516a2410ae0ea698e79dcb94aba9bc5b4 Mon Sep 17 00:00:00 2001 From: Sami Nurmenniemi Date: Wed, 13 Jun 2018 16:35:40 +0300 Subject: Make developer build tests pass for boot2qt Some tests were fixed and others were skipped/blacklisted. Task-number: QTBUG-63152 Change-Id: Ica7df555f8d152ee589865911130525101d4b941 Reviewed-by: Liang Qi --- tests/auto/corelib/global/qlogging/BLACKLIST | 4 ++++ tests/auto/corelib/io/qstandardpaths/BLACKLIST | 3 --- tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro | 3 +++ tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp | 6 ++++++ tests/auto/corelib/serialization/qtextstream/test/test.pro | 2 ++ .../corelib/serialization/qtextstream/tst_qtextstream.cpp | 5 ++++- tests/auto/network/access/http2/http2.pro | 3 ++- tests/auto/network/access/http2/tst_http2.cpp | 5 +++++ tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp | 12 +++++++++++- tests/auto/other/qobjectrace/qobjectrace.pro | 3 +++ tests/auto/other/qobjectrace/tst_qobjectrace.cpp | 4 ++++ tests/auto/testlib/selftests/tst_selftests.cpp | 3 +++ tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp | 12 ++++++++++++ 13 files changed, 59 insertions(+), 6 deletions(-) delete mode 100644 tests/auto/corelib/io/qstandardpaths/BLACKLIST (limited to 'tests') diff --git a/tests/auto/corelib/global/qlogging/BLACKLIST b/tests/auto/corelib/global/qlogging/BLACKLIST index 1dcee92361..e474064f54 100644 --- a/tests/auto/corelib/global/qlogging/BLACKLIST +++ b/tests/auto/corelib/global/qlogging/BLACKLIST @@ -1,3 +1,7 @@ +[qMessagePattern:backtrace] +# QTBUG-63915 +b2qt 64bit + [qMessagePattern:backtrace depth,separator] # QTBUG-63915 b2qt 64bit diff --git a/tests/auto/corelib/io/qstandardpaths/BLACKLIST b/tests/auto/corelib/io/qstandardpaths/BLACKLIST deleted file mode 100644 index d5ee9650cd..0000000000 --- a/tests/auto/corelib/io/qstandardpaths/BLACKLIST +++ /dev/null @@ -1,3 +0,0 @@ -[testFindExecutable] -# QTBUG-64404 -b2qt 64bit diff --git a/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro b/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro index 9fd7047405..44b1ce8dd8 100644 --- a/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro +++ b/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro @@ -5,3 +5,6 @@ INCLUDEPATH += ../../../../shared/ HEADERS += ../../../../shared/emulationdetector.h SOURCES = tst_qstandardpaths.cpp TESTDATA += tst_qstandardpaths.cpp qstandardpaths.pro + +# QTBUG-64404 +boot2qt: DEFINES+=SKIP_FINDEXECUTABLE diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp index 3de777653e..e316ce9acb 100644 --- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp +++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp @@ -369,6 +369,12 @@ static inline QFileInfo findSh() void tst_qstandardpaths::testFindExecutable_data() { +#ifdef SKIP_FINDEXECUTABLE + // Test needs to be skipped or Q_ASSERT below will cancel the test + // and report FAIL regardless of BLACKLIST contents + QSKIP("QTBUG-64404"); +#endif + QTest::addColumn("directory"); QTest::addColumn("needle"); QTest::addColumn("expected"); diff --git a/tests/auto/corelib/serialization/qtextstream/test/test.pro b/tests/auto/corelib/serialization/qtextstream/test/test.pro index 3dcfa0b414..0f289a5ce1 100644 --- a/tests/auto/corelib/serialization/qtextstream/test/test.pro +++ b/tests/auto/corelib/serialization/qtextstream/test/test.pro @@ -3,6 +3,8 @@ TARGET = ../tst_qtextstream QT = core network testlib SOURCES = ../tst_qtextstream.cpp RESOURCES += ../qtextstream.qrc +INCLUDEPATH += ../../../../../shared/ +HEADERS += ../../../../../shared/emulationdetector.h win32 { CONFIG(debug, debug|release) { diff --git a/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp index df8746e518..77675b8e44 100644 --- a/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp +++ b/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp @@ -44,7 +44,7 @@ # include #endif #include "../../../network-settings.h" - +#include "emulationdetector.h" QT_BEGIN_NAMESPACE template<> struct QMetaTypeId @@ -1459,6 +1459,9 @@ void tst_QTextStream::pos2() // ------------------------------------------------------------------------------ void tst_QTextStream::pos3LargeFile() { + if (EmulationDetector::isRunningArmOnX86()) + QSKIP("Running QTextStream::pos() in tight loop is too slow on emulator"); + { QFile file(testFileName); file.open(QIODevice::WriteOnly | QIODevice::Text); diff --git a/tests/auto/network/access/http2/http2.pro b/tests/auto/network/access/http2/http2.pro index e130f30784..b244a827bd 100644 --- a/tests/auto/network/access/http2/http2.pro +++ b/tests/auto/network/access/http2/http2.pro @@ -2,7 +2,8 @@ QT += core core-private network network-private testlib CONFIG += testcase parallel_test c++11 TARGET = tst_http2 -HEADERS += http2srv.h +INCLUDEPATH += ../../../../shared/ +HEADERS += http2srv.h ../../../../shared/emulationdetector.h SOURCES += tst_http2.cpp http2srv.cpp DEFINES += SRCDIR=\\\"$$PWD/\\\" diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp index ecf4c5814a..51e30804a3 100644 --- a/tests/auto/network/access/http2/tst_http2.cpp +++ b/tests/auto/network/access/http2/tst_http2.cpp @@ -48,6 +48,8 @@ #include #include +#include "emulationdetector.h" + #if !defined(QT_NO_OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_TLSEXT) // HTTP/2 over TLS requires ALPN/NPN to negotiate the protocol version. const bool clearTextHTTP2 = false; @@ -292,6 +294,9 @@ void tst_Http2::flowControlServerSide() // to let all replies finish without any error. using namespace Http2; + if (EmulationDetector::isRunningArmOnX86()) + QSKIP("Test is too slow to run on emulator"); + clearHTTP2State(); serverPort = 0; diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index 263a475435..c473230246 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -2429,7 +2429,17 @@ void tst_QTcpSocket::suddenRemoteDisconnect() QString::fromLatin1("Could not start %1: %2").arg(processExe, serverProcess.errorString()))); while (!serverProcess.canReadLine()) QVERIFY(serverProcess.waitForReadyRead(10000)); - QCOMPARE(serverProcess.readLine().data(), QByteArray(server.toLatin1() + "\n").data()); + + QByteArray line = serverProcess.readLine(); + + // Ignore following print, happens on Qemu: + if (line == "getsockopt level=41 optname=26 not yet supported\n") { + while (!serverProcess.canReadLine()) + QVERIFY(serverProcess.waitForReadyRead(10000)); + line = serverProcess.readLine(); + } + + QCOMPARE(line.data(), QByteArray(server.toLatin1() + "\n").data()); // Start client QProcess clientProcess; diff --git a/tests/auto/other/qobjectrace/qobjectrace.pro b/tests/auto/other/qobjectrace/qobjectrace.pro index 94e7928585..6536810534 100644 --- a/tests/auto/other/qobjectrace/qobjectrace.pro +++ b/tests/auto/other/qobjectrace/qobjectrace.pro @@ -2,3 +2,6 @@ CONFIG += testcase SOURCES += tst_qobjectrace.cpp QT = core testlib +INCLUDEPATH += ../../../shared/ +HEADERS += ../../../shared/emulationdetector.h + diff --git a/tests/auto/other/qobjectrace/tst_qobjectrace.cpp b/tests/auto/other/qobjectrace/tst_qobjectrace.cpp index e6eb51500b..0d656e223c 100644 --- a/tests/auto/other/qobjectrace/tst_qobjectrace.cpp +++ b/tests/auto/other/qobjectrace/tst_qobjectrace.cpp @@ -30,6 +30,7 @@ #include #include +#include "emulationdetector.h" enum { OneMinute = 60 * 1000, TwoMinutes = OneMinute * 2 }; @@ -256,6 +257,9 @@ public: void tst_QObjectRace::destroyRace() { + if (EmulationDetector::isRunningArmOnX86()) + QSKIP("Test is too slow to run on emulator"); + enum { ThreadCount = 10, ObjectCountPerThread = 2777, ObjectCount = ThreadCount * ObjectCountPerThread }; diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index 63e5721e7e..26e3ccd0fb 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -659,6 +659,9 @@ static inline QByteArray msgProcessError(const QString &binary, const QStringLis void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& loggers, QStringList const& arguments, bool crashes) { + if (EmulationDetector::isRunningArmOnX86() && (subdir == "crashes")) + QSKIP("Skipping \"crashes\" due to QTBUG-71915"); + #if defined(__GNUC__) && defined(__i386) && defined(Q_OS_LINUX) if (arguments.contains("-callgrind")) { QProcess checkProcess; diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 7c1deb8fff..d5eef521ed 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -1671,6 +1671,13 @@ void tst_QComboBox::setCustomModelAndView() QTRY_VERIFY(combo.view()->isVisible()); const QRect subItemRect = view->visualRect(model->indexFromItem(subItem)); QWidget *window = view->window(); + + // QComboBox sometimes ignores the mouse click event for doubleClickInterval + // depending on which tests have been run previously. On arm this happens + // more often than on x86. Search for maybeIgnoreMouseButtonRelease to see + // why this happens. + QTest::qWait(QApplication::doubleClickInterval()); + QTest::mouseClick(window->windowHandle(), Qt::LeftButton, 0, view->mapTo(window, subItemRect.center())); QTRY_COMPARE(combo.currentText(), subItem21Text); } @@ -3436,6 +3443,11 @@ void tst_QComboBox::task_QTBUG_52027_mapCompleterIndex() model->setFilterFixedString("foobar1"); completer->setModel(model); + if (QGuiApplication::platformName() == "offscreen") { + QWARN("Offscreen platform requires explicit activateWindow()"); + cbox.activateWindow(); + } + QApplication::setActiveWindow(&cbox); QVERIFY(QTest::qWaitForWindowActive(&cbox)); -- cgit v1.2.3