Skip to content

Commit

Permalink
merge bitcoin-core/gui#576: Add qt unit test runner summary
Browse files Browse the repository at this point in the history
  • Loading branch information
kwvg committed Feb 5, 2025
1 parent aec2927 commit b25f165
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions src/qt/test/test_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
#endif // ENABLE_WALLET

#include <QApplication>
#include <QDebug>
#include <QObject>
#include <QTest>

#include <functional>

#if defined(QT_STATIC)
Expand Down Expand Up @@ -67,8 +69,6 @@ int main(int argc, char* argv[])
gArgs.ForceSetArg("-upnp", "0");
gArgs.ForceSetArg("-natpmp", "0");

bool fInvalid = false;

// Prefer the "minimal" platform for the test instead of the normal default
// platform ("xcb", "windows", or "cocoa") so tests can't unintentionally
// interfere with any background GUIs and don't require extra resources.
Expand All @@ -83,35 +83,35 @@ int main(int argc, char* argv[])
app.setApplicationName("Dash-Qt-test");

app.node().context()->args = &gArgs; // Make gArgs available in the NodeContext

int num_test_failures{0};

AppTests app_tests(app);
if (QTest::qExec(&app_tests) != 0) {
fInvalid = true;
}
num_test_failures += QTest::qExec(&app_tests);

OptionTests options_tests(app.node());
if (QTest::qExec(&options_tests) != 0) {
fInvalid = true;
}
num_test_failures += QTest::qExec(&options_tests);

URITests test1;
if (QTest::qExec(&test1) != 0) {
fInvalid = true;
}
num_test_failures += QTest::qExec(&test1);

RPCNestedTests test3(app.node());
if (QTest::qExec(&test3) != 0) {
fInvalid = true;
}
num_test_failures += QTest::qExec(&test3);

#ifdef ENABLE_WALLET
WalletTests test5(app.node());
if (QTest::qExec(&test5) != 0) {
fInvalid = true;
}
num_test_failures += QTest::qExec(&test5);

AddressBookTests test6(app.node());
if (QTest::qExec(&test6) != 0) {
fInvalid = true;
}
num_test_failures += QTest::qExec(&test6);
#endif

TrafficGraphDataTests test7;
if (QTest::qExec(&test7) != 0)
fInvalid = true;
return fInvalid;
num_test_failures += QTest::qExec(&test7);

if (num_test_failures) {
qWarning("\nFailed tests: %d\n", num_test_failures);
} else {
qDebug("\nAll tests passed.\n");
}
return num_test_failures;
}

0 comments on commit b25f165

Please sign in to comment.