Skip to content

Commit

Permalink
tests: Reduce compilation time and unneccessary recompiles by removin…
Browse files Browse the repository at this point in the history
…g unused includes in tests
  • Loading branch information
practicalswift committed Jun 26, 2019
1 parent 1b28bca commit 9a84169
Showing 52 changed files with 46 additions and 62 deletions.
1 change: 0 additions & 1 deletion src/qt/test/addressbooktests.cpp
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@

#include <key.h>
#include <key_io.h>
#include <pubkey.h>
#include <wallet/wallet.h>

#include <QApplication>
1 change: 0 additions & 1 deletion src/qt/test/apptests.cpp
Original file line number Diff line number Diff line change
@@ -26,7 +26,6 @@
#include <QtGlobal>
#include <QtTest/QtTestWidgets>
#include <QtTest/QtTestGui>
#include <new>
#include <string>
#include <univalue.h>

1 change: 0 additions & 1 deletion src/qt/test/rpcnestedtests.cpp
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@

#include <qt/test/rpcnestedtests.h>

#include <fs.h>
#include <interfaces/node.h>
#include <rpc/server.h>
#include <qt/rpcconsole.h>
3 changes: 0 additions & 3 deletions src/qt/test/rpcnestedtests.h
Original file line number Diff line number Diff line change
@@ -8,9 +8,6 @@
#include <QObject>
#include <QTest>

#include <txdb.h>
#include <txmempool.h>

