aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2022-04-13 01:13:50 +0200
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2022-04-13 01:17:30 +0200
commitf50976002645a2293b7c7e5c1c39bc5026167950 (patch)
tree77dd96f4651c61b034093643e01fb7311b4dc661
parent0f46e73c740e98854f3c4cce27071e7e2b6ebdc3 (diff)
parentd025d7f0251e26b7ab5cf48c236b6b5e46fafe26 (diff)
downloadbitcoin-f50976002645a2293b7c7e5c1c39bc5026167950.tar.xz
Merge bitcoin-core/gui#576: Add qt unit test runner summary
d025d7f0251e26b7ab5cf48c236b6b5e46fafe26 gui, refactor: rename fInvalid to num_test_failures in test_main.cpp (Jon Atack) 2489b6fe9cd1b669362d459e93185ca0bd9f8714 gui: count test failures in test runner summary (Jon Atack) ba44aae7683f412626baa8bf51708ddf25f51ba8 gui: add test runner summary (Jon Atack) Pull request description: Append a one-line summary to the output of running `./src/qt/test/test_bitcoin-qt` indicating that all tests passed or showing the number of failing tests. It's currently a bit inconvenient to see this result by eyeballing all of the output. ACKs for top commit: shaavan: ACK d025d7f0251e26b7ab5cf48c236b6b5e46fafe26 jarolrod: tACK https://github.com/bitcoin-core/gui/commit/d025d7f0251e26b7ab5cf48c236b6b5e46fafe26 Tree-SHA512: 981c5daa13db127d38167bcf78b296b1a7e5b2d12e65f364ec6382b24f1008a223521d3b6c56e920bcd037479da5414e43758794688019d09e9aa696f3964746
-rw-r--r--src/qt/test/test_main.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp
index 07d256f05a..aeedd92834 100644
--- a/src/qt/test/test_main.cpp
+++ b/src/qt/test/test_main.cpp
@@ -21,8 +21,10 @@
#endif // ENABLE_WALLET
#include <QApplication>
+#include <QDebug>
#include <QObject>
#include <QTest>
+
#include <functional>
#if defined(QT_STATICPLUGIN)
@@ -69,8 +71,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.
@@ -86,32 +86,32 @@ int main(int argc, char* argv[])
app.setApplicationName("Bitcoin-Qt-test");
app.createNode(*init);
+ 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
- return fInvalid;
+ if (num_test_failures) {
+ qWarning("\nFailed tests: %d\n", num_test_failures);
+ } else {
+ qDebug("\nAll tests passed.\n");
+ }
+ return num_test_failures;
}