Skip to content

Commit

Permalink
Merge bitcoin#17384: test: Create new test library
Browse files Browse the repository at this point in the history
fa4c6fa doc: Add documentation for new test/lib (MarcoFalke)
faec282 scripted-diff: test: Move setup_common to test library (MarcoFalke)

Pull request description:

  Sorry for clickbait, this is only a move-only scripted-diff commit and one documentation commit.

  Longer term, someone who knows something about build systems can make this an actual library. Motivation for this is that each module gets compiled for each target that includes it. For example, setup_common is compiled 27 times (for the fuzz suite) and another 3 times for the other tests (bench, unit test, gui)

ACKs for top commit:
  practicalswift:
    ACK fa4c6fa -- diff looks correct and Travis is happy
  jonatack:
    ACK fa4c6fa with the reserve that the commit messages (and PR description) contain the motivation for this change. Built, ran tests, light code review.
  ryanofsky:
    Code review ACK fa4c6fa. I didn't realize `lib` was actually name of existing directory, not a new name. But in any case this looks good and nice to have one scripted diff instead of two.

Tree-SHA512: 2e176df90c60578276e4a6dc83ff57ff59d8e666ecf30c5ceacb8c326725da91baa4cac3dfa7a2e1605f58122a3e3e27e4938ff33e3a0ce7ea53afffebbf57a4
  • Loading branch information
MarcoFalke committed Nov 7, 2019
2 parents e65b416 + fa4c6fa commit 46fc4d1
Show file tree
Hide file tree
Showing 103 changed files with 139 additions and 128 deletions.
2 changes: 1 addition & 1 deletion build_msvc/test_bitcoin-qt/test_bitcoin-qt.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="..\..\src\test\setup_common.cpp" />
<ClCompile Include="..\..\src\test\util\setup_common.cpp" />
<ClCompile Include="..\..\src\qt\test\addressbooktests.cpp" />
<ClCompile Include="..\..\src\qt\test\apptests.cpp" />
<ClCompile Include="..\..\src\qt\test\compattests.cpp" />
Expand Down
4 changes: 2 additions & 2 deletions build_msvc/test_bitcoin/test_bitcoin.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<ClCompile Include="..\..\src\test\*_properties.cpp" />
<ClCompile Include="..\..\src\test\gen\*_gen.cpp" />
<ClCompile Include="..\..\src\wallet\test\*_tests.cpp" />
<ClCompile Include="..\..\src\test\lib\*.cpp" />
<ClCompile Include="..\..\src\test\setup_common.cpp" />
<ClCompile Include="..\..\src\test\util\*.cpp" />
<ClCompile Include="..\..\src\test\util\setup_common.cpp" />
<ClCompile Include="..\..\src\test\main.cpp" />
<ClCompile Include="..\..\src\wallet\test\*_fixture.cpp" />
</ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions src/Makefile.bench.include
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ bench_bench_bitcoin_SOURCES = \
bench/lockedpool.cpp \
bench/poly1305.cpp \
bench/prevector.cpp \
test/lib/transaction_utils.h \
test/lib/transaction_utils.cpp \
test/setup_common.h \
test/setup_common.cpp \
test/util/transaction_utils.h \
test/util/transaction_utils.cpp \
test/util/setup_common.h \
test/util/setup_common.cpp \
test/util.h \
test/util.cpp

Expand Down
4 changes: 2 additions & 2 deletions src/Makefile.qttest.include
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ TEST_QT_H = \
qt/test/wallettests.h

TEST_BITCOIN_CPP = \
test/setup_common.cpp
test/util/setup_common.cpp

TEST_BITCOIN_H = \
test/setup_common.h
test/util/setup_common.h

qt_test_test_bitcoin_qt_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
$(QT_INCLUDES) $(QT_TEST_INCLUDES)
Expand Down
20 changes: 10 additions & 10 deletions src/Makefile.test.include
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,24 @@ RAW_TEST_FILES =
GENERATED_TEST_FILES = $(JSON_TEST_FILES:.json=.json.h) $(RAW_TEST_FILES:.raw=.raw.h)

BITCOIN_TEST_SUITE = \
test/lib/blockfilter.cpp \
test/lib/blockfilter.h \
test/lib/logging.cpp \
test/lib/logging.h \
test/lib/transaction_utils.cpp \
test/lib/transaction_utils.h \
test/util/blockfilter.cpp \
test/util/blockfilter.h \
test/util/logging.cpp \
test/util/logging.h \
test/util/transaction_utils.cpp \
test/util/transaction_utils.h \
test/main.cpp \
test/setup_common.h \
test/setup_common.cpp \
test/util/setup_common.h \
test/util/setup_common.cpp \
test/util/str.h \
test/util/str.cpp