class RPCNestedTests : public QObject
{
Q_OBJECT
1 change: 0 additions & 1 deletion src/qt/test/test_main.cpp
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@
#include <config/bitcoin-config.h>
#endif

#include <chainparams.h>
#include <interfaces/node.h>
#include <qt/bitcoin.h>
#include <qt/test/apptests.h>
2 changes: 1 addition & 1 deletion src/test/allocator_tests.cpp
Original file line number Diff line number Diff line change
@@ -2,9 +2,9 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <util/memory.h>
#include <util/system.h>

#include <support/allocators/secure.h>
#include <test/setup_common.h>

#include <memory>
1 change: 0 additions & 1 deletion src/test/arith_uint256_tests.cpp
Original file line number Diff line number Diff line change
@@ -11,7 +11,6 @@
#include <uint256.h>
#include <arith_uint256.h>
#include <string>
#include <version.h>
#include <test/setup_common.h>

BOOST_FIXTURE_TEST_SUITE(arith_uint256_tests, BasicTestingSetup)
3 changes: 2 additions & 1 deletion src/test/bip32_tests.cpp
Original file line number Diff line number Diff line change
@@ -4,9 +4,10 @@

#include <boost/test/unit_test.hpp>

#include <clientversion.h>
#include <key.h>
#include <key_io.h>
#include <uint256.h>
#include <streams.h>
#include <util/system.h>
#include <util/strencodings.h>
#include <test/setup_common.h>
1 change: 1 addition & 0 deletions src/test/blockchain_tests.cpp
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@

#include <stdlib.h>

#include <chain.h>
#include <rpc/blockchain.h>
#include <test/setup_common.h>

2 changes: 1 addition & 1 deletion src/test/blockencodings_tests.cpp
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
#include <consensus/merkle.h>
#include <chainparams.h>
#include <pow.h>
#include <random.h>
#include <streams.h>

#include <test/setup_common.h>

1 change: 1 addition & 0 deletions src/test/blockfilter_index_tests.cpp
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
#include <pow.h>
#include <test/setup_common.h>
#include <script/standard.h>
#include <util/time.h>
#include <validation.h>

#include <boost/test/unit_test.hpp>
3 changes: 1 addition & 2 deletions src/test/checkqueue_tests.cpp
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <util/memory.h>
#include <util/system.h>
#include <util/time.h>
#include <validation.h>
@@ -17,8 +18,6 @@
#include <condition_variable>

#include <unordered_set>
#include <memory>
#include <random.h>

// BasicTestingSetup not sufficient because nScriptCheckThreads is not set
// otherwise.
2 changes: 2 additions & 0 deletions src/test/coins_tests.cpp
Original file line number Diff line number Diff line change
@@ -3,8 +3,10 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <attributes.h>
#include <clientversion.h>
#include <coins.h>
#include <script/standard.h>
#include <streams.h>
#include <test/setup_common.h>
#include <uint256.h>
#include <undo.h>
2 changes: 1 addition & 1 deletion src/test/dbwrapper_tests.cpp
Original file line number Diff line number Diff line change
@@ -4,8 +4,8 @@

#include <dbwrapper.h>
#include <uint256.h>
#include <random.h>
#include <test/setup_common.h>
#include <util/memory.h>

#include <memory>

2 changes: 2 additions & 0 deletions src/test/denialofservice_tests.cpp
Original file line number Diff line number Diff line change
@@ -11,7 +11,9 @@
#include <net_processing.h>
#include <script/sign.h>
#include <serialize.h>
#include <util/memory.h>
#include <util/system.h>
#include <util/time.h>
#include <validation.h>

#include <test/setup_common.h>
3 changes: 3 additions & 0 deletions src/test/flatfile_tests.cpp
Original file line number Diff line number Diff line change
@@ -2,8 +2,11 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <clientversion.h>
#include <flatfile.h>
#include <streams.h>
#include <test/setup_common.h>
#include <util/system.h>

#include <boost/test/unit_test.hpp>

1 change: 1 addition & 0 deletions src/test/fs_tests.cpp
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
//
#include <fs.h>
#include <test/setup_common.h>
#include <util/system.h>

#include <boost/test/unit_test.hpp>

5 changes: 1 addition & 4 deletions src/test/fuzz/deserialize.cpp
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <addrdb.h>
#include <addrman.h>
#include <blockencodings.h>
#include <chain.h>
@@ -11,17 +12,13 @@
#include <net.h>
#include <primitives/block.h>
#include <protocol.h>
#include <pubkey.h>
#include <script/script.h>
#include <streams.h>
#include <undo.h>
#include <version.h>

#include <stdint.h>
#include <unistd.h>

#include <algorithm>
#include <memory>
#include <vector>

#include <test/fuzz/fuzz.h>
1 change: 0 additions & 1 deletion src/test/fuzz/fuzz.h
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@
#ifndef BITCOIN_TEST_FUZZ_FUZZ_H
#define BITCOIN_TEST_FUZZ_FUZZ_H

#include <functional>
#include <stdint.h>
#include <vector>

1 change: 0 additions & 1 deletion src/test/fuzz/script_flags.cpp
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <script/interpreter.h>
#include <script/script.h>
#include <streams.h>
#include <version.h>

3 changes: 1 addition & 2 deletions src/test/hash_tests.cpp
Original file line number Diff line number Diff line change
@@ -2,13 +2,12 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <clientversion.h>
#include <crypto/siphash.h>
#include <hash.h>
#include <util/strencodings.h>
#include <test/setup_common.h>

#include <vector>

#include <boost/test/unit_test.hpp>

BOOST_FIXTURE_TEST_SUITE(hash_tests, BasicTestingSetup)
4 changes: 0 additions & 4 deletions src/test/key_properties.cpp
Original file line number Diff line number Diff line change
@@ -3,13 +3,9 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <key.h>

#include <base58.h>
#include <script/script.h>
#include <uint256.h>
#include <util/system.h>
#include <util/strencodings.h>
#include <test/setup_common.h>
#include <string>
#include <vector>

#include <boost/test/unit_test.hpp>
1 change: 0 additions & 1 deletion src/test/key_tests.cpp
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@
#include <key.h>

#include <key_io.h>
#include <script/script.h>
#include <uint256.h>
#include <util/system.h>
#include <util/strencodings.h>
2 changes: 1 addition & 1 deletion src/test/mempool_tests.cpp
Original file line number Diff line number Diff line change
@@ -5,11 +5,11 @@
#include <policy/policy.h>
#include <txmempool.h>
#include <util/system.h>
#include <util/time.h>

#include <test/setup_common.h>

#include <boost/test/unit_test.hpp>
#include <list>
#include <vector>

BOOST_FIXTURE_TEST_SUITE(mempool_tests, TestingSetup)
2 changes: 1 addition & 1 deletion src/test/miner_tests.cpp
Original file line number Diff line number Diff line change
@@ -9,12 +9,12 @@
#include <consensus/tx_verify.h>
#include <miner.h>
#include <policy/policy.h>
#include <pubkey.h>
#include <script/standard.h>
#include <txmempool.h>
#include <uint256.h>
#include <util/strencodings.h>
#include <util/system.h>
#include <util/time.h>
#include <validation.h>

#include <test/setup_common.h>
1 change: 1 addition & 0 deletions src/test/multisig_tests.cpp
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
#include <script/script_error.h>
#include <script/interpreter.h>
#include <script/sign.h>
#include <tinyformat.h>
#include <uint256.h>
#include <test/setup_common.h>

5 changes: 4 additions & 1 deletion src/test/net_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
// Copyright (c) 2012-2019 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <addrdb.h>
#include <addrman.h>
#include <clientversion.h>
#include <test/setup_common.h>
#include <string>
#include <boost/test/unit_test.hpp>
#include <hash.h>
#include <serialize.h>
#include <streams.h>
#include <net.h>
#include <netbase.h>
#include <chainparams.h>
#include <util/memory.h>
#include <util/system.h>

#include <memory>
1 change: 1 addition & 0 deletions src/test/policyestimator_tests.cpp
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
#include <txmempool.h>
#include <uint256.h>
#include <util/system.h>
#include <util/time.h>

#include <test/setup_common.h>

1 change: 0 additions & 1 deletion src/test/pow_tests.cpp
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@
#include <chain.h>
#include <chainparams.h>
#include <pow.h>
#include <random.h>
#include <util/system.h>
#include <test/setup_common.h>

2 changes: 0 additions & 2 deletions src/test/raii_event_tests.cpp
Original file line number Diff line number Diff line change
@@ -14,8 +14,6 @@

#include <test/setup_common.h>

#include <vector>

#include <boost/test/unit_test.hpp>

static std::map<void*, short> tags;
2 changes: 1 addition & 1 deletion src/test/rpc_tests.cpp
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@
#include <core_io.h>
#include <init.h>
#include <interfaces/chain.h>

#include <test/setup_common.h>
#include <util/time.h>

#include <boost/algorithm/string.hpp>
#include <boost/test/unit_test.hpp>
1 change: 0 additions & 1 deletion src/test/script_standard_tests.cpp
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@
#include <key.h>
#include <keystore.h>
#include <script/script.h>
#include <script/script_error.h>
#include <script/standard.h>
#include <test/setup_common.h>

2 changes: 1 addition & 1 deletion src/test/script_tests.cpp
Original file line number Diff line number Diff line change
@@ -14,12 +14,12 @@
#include <util/strencodings.h>
#include <test/setup_common.h>
#include <rpc/util.h>
#include <streams.h>

#if defined(HAVE_CONSENSUS_LIB)
#include <script/bitcoinconsensus.h>
#endif

#include <fstream>
#include <stdint.h>
#include <string>
#include <vector>
1 change: 0 additions & 1 deletion src/test/scriptnum10.h
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@
#ifndef BITCOIN_TEST_SCRIPTNUM10_H
#define BITCOIN_TEST_SCRIPTNUM10_H

#include <algorithm>
#include <limits>
#include <stdexcept>
#include <stdint.h>
1 change: 1 addition & 0 deletions src/test/serialize_tests.cpp
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
#include <streams.h>
#include <hash.h>
#include <test/setup_common.h>
#include <util/strencodings.h>

#include <stdint.h>

7 changes: 6 additions & 1 deletion src/test/setup_common.cpp
Original file line number Diff line number Diff line change
@@ -12,15 +12,20 @@
#include <crypto/sha256.h>
#include <init.h>
#include <miner.h>
#include <net_processing.h>
#include <net.h>
#include <noui.h>
#include <pow.h>
#include <rpc/register.h>
#include <rpc/server.h>
#include <script/sigcache.h>
#include <streams.h>
#include <txdb.h>
#include <util/memory.h>
#include <util/strencodings.h>
#include <util/time.h>
#include <util/validation.h>
#include <validation.h>
#include <validationinterface.h>

const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;

Loading

0 comments on commit 9a84169

Please sign in to comment.