2016-09-21 19:31:23 -03:00
|
|
|
# Copyright (c) 2013-2016 The Bitcoin Core developers
|
|
|
|
# Distributed under the MIT software license, see the accompanying
|
|
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
2021-01-24 13:09:24 -03:00
|
|
|
if ENABLE_FUZZ_BINARY
|
2020-12-03 12:42:49 -03:00
|
|
|
noinst_PROGRAMS += test/fuzz/fuzz
|
2021-01-24 13:09:24 -03:00
|
|
|
endif
|
|
|
|
|
|
|
|
if !ENABLE_FUZZ
|
2019-01-16 13:49:01 -03:00
|
|
|
bin_PROGRAMS += test/test_bitcoin
|
2019-01-25 20:35:36 -03:00
|
|
|
endif
|
|
|
|
|
2014-05-28 13:38:41 -04:00
|
|
|
TEST_SRCDIR = test
|
|
|
|
TEST_BINARY=test/test_bitcoin$(EXEEXT)
|
2020-12-14 11:52:39 -03:00
|
|
|
FUZZ_BINARY=test/fuzz/fuzz$(EXEEXT)
|
2014-05-28 13:38:41 -04:00
|
|
|
|
|
|
|
JSON_TEST_FILES = \
|
2018-03-24 20:37:10 -03:00
|
|
|
test/data/script_tests.json \
|
2014-05-28 13:38:41 -04:00
|
|
|
test/data/base58_encode_decode.json \
|
2018-01-23 22:38:23 -03:00
|
|
|
test/data/blockfilters.json \
|
2017-09-20 20:57:44 -03:00
|
|
|
test/data/key_io_valid.json \
|
|
|
|
test/data/key_io_invalid.json \
|
|
|
|
test/data/script_tests.json \
|
|
|
|
test/data/sighash.json \
|
2014-05-28 13:38:41 -04:00
|
|
|
test/data/tx_invalid.json \
|
2017-09-20 20:57:44 -03:00
|
|
|
test/data/tx_valid.json
|
2014-05-28 13:38:41 -04:00
|
|
|
|
2019-12-24 15:18:44 -03:00
|
|
|
RAW_TEST_FILES = \
|
|
|
|
test/data/asmap.raw
|
2014-05-28 13:38:41 -04:00
|
|
|
|
|
|
|
GENERATED_TEST_FILES = $(JSON_TEST_FILES:.json=.json.h) $(RAW_TEST_FILES:.raw=.raw.h)
|
|
|
|
|
2018-04-09 20:55:49 -03:00
|
|
|
BITCOIN_TEST_SUITE = \
|
2019-02-28 16:51:11 -03:00
|
|
|
test/main.cpp \
|
2019-11-21 17:13:08 -03:00
|
|
|
$(TEST_UTIL_H)
|
2018-04-09 20:55:49 -03:00
|
|
|
|
2019-02-28 17:04:03 -03:00
|
|
|
FUZZ_SUITE_LD_COMMON = \
|
|
|
|
$(LIBBITCOIN_SERVER) \
|
|
|
|
$(LIBBITCOIN_COMMON) \
|
|
|
|
$(LIBBITCOIN_UTIL) \
|
2019-11-21 17:13:08 -03:00
|
|
|
$(LIBTEST_UTIL) \
|
2020-04-04 20:01:13 -03:00
|
|
|
$(LIBTEST_FUZZ) \
|
2019-02-28 17:04:03 -03:00
|
|
|
$(LIBBITCOIN_CONSENSUS) \
|
|
|
|
$(LIBBITCOIN_CRYPTO) \
|
2019-10-03 06:11:40 -03:00
|
|
|
$(LIBBITCOIN_CLI) \
|
2019-02-28 17:04:03 -03:00
|
|
|
$(LIBUNIVALUE) \
|
|
|
|
$(LIBLEVELDB) \
|
|
|
|
$(LIBLEVELDB_SSE42) \
|
|
|
|
$(BOOST_LIBS) \
|
|
|
|
$(LIBMEMENV) \
|
|
|
|
$(LIBSECP256K1) \
|
|
|
|
$(EVENT_LIBS) \
|
|
|
|
$(EVENT_PTHREADS_LIBS)
|
|
|
|
|
2021-01-24 13:09:24 -03:00
|
|
|
if USE_UPNP
|
|
|
|
FUZZ_SUITE_LD_COMMON += $(MINIUPNPC_LIBS)
|
|
|
|
endif
|
|
|
|
|
|
|
|
if USE_NATPMP
|
|
|
|
FUZZ_SUITE_LD_COMMON += $(NATPMP_LIBS)
|
|
|
|
endif
|
|
|
|
|
2016-04-22 19:19:33 -03:00
|
|
|
# test_bitcoin binary #
|
2014-05-28 13:38:41 -04:00
|
|
|
BITCOIN_TESTS =\
|
2014-12-15 06:22:19 -03:00
|
|
|
test/arith_uint256_tests.cpp \
|
2015-11-25 09:19:48 -03:00
|
|
|
test/scriptnum10.h \
|
2015-09-22 16:24:16 -03:00
|
|
|
test/addrman_tests.cpp \
|
2016-03-17 12:47:15 -03:00
|
|
|
test/amount_tests.cpp \
|
2014-05-28 13:38:41 -04:00
|
|
|
test/allocator_tests.cpp \
|
|
|
|
test/base32_tests.cpp \
|
|
|
|
test/base58_tests.cpp \
|
|
|
|
test/base64_tests.cpp \
|
2017-08-25 22:12:39 -03:00
|
|
|
test/bech32_tests.cpp \
|
2015-04-23 08:20:18 -03:00
|
|
|
test/bip32_tests.cpp \
|
[Tests] Adding unit tests for GetDifficulty in blockchain.cpp.
blockchain.cpp has low unit test coverage. This commit is intended
to start improving its code coverage to reasonable levels. One or more
follow up commits will complete the task that this commit is starting
(though the usefulness of this commit is not dependent upon later
commits).
Note that these tests were not written based upon a specification of how
GetDifficulty *should* work, but rather how it actually *does* work. As
a result, if there are any bugs in the current GetDifficulty
implementation, these unit tests serve to lock them in rather than
expose them.
-- Why has blockchain.cpp been modified if this is a unit testing change?
Since the existing GetDifficulty function relies on a global variable,
chainActive, it was not suitable for unit testing purposes. Both the
existing GetDifficulty function and the unit tests now call through to
a new, more modular version of GetDifficulty that can work on any chain,
not just chainActive.
-- Why does blockchain_tests.cpp directly include blockchain.cpp instead
of blockchain.h?
While the new GetDifficulty function's signature is arguably better than
the old one's, it still isn't great, and doesn't seem to warrant inclusion
as part of the blockchain.h API, especially since only test code is
directly using it. If a better way of exposing the new GetDifficulty
function to unit tests exists, please mention it and the commit will be
updated accordingly.
-- Why is the test fixture named blockchain_difficulty_tests rather than
blockchain_tests?
The Bitcoin Core policy for naming unit test files is to match the the
file under test ("blockchain" becomes "blockchain_tests"). While this
commit complies with that, blockchain.cpp is a massive file, such that
having all of the unit tests in one file will tend towards disorder.
Since there will be a lot more tests added to this file, the intention
is to divide up different types of tests into different test fixtures
within the same file.
2017-11-21 20:40:02 -03:00
|
|
|
test/blockchain_tests.cpp \
|
2016-04-25 19:51:08 -03:00
|
|
|
test/blockencodings_tests.cpp \
|
2018-01-23 22:13:04 -03:00
|
|
|
test/blockfilter_tests.cpp \
|
2018-08-27 22:44:43 -03:00
|
|
|
test/blockfilter_index_tests.cpp \
|
2014-05-28 13:38:41 -04:00
|
|
|
test/bloom_tests.cpp \
|
2016-12-16 04:52:35 -03:00
|
|
|
test/bswap_tests.cpp \
|
2017-01-07 21:51:23 -03:00
|
|
|
test/checkqueue_tests.cpp \
|
2014-09-16 20:27:06 -03:00
|
|
|
test/coins_tests.cpp \
|
2019-08-28 15:58:53 -04:00
|
|
|
test/coinstatsindex_tests.cpp \
|
2019-05-08 16:29:44 -04:00
|
|
|
test/compilerbug_tests.cpp \
|
2014-10-31 05:36:30 -03:00
|
|
|
test/compress_tests.cpp \
|
2014-05-31 16:01:42 -04:00
|
|
|
test/crypto_tests.cpp \
|
2016-10-05 17:59:18 -03:00
|
|
|
test/cuckoocache_tests.cpp \
|
2018-05-23 08:14:58 -04:00
|
|
|
test/denialofservice_tests.cpp \
|
2018-07-15 22:32:09 -04:00
|
|
|
test/descriptor_tests.cpp \
|
2019-01-07 03:23:34 -03:00
|
|
|
test/flatfile_tests.cpp \
|
2018-09-07 10:12:24 -03:00
|
|
|
test/fs_tests.cpp \
|
2014-05-28 13:38:41 -04:00
|
|
|
test/getarg_tests.cpp \
|
2014-04-20 12:36:25 -03:00
|
|
|
test/hash_tests.cpp \
|
2021-03-11 12:27:22 -03:00
|
|
|
test/i2p_tests.cpp \
|
2020-02-24 16:34:17 -03:00
|
|
|
test/interfaces_tests.cpp \
|
2017-09-20 20:57:44 -03:00
|
|
|
test/key_io_tests.cpp \
|
2014-05-28 13:38:41 -04:00
|
|
|
test/key_tests.cpp \
|
2019-09-19 14:59:49 -03:00
|
|
|
test/logging_tests.cpp \
|
2015-10-22 22:33:06 -03:00
|
|
|
test/dbwrapper_tests.cpp \
|
2019-02-28 17:02:35 -03:00
|
|
|
test/validation_tests.cpp \
|
2015-03-25 14:13:09 -03:00
|
|
|
test/mempool_tests.cpp \
|
2015-11-17 13:35:44 -03:00
|
|
|
test/merkle_tests.cpp \
|
2017-09-11 21:43:48 -03:00
|
|
|
test/merkleblock_tests.cpp \
|
2014-05-28 13:38:41 -04:00
|
|
|
test/miner_tests.cpp \
|
|
|
|
test/multisig_tests.cpp \
|
2021-02-20 07:21:34 -03:00
|
|
|
test/net_peer_eviction_tests.cpp \
|
2016-03-16 13:54:30 -03:00
|
|
|
test/net_tests.cpp \
|
2014-05-28 13:38:41 -04:00
|
|
|
test/netbase_tests.cpp \
|
|
|
|
test/pmt_tests.cpp \
|
2020-06-07 13:55:08 -04:00
|
|
|
test/policy_fee_tests.cpp \
|
2014-08-26 16:28:32 -04:00
|
|
|
test/policyestimator_tests.cpp \
|
2015-02-21 09:57:44 -03:00
|
|
|
test/pow_tests.cpp \
|
2015-10-29 03:11:24 -03:00
|
|
|
test/prevector_tests.cpp \
|
2016-12-21 01:43:49 -03:00
|
|
|
test/raii_event_tests.cpp \
|
2017-02-15 22:45:22 -03:00
|
|
|
test/random_tests.cpp \
|
2015-09-03 13:53:00 -03:00
|
|
|
test/reverselock_tests.cpp \
|
2014-05-28 13:38:41 -04:00
|
|
|
test/rpc_tests.cpp \
|
2015-01-05 23:39:40 -03:00
|
|
|
test/sanity_tests.cpp \
|
2015-04-10 11:31:02 -03:00
|
|
|
test/scheduler_tests.cpp \
|
2018-05-23 08:14:58 -04:00
|
|
|
test/script_p2sh_tests.cpp \
|
2014-05-28 13:38:41 -04:00
|
|
|
test/script_tests.cpp \
|
2017-08-18 18:40:29 -03:00
|
|
|
test/script_standard_tests.cpp \
|
2014-10-31 05:36:30 -03:00
|
|
|
test/scriptnum_tests.cpp \
|
2021-05-16 20:46:26 -04:00
|
|
|
test/serfloat_tests.cpp \
|
2014-05-28 13:38:41 -04:00
|
|
|
test/serialize_tests.cpp \
|
2019-05-06 15:31:18 -04:00
|
|
|
test/settings_tests.cpp \
|
2014-10-31 05:36:30 -03:00
|
|
|
test/sighash_tests.cpp \
|
2014-05-28 13:38:41 -04:00
|
|
|
test/sigopcount_tests.cpp \
|
2014-06-29 09:26:58 -04:00
|
|
|
test/skiplist_tests.cpp \
|
2021-01-04 07:44:21 -03:00
|
|
|
test/sock_tests.cpp \
|
2015-09-07 19:22:23 -03:00
|
|
|
test/streams_tests.cpp \
|
2017-11-08 17:28:35 -03:00
|
|
|
test/sync_tests.cpp \
|
2020-01-30 08:07:57 -03:00
|
|
|
test/system_tests.cpp \
|
2018-05-05 15:11:46 -03:00
|
|
|
test/util_threadnames_tests.cpp \
|
2014-08-20 07:53:42 -04:00
|
|
|
test/timedata_tests.cpp \
|
2017-03-25 04:17:37 -03:00
|
|
|
test/torcontrol_tests.cpp \
|
2014-05-28 13:38:41 -04:00
|
|
|
test/transaction_tests.cpp \
|
2017-12-08 17:00:13 -03:00
|
|
|
test/txindex_tests.cpp \
|
2020-09-29 20:10:16 -03:00
|
|
|
test/txrequest_tests.cpp \
|
2017-11-18 05:48:34 -03:00
|
|
|
test/txvalidation_tests.cpp \
|
2015-03-03 11:59:32 -03:00
|
|
|
test/txvalidationcache_tests.cpp \
|
2014-12-16 11:50:31 -03:00
|
|
|
test/uint256_tests.cpp \
|
2018-04-18 09:01:48 -03:00
|
|
|
test/util_tests.cpp \
|
|
|
|
test/validation_block_tests.cpp \
|
2020-04-14 14:00:37 -04:00
|
|
|
test/validation_chainstate_tests.cpp \
|
2019-12-12 16:11:03 -03:00
|
|
|
test/validation_chainstatemanager_tests.cpp \
|
2019-09-24 15:10:18 -03:00
|
|
|
test/validation_flush_tests.cpp \
|
2020-04-07 08:03:39 -04:00
|
|
|
test/validationinterface_tests.cpp \
|
2018-04-18 09:01:48 -03:00
|
|
|
test/versionbits_tests.cpp
|
2014-05-28 13:38:41 -04:00
|
|
|
|
|
|
|
if ENABLE_WALLET
|
|
|
|
BITCOIN_TESTS += \
|
2018-06-27 20:05:54 -04:00
|
|
|
wallet/test/psbt_wallet_tests.cpp \
|
2015-02-03 17:09:47 -03:00
|
|
|
wallet/test/wallet_tests.cpp \
|
2020-03-10 04:42:31 -03:00
|
|
|
wallet/test/walletdb_tests.cpp \
|
2018-04-05 17:00:39 -03:00
|
|
|
wallet/test/wallet_crypto_tests.cpp \
|
2018-09-10 21:49:17 -03:00
|
|
|
wallet/test/coinselector_tests.cpp \
|
2019-06-06 03:53:16 -04:00
|
|
|
wallet/test/init_tests.cpp \
|
2020-02-04 19:24:48 -03:00
|
|
|
wallet/test/ismine_tests.cpp \
|
|
|
|
wallet/test/scriptpubkeyman_tests.cpp
|
2018-04-09 20:55:49 -03:00
|
|
|
|
2021-01-24 13:09:24 -03:00
|
|
|
FUZZ_SUITE_LD_COMMON +=\
|
|
|
|
$(LIBBITCOIN_WALLET) \
|
|
|
|
$(SQLITE_LIBS) \
|
|
|
|
$(BDB_LIBS)
|
|
|
|
|
2020-10-19 16:34:21 -03:00
|
|
|
if USE_BDB
|
|
|
|
BITCOIN_TESTS += wallet/test/db_tests.cpp
|
|
|
|
endif
|
|
|
|
|
2021-01-24 13:09:24 -03:00
|
|
|
|
2018-04-09 20:55:49 -03:00
|
|
|
BITCOIN_TEST_SUITE += \
|
|
|
|
wallet/test/wallet_test_fixture.cpp \
|
2018-09-10 21:49:17 -03:00
|
|
|
wallet/test/wallet_test_fixture.h \
|
|
|
|
wallet/test/init_test_fixture.cpp \
|
|
|
|
wallet/test/init_test_fixture.h
|
2014-05-28 13:38:41 -04:00
|
|
|
endif
|
|
|
|
|
2018-04-09 20:55:49 -03:00
|
|
|
test_test_bitcoin_SOURCES = $(BITCOIN_TEST_SUITE) $(BITCOIN_TESTS) $(JSON_TEST_FILES) $(RAW_TEST_FILES)
|
2017-08-15 11:40:30 -03:00
|
|
|
test_test_bitcoin_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(TESTDEFS) $(EVENT_CFLAGS)
|
2019-11-21 17:13:08 -03:00
|
|
|
test_test_bitcoin_LDADD = $(LIBTEST_UTIL)
|
2014-05-28 13:38:41 -04:00
|
|
|
if ENABLE_WALLET
|
|
|
|
test_test_bitcoin_LDADD += $(LIBBITCOIN_WALLET)
|
|
|
|
endif
|
2018-05-08 14:27:57 -03:00
|
|
|
|
2018-06-06 15:20:34 -04:00
|
|
|
test_test_bitcoin_LDADD += $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) \
|
2017-07-07 10:03:24 -04:00
|
|
|
$(LIBLEVELDB) $(LIBLEVELDB_SSE42) $(LIBMEMENV) $(BOOST_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIB) $(LIBSECP256K1) $(EVENT_LIBS) $(EVENT_PTHREADS_LIBS)
|
|
|
|
test_test_bitcoin_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
2014-06-06 10:57:28 -04:00
|
|
|
|
2020-02-22 20:34:13 -03:00
|
|
|
test_test_bitcoin_LDADD += $(BDB_LIBS) $(MINIUPNPC_LIBS) $(NATPMP_LIBS) $(SQLITE_LIBS)
|
2020-07-17 02:43:29 -04:00
|
|
|
test_test_bitcoin_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS) -static
|
2014-05-28 13:38:41 -04:00
|
|
|
|
2014-11-18 14:06:32 -03:00
|
|
|
if ENABLE_ZMQ
|
2019-02-28 17:45:26 -03:00
|
|
|
test_test_bitcoin_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
|
2021-01-24 13:09:24 -03:00
|
|
|
FUZZ_SUITE_LD_COMMON += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
|
2014-11-18 14:06:32 -03:00
|
|
|
endif
|
2019-01-25 20:35:36 -03:00
|
|
|
|
2020-07-17 02:43:29 -04:00
|
|
|
FUZZ_SUITE_LDFLAGS_COMMON = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS)
|
2020-07-19 23:10:08 -04:00
|
|
|
|
2021-01-24 13:09:24 -03:00
|
|
|
if ENABLE_FUZZ_BINARY
|
2020-12-03 12:42:49 -03:00
|
|
|
test_fuzz_fuzz_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
|
|
|
|
test_fuzz_fuzz_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
|
|
|
test_fuzz_fuzz_LDADD = $(FUZZ_SUITE_LD_COMMON)
|
|
|
|
test_fuzz_fuzz_LDFLAGS = $(FUZZ_SUITE_LDFLAGS_COMMON)
|
|
|
|
test_fuzz_fuzz_SOURCES = \
|
|
|
|
test/fuzz/addition_overflow.cpp \
|
|
|
|
test/fuzz/addrdb.cpp \
|
|
|
|
test/fuzz/addrman.cpp \
|
|
|
|
test/fuzz/asmap.cpp \
|
|
|
|
test/fuzz/asmap_direct.cpp \
|
|
|
|
test/fuzz/autofile.cpp \
|
|
|
|
test/fuzz/banman.cpp \
|
|
|
|
test/fuzz/base_encode_decode.cpp \
|
|
|
|
test/fuzz/bech32.cpp \
|
|
|
|
test/fuzz/block.cpp \
|
|
|
|
test/fuzz/block_header.cpp \
|
|
|
|
test/fuzz/blockfilter.cpp \
|
|
|
|
test/fuzz/bloom_filter.cpp \
|
|
|
|
test/fuzz/buffered_file.cpp \
|
|
|
|
test/fuzz/chain.cpp \
|
|
|
|
test/fuzz/checkqueue.cpp \
|
|
|
|
test/fuzz/coins_view.cpp \
|
|
|
|
test/fuzz/connman.cpp \
|
|
|
|
test/fuzz/crypto.cpp \
|
|
|
|
test/fuzz/crypto_aes256.cpp \
|
|
|
|
test/fuzz/crypto_aes256cbc.cpp \
|
|
|
|
test/fuzz/crypto_chacha20.cpp \
|
|
|
|
test/fuzz/crypto_chacha20_poly1305_aead.cpp \
|
|
|
|
test/fuzz/crypto_common.cpp \
|
|
|
|
test/fuzz/crypto_hkdf_hmac_sha256_l32.cpp \
|
|
|
|
test/fuzz/crypto_poly1305.cpp \
|
|
|
|
test/fuzz/cuckoocache.cpp \
|
2020-11-12 12:07:53 -03:00
|
|
|
test/fuzz/data_stream.cpp \
|
2020-12-03 12:42:49 -03:00
|
|
|
test/fuzz/decode_tx.cpp \
|
|
|
|
test/fuzz/descriptor_parse.cpp \
|
|
|
|
test/fuzz/deserialize.cpp \
|
|
|
|
test/fuzz/eval_script.cpp \
|
|
|
|
test/fuzz/fee_rate.cpp \
|
|
|
|
test/fuzz/fees.cpp \
|
|
|
|
test/fuzz/flatfile.cpp \
|
|
|
|
test/fuzz/float.cpp \
|
|
|
|
test/fuzz/golomb_rice.cpp \
|
|
|
|
test/fuzz/hex.cpp \
|
|
|
|
test/fuzz/http_request.cpp \
|
2021-03-04 11:32:11 -03:00
|
|
|
test/fuzz/i2p.cpp \
|
2020-12-03 12:42:49 -03:00
|
|
|
test/fuzz/integer.cpp \
|
|
|
|
test/fuzz/key.cpp \
|
|
|
|
test/fuzz/key_io.cpp \
|
|
|
|
test/fuzz/kitchen_sink.cpp \
|
|
|
|
test/fuzz/load_external_block_file.cpp \
|
|
|
|
test/fuzz/locale.cpp \
|
|
|
|
test/fuzz/merkleblock.cpp \
|
|
|
|
test/fuzz/message.cpp \
|
2020-11-23 21:35:37 -03:00
|
|
|
test/fuzz/muhash.cpp \
|
2020-12-03 12:42:49 -03:00
|
|
|
test/fuzz/multiplication_overflow.cpp \
|
|
|
|
test/fuzz/net.cpp \
|
|
|
|
test/fuzz/net_permissions.cpp \
|
|
|
|
test/fuzz/netaddress.cpp \
|
2020-06-29 18:11:13 -04:00
|
|
|
test/fuzz/netbase_dns_lookup.cpp \
|
2020-09-18 10:47:00 -03:00
|
|
|
test/fuzz/node_eviction.cpp \
|
2021-05-23 11:10:25 -04:00
|
|
|
test/fuzz/p2p_transport_serialization.cpp \
|
2020-12-03 12:42:49 -03:00
|
|
|
test/fuzz/parse_hd_keypath.cpp \
|
|
|
|
test/fuzz/parse_iso8601.cpp \
|
|
|
|
test/fuzz/parse_numbers.cpp \
|
|
|
|
test/fuzz/parse_script.cpp \
|
|
|
|
test/fuzz/parse_univalue.cpp \
|
|
|
|
test/fuzz/policy_estimator.cpp \
|
|
|
|
test/fuzz/policy_estimator_io.cpp \
|
|
|
|
test/fuzz/pow.cpp \
|
|
|
|
test/fuzz/prevector.cpp \
|
|
|
|
test/fuzz/primitives_transaction.cpp \
|
|
|
|
test/fuzz/process_message.cpp \
|
|
|
|
test/fuzz/process_messages.cpp \
|
|
|
|
test/fuzz/protocol.cpp \
|
|
|
|
test/fuzz/psbt.cpp \
|
|
|
|
test/fuzz/random.cpp \
|
|
|
|
test/fuzz/rbf.cpp \
|
|
|
|
test/fuzz/rolling_bloom_filter.cpp \
|
2021-04-28 02:35:46 -04:00
|
|
|
test/fuzz/rpc.cpp \
|
2020-12-03 12:42:49 -03:00
|
|
|
test/fuzz/script.cpp \
|
|
|
|
test/fuzz/script_assets_test_minimizer.cpp \
|
|
|
|
test/fuzz/script_bitcoin_consensus.cpp \
|
|
|
|
test/fuzz/script_descriptor_cache.cpp \
|
|
|
|
test/fuzz/script_flags.cpp \
|
|
|
|
test/fuzz/script_interpreter.cpp \
|
|
|
|
test/fuzz/script_ops.cpp \
|
|
|
|
test/fuzz/script_sigcache.cpp \
|
|
|
|
test/fuzz/script_sign.cpp \
|
|
|
|
test/fuzz/scriptnum_ops.cpp \
|
|
|
|
test/fuzz/secp256k1_ec_seckey_import_export_der.cpp \
|
|
|
|
test/fuzz/secp256k1_ecdsa_signature_parse_der_lax.cpp \
|
|
|
|
test/fuzz/signature_checker.cpp \
|
|
|
|
test/fuzz/signet.cpp \
|
2020-06-07 12:59:46 -04:00
|
|
|
test/fuzz/socks5.cpp \
|
2020-12-03 12:42:49 -03:00
|
|
|
test/fuzz/span.cpp \
|
|
|
|
test/fuzz/spanparsing.cpp \
|
|
|
|
test/fuzz/string.cpp \
|
|
|
|
test/fuzz/strprintf.cpp \
|
|
|
|
test/fuzz/system.cpp \
|
|
|
|
test/fuzz/timedata.cpp \
|
2020-06-15 17:05:27 -04:00
|
|
|
test/fuzz/torcontrol.cpp \
|
2020-12-03 12:42:49 -03:00
|
|
|
test/fuzz/transaction.cpp \
|
|
|
|
test/fuzz/tx_in.cpp \
|
|
|
|
test/fuzz/tx_out.cpp \
|
2021-01-14 17:26:19 -03:00
|
|
|
test/fuzz/tx_pool.cpp \
|
2020-06-12 10:17:59 -04:00
|
|
|
test/fuzz/txrequest.cpp \
|
2021-04-03 08:39:42 -03:00
|
|
|
test/fuzz/utxo_snapshot.cpp \
|
2021-03-16 05:35:45 -03:00
|
|
|
test/fuzz/validation_load_mempool.cpp \
|
|
|
|
test/fuzz/versionbits.cpp
|
2021-01-24 13:09:24 -03:00
|
|
|
endif # ENABLE_FUZZ_BINARY
|
2014-11-18 14:06:32 -03:00
|
|
|
|
2014-05-28 13:38:41 -04:00
|
|
|
nodist_test_test_bitcoin_SOURCES = $(GENERATED_TEST_FILES)
|
|
|
|
|
|
|
|
$(BITCOIN_TESTS): $(GENERATED_TEST_FILES)
|
|
|
|
|
2020-08-14 07:38:28 -04:00
|
|
|
CLEAN_BITCOIN_TEST = test/*.gcda test/*.gcno test/fuzz/*.gcda test/fuzz/*.gcno test/util/*.gcda test/util/*.gcno $(GENERATED_TEST_FILES) $(BITCOIN_TESTS:=.log)
|
2014-05-28 13:38:41 -04:00
|
|
|
|
|
|
|
CLEANFILES += $(CLEAN_BITCOIN_TEST)
|
|
|
|
|
2018-08-28 08:50:41 -03:00
|
|
|
if TARGET_WINDOWS
|
2014-05-28 13:38:41 -04:00
|
|
|
bitcoin_test: $(TEST_BINARY)
|
2018-08-28 08:50:41 -03:00
|
|
|
else
|
|
|
|
if ENABLE_BENCH
|
|
|
|
bitcoin_test: $(TEST_BINARY) $(BENCH_BINARY)
|
|
|
|
else
|
|
|
|
bitcoin_test: $(TEST_BINARY)
|
|
|
|
endif
|
|
|
|
endif
|
2014-05-28 13:38:41 -04:00
|
|
|
|
|
|
|
bitcoin_test_check: $(TEST_BINARY) FORCE
|
|
|
|
$(MAKE) check-TESTS TESTS=$^
|
|
|
|
|
|
|
|
bitcoin_test_clean : FORCE
|
|
|
|
rm -f $(CLEAN_BITCOIN_TEST) $(test_test_bitcoin_OBJECTS) $(TEST_BINARY)
|
2014-06-04 17:13:03 -04:00
|
|
|
|
2018-04-09 20:56:25 -03:00
|
|
|
check-local: $(BITCOIN_TESTS:.cpp=.cpp.test)
|
2018-01-23 00:53:26 -03:00
|
|
|
if BUILD_BITCOIN_TX
|
2017-03-08 19:46:18 -03:00
|
|
|
@echo "Running test/util/bitcoin-util-test.py..."
|
2017-10-01 06:19:49 -03:00
|
|
|
$(PYTHON) $(top_builddir)/test/util/bitcoin-util-test.py
|
2018-01-23 00:53:26 -03:00
|
|
|
endif
|
2018-04-23 04:39:12 -03:00
|
|
|
@echo "Running test/util/rpcauth-test.py..."
|
|
|
|
$(PYTHON) $(top_builddir)/test/util/rpcauth-test.py
|
2018-08-28 08:50:41 -03:00
|
|
|
if TARGET_WINDOWS
|
|
|
|
else
|
|
|
|
if ENABLE_BENCH
|
Replace current benchmarking framework with nanobench
This replaces the current benchmarking framework with nanobench [1], an
MIT licensed single-header benchmarking library, of which I am the
autor. This has in my opinion several advantages, especially on Linux:
* fast: Running all benchmarks takes ~6 seconds instead of 4m13s on
an Intel i7-8700 CPU @ 3.20GHz.
* accurate: I ran e.g. the benchmark for SipHash_32b 10 times and
calculate standard deviation / mean = coefficient of variation:
* 0.57% CV for old benchmarking framework
* 0.20% CV for nanobench
So the benchmark results with nanobench seem to vary less than with
the old framework.
* It automatically determines runtime based on clock precision, no need
to specify number of evaluations.
* measure instructions, cycles, branches, instructions per cycle,
branch misses (only Linux, when performance counters are available)
* output in markdown table format.
* Warn about unstable environment (frequency scaling, turbo, ...)
* For better profiling, it is possible to set the environment variable
NANOBENCH_ENDLESS to force endless running of a particular benchmark
without the need to recompile. This makes it to e.g. run "perf top"
and look at hotspots.
Here is an example copy & pasted from the terminal output:
| ns/byte | byte/s | err% | ins/byte | cyc/byte | IPC | bra/byte | miss% | total | benchmark
|--------------------:|--------------------:|--------:|----------------:|----------------:|-------:|---------------:|--------:|----------:|:----------
| 2.52 | 396,529,415.94 | 0.6% | 25.42 | 8.02 | 3.169 | 0.06 | 0.0% | 0.03 | `bench/crypto_hash.cpp RIPEMD160`
| 1.87 | 535,161,444.83 | 0.3% | 21.36 | 5.95 | 3.589 | 0.06 | 0.0% | 0.02 | `bench/crypto_hash.cpp SHA1`
| 3.22 | 310,344,174.79 | 1.1% | 36.80 | 10.22 | 3.601 | 0.09 | 0.0% | 0.04 | `bench/crypto_hash.cpp SHA256`
| 2.01 | 496,375,796.23 | 0.0% | 18.72 | 6.43 | 2.911 | 0.01 | 1.0% | 0.00 | `bench/crypto_hash.cpp SHA256D64_1024`
| 7.23 | 138,263,519.35 | 0.1% | 82.66 | 23.11 | 3.577 | 1.63 | 0.1% | 0.00 | `bench/crypto_hash.cpp SHA256_32b`
| 3.04 | 328,780,166.40 | 0.3% | 35.82 | 9.69 | 3.696 | 0.03 | 0.0% | 0.03 | `bench/crypto_hash.cpp SHA512`
[1] https://github.com/martinus/nanobench
* Adds support for asymptotes
This adds support to calculate asymptotic complexity of a benchmark.
This is similar to #17375, but currently only one asymptote is
supported, and I have added support in the benchmark `ComplexMemPool`
as an example.
Usage is e.g. like this:
```
./bench_bitcoin -filter=ComplexMemPool -asymptote=25,50,100,200,400,600,800
```
This runs the benchmark `ComplexMemPool` several times but with
different complexityN settings. The benchmark can extract that number
and use it accordingly. Here, it's used for `childTxs`. The output is
this:
| complexityN | ns/op | op/s | err% | ins/op | cyc/op | IPC | total | benchmark
|------------:|--------------------:|--------------------:|--------:|----------------:|----------------:|-------:|----------:|:----------
| 25 | 1,064,241.00 | 939.64 | 1.4% | 3,960,279.00 | 2,829,708.00 | 1.400 | 0.01 | `ComplexMemPool`
| 50 | 1,579,530.00 | 633.10 | 1.0% | 6,231,810.00 | 4,412,674.00 | 1.412 | 0.02 | `ComplexMemPool`
| 100 | 4,022,774.00 | 248.58 | 0.6% | 16,544,406.00 | 11,889,535.00 | 1.392 | 0.04 | `ComplexMemPool`
| 200 | 15,390,986.00 | 64.97 | 0.2% | 63,904,254.00 | 47,731,705.00 | 1.339 | 0.17 | `ComplexMemPool`
| 400 | 69,394,711.00 | 14.41 | 0.1% | 272,602,461.00 | 219,014,691.00 | 1.245 | 0.76 | `ComplexMemPool`
| 600 | 168,977,165.00 | 5.92 | 0.1% | 639,108,082.00 | 535,316,887.00 | 1.194 | 1.86 | `ComplexMemPool`
| 800 | 310,109,077.00 | 3.22 | 0.1% |1,149,134,246.00 | 984,620,812.00 | 1.167 | 3.41 | `ComplexMemPool`
| coefficient | err% | complexity
|--------------:|-------:|------------
| 4.78486e-07 | 4.5% | O(n^2)
| 6.38557e-10 | 21.7% | O(n^3)
| 3.42338e-05 | 38.0% | O(n log n)
| 0.000313914 | 46.9% | O(n)
| 0.0129823 | 114.4% | O(log n)
| 0.0815055 | 133.8% | O(1)
The best fitting curve is O(n^2), so the algorithm seems to scale
quadratic with `childTxs` in the range 25 to 800.
2020-06-13 03:37:27 -04:00
|
|
|
@echo "Running bench/bench_bitcoin ..."
|
|
|
|
$(BENCH_BINARY) > /dev/null
|
2018-08-28 08:50:41 -03:00
|
|
|
endif
|
|
|
|
endif
|
2014-11-05 22:56:45 -03:00
|
|
|
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C secp256k1 check
|
2016-01-13 21:26:23 -03:00
|
|
|
if EMBEDDED_UNIVALUE
|
2015-09-04 11:11:34 -03:00
|
|
|
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C univalue check
|
2016-01-13 21:26:23 -03:00
|
|
|
endif
|
2014-11-05 22:56:45 -03:00
|
|
|
|
2018-04-09 20:56:25 -03:00
|
|
|
%.cpp.test: %.cpp
|
2018-05-31 04:30:38 -04:00
|
|
|
@echo Running tests: `cat $< | grep -E "(BOOST_FIXTURE_TEST_SUITE\\(|BOOST_AUTO_TEST_SUITE\\()" | cut -d '(' -f 2 | cut -d ',' -f 1 | cut -d ')' -f 1` from $<
|
2020-03-30 14:59:13 -03:00
|
|
|
$(AM_V_at)$(TEST_BINARY) --catch_system_errors=no -l test_suite -t "`cat $< | grep -E "(BOOST_FIXTURE_TEST_SUITE\\(|BOOST_AUTO_TEST_SUITE\\()" | cut -d '(' -f 2 | cut -d ',' -f 1 | cut -d ')' -f 1`" -- DEBUG_LOG_OUT > $<.log 2>&1 || (cat $<.log && false)
|
2018-04-09 20:56:25 -03:00
|
|
|
|
2014-06-04 17:13:03 -04:00
|
|
|
%.json.h: %.json
|
|
|
|
@$(MKDIR_P) $(@D)
|
2016-11-12 04:15:02 -03:00
|
|
|
@{ \
|
|
|
|
echo "namespace json_tests{" && \
|
|
|
|
echo "static unsigned const char $(*F)[] = {" && \
|
|
|
|
$(HEXDUMP) -v -e '8/1 "0x%02x, "' -e '"\n"' $< | $(SED) -e 's/0x ,//g' && \
|
|
|
|
echo "};};"; \
|
|
|
|
} > "$@.new" && mv -f "$@.new" "$@"
|
2014-06-04 17:13:03 -04:00
|
|
|
@echo "Generated $@"
|
2019-12-24 15:18:44 -03:00
|
|
|
|
|
|
|
%.raw.h: %.raw
|
|
|
|
@$(MKDIR_P) $(@D)
|
|
|
|
@{ \
|
|
|
|
echo "static unsigned const char $(*F)_raw[] = {" && \
|
|
|
|
$(HEXDUMP) -v -e '8/1 "0x%02x, "' -e '"\n"' $< | $(SED) -e 's/0x ,//g' && \
|
|
|
|
echo "};"; \
|
|
|
|
} > "$@.new" && mv -f "$@.new" "$@"
|
|
|
|
@echo "Generated $@"
|