FUZZ_SUITE = \
test/fuzz/fuzz.cpp \
test/fuzz/fuzz.h \
test/fuzz/FuzzedDataProvider.h \
test/setup_common.cpp \
test/setup_common.h \
test/util/setup_common.cpp \
test/util/setup_common.h \
test/util/str.cpp \
test/util/str.h

Expand Down
2 changes: 1 addition & 1 deletion src/bench/bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <bench/bench.h>

#include <chainparams.h>
#include <test/setup_common.h>
#include <test/util/setup_common.h>
#include <validation.h>

#include <algorithm>
Expand Down
2 changes: 1 addition & 1 deletion src/bench/verify_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <script/script.h>
#include <script/standard.h>
#include <streams.h>
#include <test/lib/transaction_utils.h>
#include <test/util/transaction_utils.h>

#include <array>

Expand Down
2 changes: 1 addition & 1 deletion src/qt/test/addressbooktests.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <qt/test/addressbooktests.h>
#include <qt/test/util.h>
#include <test/setup_common.h>
#include <test/util/setup_common.h>

#include <interfaces/chain.h>
#include <interfaces/node.h>
Expand Down
2 changes: 1 addition & 1 deletion src/qt/test/apptests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <qt/networkstyle.h>
#include <qt/rpcconsole.h>
#include <shutdown.h>
#include <test/setup_common.h>
#include <test/util/setup_common.h>
#include <univalue.h>
#include <validation.h>

Expand Down
2 changes: 1 addition & 1 deletion src/qt/test/rpcnestedtests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <interfaces/node.h>
#include <rpc/server.h>
#include <qt/rpcconsole.h>
#include <test/setup_common.h>
#include <test/util/setup_common.h>
#include <univalue.h>
#include <util/system.h>

Expand Down
2 changes: 1 addition & 1 deletion src/qt/test/test_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <qt/test/rpcnestedtests.h>
#include <qt/test/uritests.h>
#include <qt/test/compattests.h>
#include <test/setup_common.h>
#include <test/util/setup_common.h>

#ifdef ENABLE_WALLET
#include <qt/test/addressbooktests.h>
Expand Down
2 changes: 1 addition & 1 deletion src/qt/test/wallettests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <qt/transactionview.h>
#include <qt/walletmodel.h>
#include <key_io.h>
#include <test/setup_common.h>
#include <test/util/setup_common.h>
#include <validation.h>
#include <wallet/wallet.h>
#include <qt/overviewpage.h>
Expand Down
4 changes: 2 additions & 2 deletions src/test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ configure some other framework (we want as few impediments to creating
unit tests as possible).

The build system is set up to compile an executable called `test_bitcoin`
that runs all of the unit tests. The main source file is called
`setup_common.cpp`.
that runs all of the unit tests. The main source file for the test library is found in
`util/setup_common.cpp`.

### Compiling/running unit tests

Expand Down
2 changes: 1 addition & 1 deletion src/test/addrman_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <addrman.h>
#include <test/setup_common.h>
#include <test/util/setup_common.h>
#include <string>
#include <boost/test/unit_test.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/test/allocator_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <util/memory.h>
#include <util/system.h>

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

#include <memory>

Expand Down
2 changes: 1 addition & 1 deletion src/test/amount_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include <amount.h>
#include <policy/feerate.h>
#include <test/setup_common.h>
#include <test/util/setup_common.h>

#include <boost/test/unit_test.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/test/arith_uint256_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <uint256.h>
#include <arith_uint256.h>
#include <string>
#include <test/setup_common.h>
#include <test/util/setup_common.h>

BOOST_FIXTURE_TEST_SUITE(arith_uint256_tests, BasicTestingSetup)

Expand Down
2 changes: 1 addition & 1 deletion src/test/base32_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

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

#include <boost/test/unit_test.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/test/base58_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <test/data/base58_encode_decode.json.h>

#include <base58.h>
#include <test/setup_common.h>
#include <test/util/setup_common.h>
#include <util/strencodings.h>

#include <univalue.h>
Expand Down
2 changes: 1 addition & 1 deletion src/test/base64_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

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

#include <boost/test/unit_test.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/test/bech32_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <bech32.h>
#include <test/setup_common.h>
#include <test/util/setup_common.h>
#include <test/util/str.h>

