CI: Enable tests under corelib/text for Wasm platform

We are gradually enabling more tests for WebAssembly platform
for better test coverage.
Long linking time is no longer an issue due to test batching.

Change-Id: I7ee9f877ecda726bc23d8dd2507c616bb381ebc1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
This commit is contained in:
Piotr Wierciński 2023-07-05 15:50:15 +02:00
parent 3fa3e56e64
commit 2efd823962
8 changed files with 34 additions and 13 deletions

View File

@ -33,10 +33,8 @@ if(QT_BUILD_MINIMAL_ANDROID_MULTI_ABI_TESTS)
return() return()
endif() endif()
# Only configure a single auto test for wasm for now
# Since the linking step at this point is prohibitively long (static linking)
if(WASM) if(WASM)
add_subdirectory(corelib/text/qchar) add_subdirectory(corelib/text)
return() return()
endif() endif()

View File

@ -7,11 +7,18 @@ if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
endif() endif()
set(compile_and_link_options "")
if(WASM)
list(APPEND compile_and_link_options "-fexceptions")
endif()
qt_internal_add_test(tst_qbytearray_large qt_internal_add_test(tst_qbytearray_large
SOURCES SOURCES
tst_qbytearray_large.cpp tst_qbytearray_large.cpp
LIBRARIES LIBRARIES
Qt::Core Qt::Core
TESTDATA "rfc3252.txt" TESTDATA "rfc3252.txt"
COMPILE_OPTIONS ${compile_and_link_options}
LINK_OPTIONS ${compile_and_link_options}
) )

View File

