diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2024-03-05 07:39:48 +0000 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2024-03-05 07:39:48 +0000 |
commit | 0dcbad341b0a8420a899c6dce0db56dd0deaa036 (patch) | |
tree | 3a3eae5e721737a2cf34c20be264d992c4911a93 /src/qt/test | |
parent | 49cf63522e202caf326bad161ff6fa05d1076566 (diff) | |
download | bitcoin-0dcbad341b0a8420a899c6dce0db56dd0deaa036.tar.xz |
qt, test: Clean settings after tests
A test suite should not leave any artifacts except for those explicitly
expected.
This change is easy to review with `git diff --ignore-all-space`
command.
Diffstat (limited to 'src/qt/test')
-rw-r--r-- | src/qt/test/test_main.cpp | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp index b764d4e7ba..8decc27bd7 100644 --- a/src/qt/test/test_main.cpp +++ b/src/qt/test/test_main.cpp @@ -85,37 +85,45 @@ int main(int argc, char* argv[]) setenv("QT_QPA_PLATFORM", "minimal", 0 /* overwrite */); #endif - BitcoinApplication app; - app.setOrganizationName(QAPP_ORG_NAME); - app.setApplicationName(QAPP_APP_NAME_DEFAULT "-test"); - app.createNode(*init); + + QCoreApplication::setOrganizationName(QAPP_ORG_NAME); + QCoreApplication::setApplicationName(QAPP_APP_NAME_DEFAULT "-test"); int num_test_failures{0}; - AppTests app_tests(app); - num_test_failures += QTest::qExec(&app_tests); + { + BitcoinApplication app; + app.createNode(*init); + + AppTests app_tests(app); + num_test_failures += QTest::qExec(&app_tests); - OptionTests options_tests(app.node()); - num_test_failures += QTest::qExec(&options_tests); + OptionTests options_tests(app.node()); + num_test_failures += QTest::qExec(&options_tests); - URITests test1; - num_test_failures += QTest::qExec(&test1); + URITests test1; + num_test_failures += QTest::qExec(&test1); - RPCNestedTests test3(app.node()); - num_test_failures += QTest::qExec(&test3); + RPCNestedTests test3(app.node()); + num_test_failures += QTest::qExec(&test3); #ifdef ENABLE_WALLET - WalletTests test5(app.node()); - num_test_failures += QTest::qExec(&test5); + WalletTests test5(app.node()); + num_test_failures += QTest::qExec(&test5); - AddressBookTests test6(app.node()); - num_test_failures += QTest::qExec(&test6); + AddressBookTests test6(app.node()); + num_test_failures += QTest::qExec(&test6); #endif - if (num_test_failures) { - qWarning("\nFailed tests: %d\n", num_test_failures); - } else { - qDebug("\nAll tests passed.\n"); + if (num_test_failures) { + qWarning("\nFailed tests: %d\n", num_test_failures); + } else { + qDebug("\nAll tests passed.\n"); + } } + + QSettings settings; + settings.clear(); + return num_test_failures; } |