From 27286059e2c2f091c3a5f284572578490d8fbc3b Mon Sep 17 00:00:00 2001 From: Daniel Nicoletti Date: Tue, 19 Dec 2023 19:23:11 -0300 Subject: [PATCH] Fix problemreportertest --- .github/workflows/build.yml | 26 ++++++-------------------- tests/baseprobetest.h | 1 + tests/problemreportertest.cpp | 21 +++++++++++++++------ 3 files changed, 22 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1756c7aa67..61c1c5e162 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -79,19 +79,17 @@ jobs: run: echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope # Exclude - # connectiontest-style-filter is flaky # quickmaterialtest|quicktexturetest fails because of QT_QUICK_BACKEND=software - name: Run tests on Linux Qt5 (offscreen) if: ${{ runner.os == 'Linux' && matrix.config.qt_major == 5 }} run: > ctest --test-dir ./build -C ${{ matrix.build_type }} --output-on-failure - --exclude-regex "quickmaterialtest|quicktexturetest|problemreportertest|timertoptest" + --exclude-regex "quickmaterialtest|quicktexturetest|timertoptest" env: QT_QPA_PLATFORM: offscreen QT_QUICK_BACKEND: software # Exclude - # connectiontest-style-filter|bindinginspectortest is flaky # quickmaterialtest|quicktexturetest fails because of QT_QUICK_BACKEND=software AND QT_QPA_PLATFORM=offscreen # quickinspectortest|quickinspectortest2 fails at CI, local with 6.2.4 passes # modelinspectortest fails in Qt6/CI passes locally @@ -99,18 +97,12 @@ jobs: if: ${{ runner.os == 'Linux' && matrix.config.qt_major == 6 }} run: > ctest --test-dir ./build -C ${{ matrix.build_type }} --output-on-failure - --exclude-regex "quickmaterialtest|quicktexturetest|bindinginspectortest|quickinspectortest|quickinspectortest2|modelinspectortest|problemreportertest|timertoptest" + --exclude-regex "quickmaterialtest|quicktexturetest|bindinginspectortest|quickinspectortest|quickinspectortest2|modelinspectortest|timertoptest" env: QT_QPA_PLATFORM: offscreen QT_QUICK_BACKEND: software # Exclude - #1 - connectiontest-preload (Failed) - #2 - connectiontest-preload-filter (Failed) - #3 - connectiontest-style (Failed) - #4 - connectiontest-style-filter (Failed) - #5 - connectiontest-lldb (Failed) - #6 - connectiontest-lldb-filter (Failed) #23 - probeabidetectortest (Failed) #26 - launchertest (Failed) #37 - quickinspectortest2 (Failed) @@ -118,15 +110,9 @@ jobs: if: ${{ runner.os == 'macOS' && matrix.config.qt_major == 5 }} run: > ctest --test-dir ./build -C ${{ matrix.build_type }} --output-on-failure - --exclude-regex "probeabidetectortest|launchertest|quickinspectortest2|problemreportertest|timertoptest" + --exclude-regex "probeabidetectortest|launchertest|quickinspectortest2|timertoptest" # Exclude - #1 - connectiontest-preload (Failed) - #2 - connectiontest-preload-filter (Failed) - #3 - connectiontest-style (Failed) - #4 - connectiontest-style-filter (Failed) - #5 - connectiontest-lldb (Failed) - #6 - connectiontest-lldb-filter (Failed) #28 - probeabidetectortest (Failed) #31 - launchertest (Failed) #32 - clientconnectiontest (Failed) @@ -138,7 +124,7 @@ jobs: run: > ctest --test-dir ./build -C ${{ matrix.build_type }} --output-on-failure --exclude-regex - "probeabidetectortest|launchertest|clientconnectiontest|modelinspectortest|quickinspectortest2|bindinginspectortest|quicktexturetest|problemreportertest|timertoptest" + "probeabidetectortest|launchertest|clientconnectiontest|modelinspectortest|quickinspectortest2|bindinginspectortest|quicktexturetest|timertoptest" # Exclude # quicktexturetest @@ -147,7 +133,7 @@ jobs: if: ${{ runner.os == 'Windows' && matrix.config.qt_major == 5 }} run: > ctest --test-dir ./build -C ${{ matrix.build_type }} --output-on-failure - --exclude-regex "quicktexturetest|bindinginspectortest|problemreportertest|timertoptest|problemreportertest|timertoptest" + --exclude-regex "quicktexturetest|bindinginspectortest|timertoptest" # Exclude # quicktexturetest @@ -157,7 +143,7 @@ jobs: if: ${{ runner.os == 'Windows' && matrix.config.qt_major == 6 }} run: > ctest --test-dir ./build -C ${{ matrix.build_type }} --output-on-failure - --exclude-regex "quicktexturetest|launchertest|bindinginspectortest|modelinspectortest|problemreportertest|timertoptest|probesettingstest" + --exclude-regex "quicktexturetest|launchertest|bindinginspectortest|modelinspectortest|timertoptest|probesettingstest" - name: Read tests log when it fails uses: andstor/file-reader-action@v1 diff --git a/tests/baseprobetest.h b/tests/baseprobetest.h index 9c9e254f76..749cb4581b 100644 --- a/tests/baseprobetest.h +++ b/tests/baseprobetest.h @@ -38,6 +38,7 @@ class BaseProbeTest : public QObject protected: virtual void createProbe() { + Paths::setRelativeRootPath(GAMMARAY_INVERSE_BIN_DIR); qputenv("GAMMARAY_ProbePath", Paths::probePath(GAMMARAY_PROBE_ABI).toUtf8()); qputenv("GAMMARAY_ServerAddress", GAMMARAY_DEFAULT_LOCAL_TCP_URL); diff --git a/tests/problemreportertest.cpp b/tests/problemreportertest.cpp index 801428c4b4..09f9dcbf52 100644 --- a/tests/problemreportertest.cpp +++ b/tests/problemreportertest.cpp @@ -345,9 +345,14 @@ private slots: QVERIFY(crossThreadProblem != problems.end()); QCOMPARE(crossThreadProblem->object, ObjectId(task->mainThreadObj.get())); - QVERIFY(crossThreadProblem->description.contains("direct cross-thread connection")); - QVERIFY(crossThreadProblem->description.contains("signal newThreadObj")); - QVERIFY(crossThreadProblem->description.contains("slot mainThreadObj")); + QVERIFY2(crossThreadProblem->description.contains("direct cross-thread connection"), qPrintable(crossThreadProblem->description)); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QVERIFY2(crossThreadProblem->description.contains("signal QObject (newThreadObj)"), qPrintable(crossThreadProblem->description)); + QVERIFY2(crossThreadProblem->description.contains("slot QObject (mainThreadObj)"), qPrintable(crossThreadProblem->description)); +#else + QVERIFY2(crossThreadProblem->description.contains("signal QtQml/QtObject (newThreadObj)"), qPrintable(crossThreadProblem->description)); + QVERIFY2(crossThreadProblem->description.contains("slot QtQml/QtObject (mainThreadObj)"), qPrintable(crossThreadProblem->description)); +#endif auto duplicateProblem = std::find_if(problems.begin(), problems.end(), [](const Problem &p) { return p.problemId.startsWith("com.kdab.GammaRay.ObjectInspector.ConnectionsCheck.Duplicate"); }); @@ -355,9 +360,13 @@ private slots: QVERIFY(duplicateProblem != problems.end()); QCOMPARE(duplicateProblem->object, ObjectId(o2.get())); QVERIFY(duplicateProblem->description.contains("multiple times")); - QVERIFY(duplicateProblem->description.contains("signal o1")); - QVERIFY(duplicateProblem->description.contains("slot o2")); - +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QVERIFY2(duplicateProblem->description.contains("signal QObject (o1)"), qPrintable(duplicateProblem->description)); + QVERIFY2(duplicateProblem->description.contains("slot QObject (o2)"), qPrintable(duplicateProblem->description)); +#else + QVERIFY2(duplicateProblem->description.contains("signal QtQml/QtObject (o1)"), qPrintable(duplicateProblem->description)); + QVERIFY2(duplicateProblem->description.contains("slot QtQml/QtObject (o2)"), qPrintable(duplicateProblem->description)); +#endif disconnect(o1.get(), nullptr, o2.get(), nullptr); connect(o1.get(), &QObject::destroyed, o2.get(), &QObject::deleteLater);