0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-02 09:46:52 -05:00

Merge bitcoin/bitcoin#22086: test: remove BasicTestingSetup from unit tests that don't need it

6c3fcd5591 test: remove BasicTestingSetup from util_threadnames unit tests (fanquake)
b53d3c1b1f test: remove BasicTestingSetup from uint256 unit tests (fanquake)
c0497a4928 test: remove BasicTestingSetup from torcontrol unit tests (fanquake)
ef8bb0473b test: remove BasicTestingSetup from sync unit tests (fanquake)
1aee83421f test: remove BasicTestingSetup from reverse_lock unit tests (fanquake)
57ba949ef5 test: remove BasicTestingSetup from policy_fee unit tests (fanquake)
3974c962b6 test: remove BasicTestingSetup from merkleblock tests (fanquake)
cd5bc4b470 test: remove BasicTestingSetup from hash unit tests (fanquake)
39cec22935 test: remove BasicTestingSetup from compilerbug unit tests (fanquake)
6d3b78c0e2 test: remove BasicTestingSetup from bswap unit tests (fanquake)
a13dc24831 test: remove BasicTestingSetup from bech32 unit tests (fanquake)
f4dcbe4498 test: remove BasicTestingSetup from base64 unit tests (fanquake)
fd144f6426 test: remove BasicTestingSetup from base32 unit tests (fanquake)
4c389ba04b test: remove BasicTestingSetup from arith_uint256 unit tests (fanquake)
05590651a0 test: remove BasicTestingSetup from amount unit tests (fanquake)
883a5c7d02 test: remove BasicTestingSetup from allocator unit tests (fanquake)

Pull request description:

  * Less setup/overhead for tests that don't need it. Some naive bench-marking would suggest that a full `test_bitcoin` run is a few % faster after this change.
  * Tests which don't need the BasicTestingSetup can't accidentally end up depending on it somehow.
  * Already the case in at least the scheduler and block_filter tests.

  This adds missing includes, but more significant is the removal of `setup_common.h` from tests where it isn't needed. This saves recompiling those tests when changes are made in the header.

ACKs for top commit:
  practicalswift:
    cr ACK 6c3fcd5591: patch looks correct
  laanwj:
    ACK 6c3fcd5591

Tree-SHA512: 69b891e2b4740402d62b86a4fc98c329a432d125971342a6f97334e166b3537ed3d4cdbb2531fa05c1feae32339c9fcb2dceda9afeeaed4edc70e8caa0962161
This commit is contained in:
W. J. van der Laan 2021-06-02 16:44:15 +02:00
commit a7d17daa5c
No known key found for this signature in database
GPG key ID: 1E4AED62986CD25D
16 changed files with 36 additions and 30 deletions

View file

