Skip to content

Commit

Permalink
Fix problemreportertest
Browse files Browse the repository at this point in the history
  • Loading branch information
dantti committed Dec 19, 2023
1 parent 94f6aed commit 2728605
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 26 deletions.
26 changes: 6 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,54 +79,40 @@ 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
- name: Run tests on Linux Qt6 (offscreen)
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)
- name: Run tests Qt5 on macOS
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)
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions tests/baseprobetest.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
21 changes: 15 additions & 6 deletions tests/problemreportertest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,19 +345,28 @@ 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"); });

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);
Expand Down

0 comments on commit 2728605

Please sign in to comment.