From ba44aae7683f412626baa8bf51708ddf25f51ba8 Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Wed, 6 Apr 2022 22:43:11 +0200 Subject: [PATCH 1/3] gui: add test runner summary --- src/qt/test/test_main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp index 07d256f05ae..834f31dd53a 100644 --- a/src/qt/test/test_main.cpp +++ b/src/qt/test/test_main.cpp @@ -21,8 +21,10 @@ #endif // ENABLE_WALLET #include +#include #include #include + #include #if defined(QT_STATICPLUGIN) @@ -113,5 +115,10 @@ int main(int argc, char* argv[]) } #endif + if (fInvalid) { + qWarning("\nThere were errors in some of the tests above.\n"); + } else { + qDebug("\nAll tests passed.\n"); + } return fInvalid; } From 2489b6fe9cd1b669362d459e93185ca0bd9f8714 Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Wed, 6 Apr 2022 23:39:51 +0200 Subject: [PATCH 2/3] gui: count test failures in test runner summary --- src/qt/test/test_main.cpp | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp index 834f31dd53a..6a895ae9b44 100644 --- a/src/qt/test/test_main.cpp +++ b/src/qt/test/test_main.cpp @@ -71,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. @@ -88,35 +86,30 @@ int main(int argc, char* argv[]) app.setApplicationName("Bitcoin-Qt-test"); app.createNode(*init); + int fInvalid{0}; + AppTests app_tests(app); - if (QTest::qExec(&app_tests) != 0) { - fInvalid = true; - } + fInvalid += QTest::qExec(&app_tests); + OptionTests options_tests(app.node()); - if (QTest::qExec(&options_tests) != 0) { - fInvalid = true; - } + fInvalid += QTest::qExec(&options_tests); + URITests test1; - if (QTest::qExec(&test1) != 0) { - fInvalid = true; - } + fInvalid += QTest::qExec(&test1); + RPCNestedTests test3(app.node()); - if (QTest::qExec(&test3) != 0) { - fInvalid = true; - } + fInvalid += QTest::qExec(&test3); + #ifdef ENABLE_WALLET WalletTests test5(app.node()); - if (QTest::qExec(&test5) != 0) { - fInvalid = true; - } + fInvalid += QTest::qExec(&test5); + AddressBookTests test6(app.node()); - if (QTest::qExec(&test6) != 0) { - fInvalid = true; - } + fInvalid += QTest::qExec(&test6); #endif if (fInvalid) { - qWarning("\nThere were errors in some of the tests above.\n"); + qWarning("\nFailed tests: %d\n", fInvalid); } else { qDebug("\nAll tests passed.\n"); } From d025d7f0251e26b7ab5cf48c236b6b5e46fafe26 Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Wed, 6 Apr 2022 23:43:27 +0200 Subject: [PATCH 3/3] gui, refactor: rename fInvalid to num_test_failures in test_main.cpp --- src/qt/test/test_main.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp index 6a895ae9b44..aeedd928343 100644 --- a/src/qt/test/test_main.cpp +++ b/src/qt/test/test_main.cpp @@ -86,32 +86,32 @@ int main(int argc, char* argv[]) app.setApplicationName("Bitcoin-Qt-test"); app.createNode(*init); - int fInvalid{0}; + int num_test_failures{0}; AppTests app_tests(app); - fInvalid += QTest::qExec(&app_tests); + num_test_failures += QTest::qExec(&app_tests); OptionTests options_tests(app.node()); - fInvalid += QTest::qExec(&options_tests); + num_test_failures += QTest::qExec(&options_tests); URITests test1; - fInvalid += QTest::qExec(&test1); + num_test_failures += QTest::qExec(&test1); RPCNestedTests test3(app.node()); - fInvalid += QTest::qExec(&test3); + num_test_failures += QTest::qExec(&test3); #ifdef ENABLE_WALLET WalletTests test5(app.node()); - fInvalid += QTest::qExec(&test5); + num_test_failures += QTest::qExec(&test5); AddressBookTests test6(app.node()); - fInvalid += QTest::qExec(&test6); + num_test_failures += QTest::qExec(&test6); #endif - if (fInvalid) { - qWarning("\nFailed tests: %d\n", fInvalid); + if (num_test_failures) { + qWarning("\nFailed tests: %d\n", num_test_failures); } else { qDebug("\nAll tests passed.\n"); } - return fInvalid; + return num_test_failures; }