@ -2,15 +2,18 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <support/lockedpool.h>
#include <util/system.h>
#include <test/util/setup_common.h>
#include <limits>
#include <memory>
#include <stdexcept>
#include <utility>
#include <vector>
#include <boost/test/unit_test.hpp>
BOOST_FIXTURE_TEST_SUITE(allocator_tests, BasicTestingSetup)
BOOST_AUTO_TEST_SUITE(allocator_tests)
BOOST_AUTO_TEST_CASE(arena_tests)
{

View file

@ -4,11 +4,12 @@
#include <amount.h>
#include <policy/feerate.h>
#include <test/util/setup_common.h>
#include <limits>
#include <boost/test/unit_test.hpp>
BOOST_FIXTURE_TEST_SUITE(amount_tests, BasicTestingSetup)
BOOST_AUTO_TEST_SUITE(amount_tests)
BOOST_AUTO_TEST_CASE(MoneyRangeTest)
{

View file

@ -3,19 +3,19 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <arith_uint256.h>
#include <test/util/setup_common.h>
#include <uint256.h>
#include <boost/test/unit_test.hpp>
#include <cmath>
#include <cstdint>
#include <iomanip>
#include <limits>
#include <sstream>
#include <stdint.h>
#include <string>
#include <vector>
BOOST_FIXTURE_TEST_SUITE(arith_uint256_tests, BasicTestingSetup)
BOOST_AUTO_TEST_SUITE(arith_uint256_tests)
/// Convert vector to arith_uint256, via uint256 blob
static inline arith_uint256 arith_uint256V(const std::vector<unsigned char>& vch)

View file

@ -2,7 +2,6 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <test/util/setup_common.h>
#include <util/strencodings.h>
#include <boost/test/unit_test.hpp>
@ -10,7 +9,7 @@
using namespace std::literals;
BOOST_FIXTURE_TEST_SUITE(base32_tests, BasicTestingSetup)
BOOST_AUTO_TEST_SUITE(base32_tests)
BOOST_AUTO_TEST_CASE(base32_testvectors)
{

View file

@ -2,7 +2,6 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <test/util/setup_common.h>
#include <util/strencodings.h>
#include <boost/test/unit_test.hpp>
@ -10,7 +9,7 @@
using namespace std::literals;
BOOST_FIXTURE_TEST_SUITE(base64_tests, BasicTestingSetup)
BOOST_AUTO_TEST_SUITE(base64_tests)
BOOST_AUTO_TEST_CASE(base64_testvectors)
{

View file

@ -3,12 +3,13 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bech32.h>
#include <test/util/setup_common.h>
#include <test/util/str.h>
#include <boost/test/unit_test.hpp>
BOOST_FIXTURE_TEST_SUITE(bech32_tests, BasicTestingSetup)
#include <string>
BOOST_AUTO_TEST_SUITE(bech32_tests)
BOOST_AUTO_TEST_CASE(bech32_testvectors_valid)
{

View file

@ -3,11 +3,10 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <compat/byteswap.h>
#include <test/util/setup_common.h>
#include <boost/test/unit_test.hpp>
BOOST_FIXTURE_TEST_SUITE(bswap_tests, BasicTestingSetup)
BOOST_AUTO_TEST_SUITE(bswap_tests)
BOOST_AUTO_TEST_CASE(bswap_tests)
{

View file

@ -3,9 +3,8 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <boost/test/unit_test.hpp>
#include <test/util/setup_common.h>
BOOST_FIXTURE_TEST_SUITE(compilerbug_tests, BasicTestingSetup)
BOOST_AUTO_TEST_SUITE(compilerbug_tests)
#if defined(__GNUC__)
// This block will also be built under clang, which is fine (as it supports noinline)

View file

@ -10,7 +10,7 @@
#include <boost/test/unit_test.hpp>
BOOST_FIXTURE_TEST_SUITE(hash_tests, BasicTestingSetup)
BOOST_AUTO_TEST_SUITE(hash_tests)
BOOST_AUTO_TEST_CASE(murmurhash3)
{

View file

@ -8,8 +8,10 @@
#include <boost/test/unit_test.hpp>
#include <set>
#include <vector>
BOOST_FIXTURE_TEST_SUITE(merkleblock_tests, BasicTestingSetup)
BOOST_AUTO_TEST_SUITE(merkleblock_tests)
/**
* Create a CMerkleBlock using a list of txids which will be found in the

View file

@ -5,11 +5,11 @@
#include <amount.h>
#include <policy/fees.h>
#include <test/util/setup_common.h>
#include <boost/test/unit_test.hpp>
BOOST_FIXTURE_TEST_SUITE(policy_fee_tests, BasicTestingSetup)
#include <set>
BOOST_AUTO_TEST_SUITE(policy_fee_tests)
BOOST_AUTO_TEST_CASE(FeeRounder)
{

View file

@ -7,7 +7,9 @@
#include <boost/test/unit_test.hpp>
BOOST_FIXTURE_TEST_SUITE(reverselock_tests, BasicTestingSetup)
#include <stdexcept>
BOOST_AUTO_TEST_SUITE(reverselock_tests)
BOOST_AUTO_TEST_CASE(reverselock_basics)
{

View file

@ -8,6 +8,7 @@
#include <boost/test/unit_test.hpp>
#include <mutex>
#include <stdexcept>
namespace {
template <typename MutexType>
@ -76,7 +77,7 @@ void TestInconsistentLockOrderDetected(MutexType& mutex1, MutexType& mutex2) NO_
}
} // namespace
BOOST_FIXTURE_TEST_SUITE(sync_tests, BasicTestingSetup)
BOOST_AUTO_TEST_SUITE(sync_tests)
BOOST_AUTO_TEST_CASE(potential_deadlock_detected)
{

View file

@ -2,7 +2,6 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
//
#include <test/util/setup_common.h>
#include <boost/test/unit_test.hpp>
@ -15,7 +14,7 @@ std::pair<std::string, std::string> SplitTorReplyLine(const std::string& s);
std::map<std::string, std::string> ParseTorReplyMapping(const std::string& s);
BOOST_FIXTURE_TEST_SUITE(torcontrol_tests, BasicTestingSetup)
BOOST_AUTO_TEST_SUITE(torcontrol_tests)
static void CheckSplitTorReplyLine(std::string input, std::string command, std::string args)
{

View file

@ -13,8 +13,9 @@
#include <iomanip>
#include <sstream>
#include <string>
#include <vector>
BOOST_FIXTURE_TEST_SUITE(uint256_tests, BasicTestingSetup)
BOOST_AUTO_TEST_SUITE(uint256_tests)
const unsigned char R1Array[] =
"\x9c\x52\x4a\xdb\xcf\x56\x11\x12\x2b\x29\x12\x5e\x5d\x35\xd2\xd2"

View file

@ -2,12 +2,12 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <test/util/setup_common.h>
#include <util/string.h>
#include <util/threadnames.h>
#include <mutex>
#include <set>
#include <string>
#include <thread>
#include <vector>
@ -17,7 +17,7 @@
#include <boost/test/unit_test.hpp>
BOOST_FIXTURE_TEST_SUITE(util_threadnames_tests, BasicTestingSetup)
BOOST_AUTO_TEST_SUITE(util_threadnames_tests)
const std::string TEST_THREAD_NAME_BASE = "test_thread.";