@ -9,6 +9,7 @@
#include <QScopeGuard> #include <QScopeGuard>
#include <cstring> #include <cstring>
#include <iostream>
class tst_QCollator : public QObject class tst_QCollator : public QObject
{ {
@ -263,7 +264,11 @@ void tst_QCollator::compare()
auto asSign = [](int compared) { auto asSign = [](int compared) {
return compared < 0 ? -1 : compared > 0 ? 1 : 0; return compared < 0 ? -1 : compared > 0 ? 1 : 0;
}; };
#if defined(Q_OS_WASM)
if (strcmp(QTest::currentDataTag(), "english5") == 0
|| strcmp(QTest::currentDataTag(), "english8") == 0)
QSKIP("Some en-us locale tests have issues on WASM");
#endif // Q_OS_WASM
#if !QT_CONFIG(icu) && !defined(Q_OS_WIN) && !defined(Q_OS_MACOS) #if !QT_CONFIG(icu) && !defined(Q_OS_WIN) && !defined(Q_OS_MACOS)
if (collator.locale() != QLocale::c() && collator.locale() != QLocale::system().collation()) if (collator.locale() != QLocale::c() && collator.locale() != QLocale::system().collation())
QSKIP("POSIX implementation of collation only supports C and system collation locales"); QSKIP("POSIX implementation of collation only supports C and system collation locales");

View File

@ -1988,6 +1988,10 @@ void tst_QLocale::formatDateTime()
QFETCH(QString, format); QFETCH(QString, format);
QFETCH(QString, result); QFETCH(QString, result);
#if defined(Q_OS_WASM)
QEXPECT_FAIL("dd MMMM yyyy, hh:mm:ss", "Year 0001 doesn't get properly formatted on WASM C locale", Abort);
#endif // Q_OS_WASM
QLocale l(localeName); QLocale l(localeName);
QCOMPARE(l.toString(dateTime, format), result); QCOMPARE(l.toString(dateTime, format), result);
QCOMPARE(l.toString(dateTime, QStringView(format)), result); QCOMPARE(l.toString(dateTime, QStringView(format)), result);
@ -2010,16 +2014,16 @@ void tst_QLocale::formatTimeZone()
if (europeanTimeZone) { if (europeanTimeZone) {
// Time definitely in Standard Time // Time definitely in Standard Time
QDateTime dt4 = QDate(2013, 1, 1).startOfDay(); QDateTime dt4 = QDate(2013, 1, 1).startOfDay();
#ifdef Q_OS_WIN #if defined(Q_OS_WIN) || defined(Q_OS_WASM)
QEXPECT_FAIL("", "Windows only returns long name (QTBUG-32759)", Continue); QEXPECT_FAIL("", "Windows and Wasm only returns long name (QTBUG-32759)", Continue);
#endif // Q_OS_WIN #endif // Q_OS_WIN || Q_OS_WASM
QCOMPARE(enUS.toString(dt4, "t"), QLatin1String("CET")); QCOMPARE(enUS.toString(dt4, "t"), QLatin1String("CET"));
// Time definitely in Daylight Time // Time definitely in Daylight Time
QDateTime dt5 = QDate(2013, 6, 1).startOfDay(); QDateTime dt5 = QDate(2013, 6, 1).startOfDay();
#ifdef Q_OS_WIN #if defined(Q_OS_WIN) || defined(Q_OS_WASM)
QEXPECT_FAIL("", "Windows only returns long name (QTBUG-32759)", Continue); QEXPECT_FAIL("", "Windows and Wasm only returns long name (QTBUG-32759)", Continue);
#endif // Q_OS_WIN #endif // Q_OS_WIN || Q_OS_WASM
QCOMPARE(enUS.toString(dt5, "t"), QLatin1String("CEST")); QCOMPARE(enUS.toString(dt5, "t"), QLatin1String("CEST"));
} else { } else {
qDebug("(Skipped some CET-only tests)"); qDebug("(Skipped some CET-only tests)");

View File

@ -21,6 +21,7 @@ endif()
foreach(test tst_qstring tst_qstring_restricted_ascii tst_qstring_no_cast_from_ascii) foreach(test tst_qstring tst_qstring_restricted_ascii tst_qstring_no_cast_from_ascii)
qt_internal_add_test(${test} qt_internal_add_test(${test}
NO_BATCH
SOURCES SOURCES
tst_qstring.cpp tst_qstring.cpp
${tst_qstring_extra_sources} ${tst_qstring_extra_sources}

View File

@ -8,9 +8,10 @@
void tst_QString_wasmTypes() void tst_QString_wasmTypes()
{ {
const QLatin1StringView testString("test string");
// QString <-> emscripten::val // QString <-> emscripten::val
{ {
QString qtString("test string"); QString qtString = testString;
const emscripten::val jsString = qtString.toJsString(); const emscripten::val jsString = qtString.toJsString();
QString qtStringCopy(qtString); QString qtStringCopy(qtString);
qtString = qtString.toUpper(); // modify qtString = qtString.toUpper(); // modify
@ -19,7 +20,7 @@ void tst_QString_wasmTypes()
{ {
QString longString; QString longString;
for (uint64_t i = 0; i < 1000; ++i) for (uint64_t i = 0; i < 1000; ++i)
longString += "Lorem ipsum FTW"; longString += testString;
const emscripten::val jsString = longString.toJsString(); const emscripten::val jsString = longString.toJsString();
QString qtStringCopy(longString); QString qtStringCopy(longString);
longString = longString.toUpper(); // modify longString = longString.toUpper(); // modify

View File

@ -23,6 +23,8 @@
Q_DECLARE_METATYPE(QLatin1String) Q_DECLARE_METATYPE(QLatin1String)
namespace {
struct QAnyStringViewUsingL1 : QAnyStringView {}; // QAnyStringView with Latin-1 content struct QAnyStringViewUsingL1 : QAnyStringView {}; // QAnyStringView with Latin-1 content
struct QAnyStringViewUsingU8 : QAnyStringView {}; // QAnyStringView with Utf-8 content struct QAnyStringViewUsingU8 : QAnyStringView {}; // QAnyStringView with Utf-8 content
struct QAnyStringViewUsingU16 : QAnyStringView {}; // QAnyStringView with Utf-16 content struct QAnyStringViewUsingU16 : QAnyStringView {}; // QAnyStringView with Utf-16 content
@ -82,6 +84,8 @@ MAKE_ALL(QUtf8StringView, QLatin1String)
#undef MAKE_RELOP #undef MAKE_RELOP
// END FIXME // END FIXME
} // namespace
static constexpr int sign(int i) noexcept static constexpr int sign(int i) noexcept
{ {
return i < 0 ? -1 : return i < 0 ? -1 :

View File

@ -9,7 +9,7 @@
#include <string> #include <string>
Q_DECLARE_METATYPE(Qt::SplitBehavior) Q_DECLARE_METATYPE(Qt::SplitBehavior)
namespace {
class tst_QStringTokenizer : public QObject class tst_QStringTokenizer : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -45,6 +45,7 @@ QStringList toQStringList(const Container &c)
r.push_back(toQString(e)); r.push_back(toQString(e));
return r; return r;
} }
} // namespace
void tst_QStringTokenizer::constExpr() const void tst_QStringTokenizer::constExpr() const
{ {