From f659d98cc62cf759ca911a22f8c1b36f6331200e Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 3 Jul 2019 13:49:59 +0200 Subject: [PATCH] Merge #16294: qt: test: Create at most one testing setup faa1e0fb1712b1f94334e42794163f79988270fd qt: test: Create at most one testing setup (MarcoFalke) Pull request description: It is assumed that ideally only one BasicTestingSetup exists at any point in time for each process (due to use of globals). This assumption is violated in the GUI tests, as a testing setup is created as the first step of the `main` function and then (sometimes) another one for the following test cases. So, the gui tests create two testing setups: * `BasicTestingSetup` in `main` (added in fa4a04a5a942d582c62773d815c7e1e9897975d0) * a testing setup for individual test cases Avoid that by destructing the testing setup in main after creation and then move the explicit `ECC_Stop` to the only places where it is needed (before and after `apptests`). ACKs for top commit: laanwj: code review ACK faa1e0fb1712b1f94334e42794163f79988270fd Tree-SHA512: b8edceb7e2a8749e1de3ea80bc20b6fb7d4390bf366bb9817206ada3dc8669a91416f4803c22a0e6c636c514e0c858dcfe04523221f8851b10deaf472f107d82 --- src/qt/test/apptests.cpp | 5 +++-- src/qt/test/paymentservertests.cpp | 4 ++-- src/qt/test/rpcnestedtests.cpp | 3 --- src/qt/test/test_main.cpp | 12 +++++++++--- test/lint/lint-circular-dependencies.sh | 1 + 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/qt/test/apptests.cpp b/src/qt/test/apptests.cpp index a14cc41ac3..938dc983fe 100644 --- a/src/qt/test/apptests.cpp +++ b/src/qt/test/apptests.cpp @@ -12,6 +12,8 @@ #include #include #include +#include +#include #include #if defined(HAVE_CONFIG_H) @@ -31,8 +33,6 @@ #include #include #include -#include -#include namespace { //! Call getblockchaininfo RPC and check first field of JSON output. @@ -67,6 +67,7 @@ void AppTests::appTests() } #endif + BasicTestingSetup test{CBaseChainParams::REGTEST}; // Create a temp data directory to backup the gui settings to ECC_Stop(); // Already started by the common test setup, so stop it to avoid interference LogInstance().DisconnectTestLogger(); diff --git a/src/qt/test/paymentservertests.cpp b/src/qt/test/paymentservertests.cpp index a195ad5aa3..67721bb76f 100644 --- a/src/qt/test/paymentservertests.cpp +++ b/src/qt/test/paymentservertests.cpp @@ -13,7 +13,7 @@ #include #include