diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2023-09-14 18:18:59 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2023-09-18 10:36:40 +0000 |
commit | cafbdb51ac3f583fd1b4ee71b83761125ea5a15f (patch) | |
tree | dc3f568fec68dd101e4a73d12bfa015746cdd5a1 /tests/auto | |
parent | 4b78f9a860b0496be4b8392cfbb1e4e6b992fa3d (diff) |
Loader: Do not share logger between threads
The logger is not thread-safe when stored warnings are enabled.
Change-Id: Icb7a3add9f6162ab823c0b27059aea88822ff60a
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/api/testdata/restored-warnings/restored-warnings.qbs | 23 | ||||
-rw-r--r-- | tests/auto/api/tst_api.cpp | 10 |
2 files changed, 22 insertions, 11 deletions
diff --git a/tests/auto/api/testdata/restored-warnings/restored-warnings.qbs b/tests/auto/api/testdata/restored-warnings/restored-warnings.qbs index bbdfbeadb..f6a68f27c 100644 --- a/tests/auto/api/testdata/restored-warnings/restored-warnings.qbs +++ b/tests/auto/api/testdata/restored-warnings/restored-warnings.qbs @@ -1,14 +1,21 @@ import qbs.Process 1.5 -CppApplication { - name: "theProduct" +Project { + CppApplication { + name: "theProduct" - property bool moreFiles: false - cpp.blubb: true + property bool moreFiles: false + cpp.blubb: true - files: ["file.cpp", "main.cpp"] - Group { - condition: moreFiles - files: ["blubb.cpp"] + files: ["file.cpp", "main.cpp"] + Group { + condition: moreFiles + files: ["blubb.cpp"] + } + } + + Product { + name: "theOtherProduct" + property bool dummy: { throw "this one comes from a thread"; } } } diff --git a/tests/auto/api/tst_api.cpp b/tests/auto/api/tst_api.cpp index 4eb6b4654..140cadeb9 100644 --- a/tests/auto/api/tst_api.cpp +++ b/tests/auto/api/tst_api.cpp @@ -2711,12 +2711,14 @@ void TestApi::restoredWarnings() waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); job.reset(nullptr); - QCOMPARE(toSet(m_logSink->warnings).size(), 3); + QCOMPARE(toSet(m_logSink->warnings).size(), 5); const auto beforeErrors = m_logSink->warnings; for (const qbs::ErrorInfo &e : beforeErrors) { const QString msg = e.toString(); QVERIFY2(msg.contains("Superfluous version") || msg.contains("Property 'blubb' is not declared") + || msg.contains("this one comes from a thread") + || msg.contains("Product 'theOtherProduct' had errors and was disabled") || msg.contains("Product 'theProduct' had errors and was disabled"), qPrintable(msg)); } @@ -2727,7 +2729,7 @@ void TestApi::restoredWarnings() waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); job.reset(nullptr); - QCOMPARE(toSet(m_logSink->warnings).size(), 3); + QCOMPARE(toSet(m_logSink->warnings).size(), 5); m_logSink->warnings.clear(); // Re-resolving with changes: Errors come from the re-resolving, stored ones must be suppressed. @@ -2738,13 +2740,15 @@ void TestApi::restoredWarnings() waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); job.reset(nullptr); - QCOMPARE(toSet(m_logSink->warnings).size(), 4); // One more for the additional group + QCOMPARE(toSet(m_logSink->warnings).size(), 6); // One more for the additional group const auto afterErrors = m_logSink->warnings; for (const qbs::ErrorInfo &e : afterErrors) { const QString msg = e.toString(); QVERIFY2(msg.contains("Superfluous version") || msg.contains("Property 'blubb' is not declared") || msg.contains("blubb.cpp' does not exist") + || msg.contains("this one comes from a thread") + || msg.contains("Product 'theOtherProduct' had errors and was disabled") || msg.contains("Product 'theProduct' had errors and was disabled"), qPrintable(msg)); } |