diff options
| author | Edward Welbourne <edward.welbourne@qt.io> | 2022-05-30 11:39:42 +0200 |
|---|---|---|
| committer | Edward Welbourne <edward.welbourne@qt.io> | 2022-11-28 16:29:56 +0100 |
| commit | 098b2c5e0268ac179c1e980a21c4d886b73a0439 (patch) | |
| tree | fbcc57c2d6875f84c97ffa36e29d507a64cefc58 | |
| parent | 48e67d03c8abc9866bd5cf8be3d8c0dad92bf779 (diff) | |
Suppress ES-compiler warnings against the ES-262 test-suite
V4's ES-compiler warns about assorted variables in the ES-262
test-suite being used before declaration. We aren't about to fix that
test-suite, so the warnings are just noise to us. As there are many of
them, they overflow the QTestLib logger's -maxwarnings threshold,
causing actually relevant messages (like test failures) to be lost in
the output.
Install a trivial QLoggingCategory::CategoryFilter to filter out
warnings and debug for the qt.qml.compiler category (and all
sub-categories of it). Condition this on a define so that someone who
actually wants to see those warnings can turn them on.
Change-Id: If7decc241b407e816f5d7979b32f31a9f614d30f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit c9377cd6499e86ee147c3644fb9271a19a199443)
| -rw-r--r-- | tests/auto/qml/ecmascripttests/tst_ecmascripttests.cpp | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/tests/auto/qml/ecmascripttests/tst_ecmascripttests.cpp b/tests/auto/qml/ecmascripttests/tst_ecmascripttests.cpp index 7a53aaeaf3..bee391e62c 100644 --- a/tests/auto/qml/ecmascripttests/tst_ecmascripttests.cpp +++ b/tests/auto/qml/ecmascripttests/tst_ecmascripttests.cpp @@ -1,7 +1,6 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - #include <QtTest/QtTest> #include <QProcess> #include <QLibraryInfo> @@ -12,9 +11,52 @@ class tst_EcmaScriptTests : public QObject Q_OBJECT private slots: + void initTestCase(); + void cleanupTestCase(); void runInterpreted(); void runJitted(); + +private: + static QLoggingCategory::CategoryFilter priorFilter; + static void filterCategories(QLoggingCategory *category); }; +QLoggingCategory::CategoryFilter tst_EcmaScriptTests::priorFilter = nullptr; + +static inline bool isNoise(QByteArrayView name) +{ +#ifdef QT_V4_WANT_ES262_WARNINGS + return false; +#else + const QByteArrayView noisy("qt.qml.compiler"); + return name.startsWith(noisy) && (name.size() <= noisy.size() || name[noisy.size()] == '.'); +#endif +} + +void tst_EcmaScriptTests::filterCategories(QLoggingCategory *category) +{ + if (priorFilter) + priorFilter(category); + + if (isNoise(category->categoryName())) { + category->setEnabled(QtDebugMsg, false); + category->setEnabled(QtWarningMsg, false); + } +} + +void tst_EcmaScriptTests::initTestCase() +{ + /* Suppress lcQmlCompiler's "qt.qml.compiler" warnings; we aren't in a + position to fix test262's many warnings and they flood messages so we + didn't get to see actual failures unless we passed -maxwarnings with a + huge value on the command-line (resulting in huge log output). + */ + priorFilter = QLoggingCategory::installFilter(filterCategories); +} + +void tst_EcmaScriptTests::cleanupTestCase() +{ + QLoggingCategory::installFilter(priorFilter); +} void tst_EcmaScriptTests::runInterpreted() { |
