Skip to content

Commit 2489b6f

Browse files
committed
gui: count test failures in test runner summary
1 parent ba44aae commit 2489b6f

File tree

1 file changed

+14
-21
lines changed

1 file changed

+14
-21
lines changed

src/qt/test/test_main.cpp

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ int main(int argc, char* argv[])
7171
gArgs.ForceSetArg("-upnp", "0");
7272
gArgs.ForceSetArg("-natpmp", "0");
7373

74-
bool fInvalid = false;
75-
7674
// Prefer the "minimal" platform for the test instead of the normal default
7775
// platform ("xcb", "windows", or "cocoa") so tests can't unintentionally
7876
// interfere with any background GUIs and don't require extra resources.
@@ -88,35 +86,30 @@ int main(int argc, char* argv[])
8886
app.setApplicationName("Bitcoin-Qt-test");
8987
app.createNode(*init);
9088

89+
int fInvalid{0};
90+
9191
AppTests app_tests(app);
92-
if (QTest::qExec(&app_tests) != 0) {
93-
fInvalid = true;
94-
}
92+
fInvalid += QTest::qExec(&app_tests);
93+
9594
OptionTests options_tests(app.node());
96-
if (QTest::qExec(&options_tests) != 0) {
97-
fInvalid = true;
98-
}
95+
fInvalid += QTest::qExec(&options_tests);
96+
9997
URITests test1;
100-
if (QTest::qExec(&test1) != 0) {
101-
fInvalid = true;
102-
}
98+
fInvalid += QTest::qExec(&test1);
99+
103100
RPCNestedTests test3(app.node());
104-
if (QTest::qExec(&test3) != 0) {
105-
fInvalid = true;
106-
}
101+
fInvalid += QTest::qExec(&test3);
102+
107103
#ifdef ENABLE_WALLET
108104
WalletTests test5(app.node());
109-
if (QTest::qExec(&test5) != 0) {
110-
fInvalid = true;
111-
}
105+
fInvalid += QTest::qExec(&test5);
106+
112107
AddressBookTests test6(app.node());
113-
if (QTest::qExec(&test6) != 0) {
114-
fInvalid = true;
115-
}
108+
fInvalid += QTest::qExec(&test6);
116109
#endif
117110

118111
if (fInvalid) {
119-
qWarning("\nThere were errors in some of the tests above.\n");
112+
qWarning("\nFailed tests: %d\n", fInvalid);
120113
} else {
121114
qDebug("\nAll tests passed.\n");
122115
}

0 commit comments

Comments
 (0)