#include <boost/test/unit_test.hpp>
Expand Down
2 changes: 1 addition & 1 deletion src/test/bip32_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <key_io.h>
#include <streams.h>
#include <util/strencodings.h>
#include <test/setup_common.h>
#include <test/util/setup_common.h>

#include <string>
#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion src/test/blockchain_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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

/* Equality between doubles is imprecise. Comparison should be done
* with a small threshold of tolerance, rather than exact equality.
Expand Down
2 changes: 1 addition & 1 deletion src/test/blockencodings_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <pow.h>
#include <streams.h>

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

#include <boost/test/unit_test.hpp>

Expand Down
4 changes: 2 additions & 2 deletions src/test/blockfilter_index_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include <miner.h>
#include <pow.h>
#include <script/standard.h>
#include <test/lib/blockfilter.h>
#include <test/setup_common.h>
#include <test/util/blockfilter.h>
#include <test/util/setup_common.h>
#include <util/time.h>
#include <validation.h>

Expand Down
2 changes: 1 addition & 1 deletion src/test/blockfilter_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <test/data/blockfilters.json.h>
#include <test/setup_common.h>
#include <test/util/setup_common.h>

#include <blockfilter.h>
#include <core_io.h>
Expand Down
2 changes: 1 addition & 1 deletion src/test/bloom_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <uint256.h>
#include <util/system.h>
#include <util/strencodings.h>
#include <test/setup_common.h>
#include <test/util/setup_common.h>

#include <vector>

Expand Down
2 changes: 1 addition & 1 deletion src/test/bswap_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <compat/byteswap.h>
#include <test/setup_common.h>
#include <test/util/setup_common.h>

#include <boost/test/unit_test.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/test/checkqueue_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <util/time.h>
#include <validation.h>

#include <test/setup_common.h>
#include <test/util/setup_common.h>
#include <checkqueue.h>
#include <boost/test/unit_test.hpp>
#include <boost/thread.hpp>
Expand Down
2 changes: 1 addition & 1 deletion src/test/coins_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <coins.h>
#include <script/standard.h>
#include <streams.h>
#include <test/setup_common.h>
#include <test/util/setup_common.h>
#include <uint256.h>
#include <undo.h>
#include <util/strencodings.h>
Expand Down
2 changes: 1 addition & 1 deletion src/test/compilerbug_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <test/setup_common.h>
#include <test/util/setup_common.h>
#include <boost/test/unit_test.hpp>

BOOST_FIXTURE_TEST_SUITE(compilerbug_tests, BasicTestingSetup)
Expand Down
2 changes: 1 addition & 1 deletion src/test/compress_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <compressor.h>
#include <test/setup_common.h>
#include <test/util/setup_common.h>
#include <script/standard.h>

#include <stdint.h>
Expand Down
2 changes: 1 addition & 1 deletion src/test/crypto_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <crypto/sha512.h>
#include <random.h>
#include <util/strencodings.h>
#include <test/setup_common.h>
#include <test/util/setup_common.h>

#include <vector>

Expand Down
2 changes: 1 addition & 1 deletion src/test/cuckoocache_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <boost/test/unit_test.hpp>
#include <cuckoocache.h>
#include <script/sigcache.h>
#include <test/setup_common.h>
#include <test/util/setup_common.h>
#include <random.h>
#include <thread>

Expand Down
2 changes: 1 addition & 1 deletion src/test/dbwrapper_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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

#include <memory>
Expand Down
2 changes: 1 addition & 1 deletion src/test/denialofservice_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <util/time.h>
#include <validation.h>

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

#include <stdint.h>

Expand Down
2 changes: 1 addition & 1 deletion src/test/descriptor_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <string>
#include <script/sign.h>
#include <script/standard.h>
#include <test/setup_common.h>
#include <test/util/setup_common.h>
#include <boost/test/unit_test.hpp>
#include <script/descriptor.h>
#include <util/strencodings.h>
Expand Down
2 changes: 1 addition & 1 deletion src/test/flatfile_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <clientversion.h>
#include <flatfile.h>
#include <streams.h>
#include <test/setup_common.h>
#include <test/util/setup_common.h>
#include <util/system.h>

#include <boost/test/unit_test.hpp>
Expand Down
2 changes: 1 addition & 1 deletion src/test/fs_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
//
#include <fs.h>
#include <test/setup_common.h>
#include <test/util/setup_common.h>
#include <util/system.h>

#include <boost/test/unit_test.hpp>
Expand Down
Loading

0 comments on commit 46fc4d1

Please sign in to comment.