2016-09-21 22:31:23 +00: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 11:09:24 -05:00
|
|
|
if ENABLE_FUZZ_BINARY
|
2020-12-03 16:42:49 +01:00
|
|
|
noinst_PROGRAMS += test/fuzz/fuzz
|
2021-01-24 11:09:24 -05:00
|
|
|
endif
|
|
|
|
|
|
2022-02-08 18:30:24 +01:00
|
|
|
if ENABLE_TESTS
|
2014-05-28 13:38:41 -04:00
|
|
|
bin_PROGRAMS += test/test_bitcoin
|
2019-01-25 18:35:36 -05:00
|
|
|
endif
|
|
|
|
|
|
2014-05-28 13:38:41 -04:00
|
|
|
TEST_SRCDIR = test
|
|
|
|
|
TEST_BINARY=test/test_bitcoin$(EXEEXT)
|
2020-12-14 15:52:39 +01:00
|
|
|
FUZZ_BINARY=test/fuzz/fuzz$(EXEEXT)
|
2014-05-28 13:38:41 -04:00
|
|
|
|
|
|
|
|
JSON_TEST_FILES = \
|
2018-03-24 18:37:10 -05:00
|
|
|
test/data/script_tests.json \
|
2021-10-27 19:16:01 -04:00
|
|
|
test/data/bip341_wallet_vectors.json \
|
2014-05-28 13:38:41 -04:00
|
|
|
test/data/base58_encode_decode.json \
|
2018-01-23 17:38:23 -08:00
|
|
|
test/data/blockfilters.json \
|
2017-09-20 16:57:44 -07: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 16:57:44 -07:00
|
|
|
test/data/tx_valid.json
|
2014-05-28 13:38:41 -04:00
|
|
|
|
2019-12-24 13:18:44 -05: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 19:55:49 -04:00
|
|
|
BITCOIN_TEST_SUITE = \
|
2019-02-28 14:51:11 -05:00
|
|
|
test/main.cpp \
|
2019-11-21 21:13:08 +01:00
|
|
|
$(TEST_UTIL_H)
|
2018-04-09 19:55:49 -04:00
|
|
|
|
2019-02-28 15:04:03 -05:00
|
|
|
FUZZ_SUITE_LD_COMMON = \
|
2021-06-15 16:38:01 +02:00
|
|
|
$(LIBTEST_UTIL) \
|
|
|
|
|
$(LIBTEST_FUZZ) \
|
2021-12-20 10:53:01 -05:00
|
|
|
$(LIBBITCOIN_NODE) \
|
2021-06-15 16:38:01 +02:00
|
|
|
$(LIBBITCOIN_WALLET) \
|
2019-02-28 15:04:03 -05:00
|
|
|
$(LIBBITCOIN_COMMON) \
|
|
|
|
|
$(LIBBITCOIN_UTIL) \
|
|
|
|
|
$(LIBBITCOIN_CONSENSUS) \
|
|
|
|
|
$(LIBBITCOIN_CRYPTO) \
|
2019-10-03 09:11:40 +00:00
|
|
|
$(LIBBITCOIN_CLI) \
|
2019-02-28 15:04:03 -05:00
|
|
|
$(LIBUNIVALUE) \
|
|
|
|
|
$(LIBLEVELDB) \
|
|
|
|
|
$(LIBMEMENV) \
|
|
|
|
|
$(LIBSECP256K1) \
|
2023-02-23 15:47:21 -05:00
|
|
|
$(LIBELEMENTSSIMPLICITY) \
|
2021-11-12 16:19:56 +01:00
|
|
|
$(MINISKETCH_LIBS) \
|
2019-02-28 15:04:03 -05:00
|
|
|
$(EVENT_LIBS) \
|
|
|
|
|
$(EVENT_PTHREADS_LIBS)
|
|
|
|
|
|
2021-01-24 11:09:24 -05:00
|
|
|
if USE_UPNP
|
|
|
|
|
FUZZ_SUITE_LD_COMMON += $(MINIUPNPC_LIBS)
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
if USE_NATPMP
|
|
|
|
|
FUZZ_SUITE_LD_COMMON += $(NATPMP_LIBS)
|
|
|
|
|
endif
|
|
|
|
|
|
2016-04-22 15:19:33 -07:00
|
|
|
# test_bitcoin binary #
|
2014-05-28 13:38:41 -04:00
|
|
|
BITCOIN_TESTS =\
|
2019-01-31 10:45:51 +00:00
|
|
|
test/pegin_witness_tests.cpp \
|
2015-09-22 15:24:16 -04:00
|
|
|
test/addrman_tests.cpp \
|
2014-05-28 13:38:41 -04:00
|
|
|
test/allocator_tests.cpp \
|
2021-11-12 10:59:36 +01:00
|
|
|
test/amount_tests.cpp \
|
2022-11-11 12:37:04 +01:00
|
|
|
test/argsman_tests.cpp \
|
2021-11-12 10:59:36 +01:00
|
|
|
test/arith_uint256_tests.cpp \
|
2021-06-28 16:41:11 +02:00
|
|
|
test/banman_tests.cpp \
|
2014-05-28 13:38:41 -04:00
|
|
|
test/base32_tests.cpp \
|
|
|
|
|
test/base58_tests.cpp \
|
|
|
|
|
test/base64_tests.cpp \
|
2017-08-25 18:12:39 -07:00
|
|
|
test/bech32_tests.cpp \
|
2019-04-23 16:36:15 +01:00
|
|
|
test/blech32_tests.cpp \
|
2015-04-23 13:20:18 +02:00
|
|
|
test/bip32_tests.cpp \
|
2023-07-06 14:19:29 -04:00
|
|
|
test/bip324_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 15:40:02 -08:00
|
|
|
test/blockchain_tests.cpp \
|
2016-04-25 15:51:08 -07:00
|
|
|
test/blockencodings_tests.cpp \
|
2018-08-27 18:44:43 -07:00
|
|
|
test/blockfilter_index_tests.cpp \
|
2021-11-12 10:59:36 +01:00
|
|
|
test/blockfilter_tests.cpp \
|
2022-04-14 18:44:34 -04:00
|
|
|
test/blockmanager_tests.cpp \
|
2014-05-28 13:38:41 -04:00
|
|
|
test/bloom_tests.cpp \
|
2016-12-16 16:52:35 +09:00
|
|
|
test/bswap_tests.cpp \
|
2017-01-07 19:51:23 -05:00
|
|
|
test/checkqueue_tests.cpp \
|
2014-09-17 01:27:06 +02:00
|
|
|
test/coins_tests.cpp \
|
2019-08-28 15:58:53 -04:00
|
|
|
test/coinstatsindex_tests.cpp \
|
2019-05-08 13:29:44 -07:00
|
|
|
test/compilerbug_tests.cpp \
|
2014-10-31 09:36:30 +01:00
|
|
|
test/compress_tests.cpp \
|
2014-05-31 22:01:42 +02:00
|
|
|
test/crypto_tests.cpp \
|
2016-10-05 16:59:18 -04:00
|
|
|
test/cuckoocache_tests.cpp \
|
2021-11-12 10:59:36 +01:00
|
|
|
test/dbwrapper_tests.cpp \
|
2018-05-23 14:14:58 +02:00
|
|
|
test/denialofservice_tests.cpp \
|
2018-07-15 19:32:09 -07:00
|
|
|
test/descriptor_tests.cpp \
|
2019-01-06 22:23:34 -08:00
|
|
|
test/flatfile_tests.cpp \
|
2018-09-07 21:12:24 +08:00
|
|
|
test/fs_tests.cpp \
|
2014-05-28 13:38:41 -04:00
|
|
|
test/getarg_tests.cpp \
|
2014-04-20 17:36:25 +02:00
|
|
|
test/hash_tests.cpp \
|
2022-03-09 14:45:45 -05:00
|
|
|
test/headers_sync_chainwork_tests.cpp \
|
2022-01-05 14:28:12 +00:00
|
|
|
test/httpserver_tests.cpp \
|
2021-03-11 16:27:22 +01:00
|
|
|
test/i2p_tests.cpp \
|
2020-02-24 14:34:17 -05:00
|
|
|
test/interfaces_tests.cpp \
|
2017-09-20 16:57:44 -07:00
|
|
|
test/key_io_tests.cpp \
|
2014-05-28 13:38:41 -04:00
|
|
|
test/key_tests.cpp \
|
2019-09-19 13:59:49 -04:00
|
|
|
test/logging_tests.cpp \
|
2015-03-25 13:13:09 -04:00
|
|
|
test/mempool_tests.cpp \
|
2015-11-17 17:35:44 +01:00
|
|
|
test/merkle_tests.cpp \
|
2017-09-11 17:43:48 -07:00
|
|
|
test/merkleblock_tests.cpp \
|
2014-05-28 13:38:41 -04:00
|
|
|
test/miner_tests.cpp \
|
2022-08-11 09:58:39 +01:00
|
|
|
test/miniminer_tests.cpp \
|
2019-08-28 16:23:03 -07:00
|
|
|
test/miniscript_tests.cpp \
|
2021-11-12 10:59:36 +01:00
|
|
|
test/minisketch_tests.cpp \
|
2014-05-28 13:38:41 -04:00
|
|
|
test/multisig_tests.cpp \
|
2021-02-20 11:21:34 +01:00
|
|
|
test/net_peer_eviction_tests.cpp \
|
2016-03-16 12:54:30 -04:00
|
|
|
test/net_tests.cpp \
|
2014-05-28 13:38:41 -04:00
|
|
|
test/netbase_tests.cpp \
|
2022-02-07 10:18:00 +00:00
|
|
|
test/orphanage_tests.cpp \
|
2014-05-28 13:38:41 -04:00
|
|
|
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 \
|
2022-06-11 09:23:51 +02:00
|
|
|
test/pool_tests.cpp \
|
2015-02-21 12:57:44 +00:00
|
|
|
test/pow_tests.cpp \
|
2015-10-29 07:11:24 +01:00
|
|
|
test/prevector_tests.cpp \
|
2016-12-21 13:43:49 +09:00
|
|
|
test/raii_event_tests.cpp \
|
2017-02-15 17:45:22 -08:00
|
|
|
test/random_tests.cpp \
|
2021-09-28 16:38:59 +01:00
|
|
|
test/rbf_tests.cpp \
|
2022-01-18 16:37:54 +00:00
|
|
|
test/rest_tests.cpp \
|
2022-07-21 08:30:39 -04:00
|
|
|
test/result_tests.cpp \
|
2015-09-03 12:53:00 -04:00
|
|
|
test/reverselock_tests.cpp \
|
2014-05-28 13:38:41 -04:00
|
|
|
test/rpc_tests.cpp \
|
2015-01-05 21:39:40 -05:00
|
|
|
test/sanity_tests.cpp \
|
2015-04-10 10:31:02 -04:00
|
|
|
test/scheduler_tests.cpp \
|
2018-05-23 14:14:58 +02:00
|
|
|
test/script_p2sh_tests.cpp \
|
2021-10-05 12:57:20 +02:00
|
|
|
test/script_parse_tests.cpp \
|
2018-11-18 15:55:50 +01:00
|
|
|
test/script_segwit_tests.cpp \
|
2017-08-18 14:40:29 -07:00
|
|
|
test/script_standard_tests.cpp \
|
2021-10-05 12:57:20 +02:00
|
|
|
test/script_tests.cpp \
|
2021-11-12 10:59:36 +01:00
|
|
|
test/scriptnum10.h \
|
2014-10-31 09:36:30 +01:00
|
|
|
test/scriptnum_tests.cpp \
|
2021-05-16 17:46:26 -07: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 09:36:30 +01:00
|
|
|
test/sighash_tests.cpp \
|
2014-05-28 13:38:41 -04:00
|
|
|
test/sigopcount_tests.cpp \
|
2014-06-29 15:26:58 +02:00
|
|
|
test/skiplist_tests.cpp \
|
2021-01-04 11:44:21 +01:00
|
|
|
test/sock_tests.cpp \
|
2015-09-07 15:22:23 -07:00
|
|
|
test/streams_tests.cpp \
|
2017-11-08 15:28:35 -05:00
|
|
|
test/sync_tests.cpp \
|
2020-01-30 12:07:57 +01:00
|
|
|
test/system_tests.cpp \
|
2014-08-20 13:53:42 +02:00
|
|
|
test/timedata_tests.cpp \
|
2017-03-25 20:17:37 +13:00
|
|
|
test/torcontrol_tests.cpp \
|
2014-05-28 13:38:41 -04:00
|
|
|
test/transaction_tests.cpp \
|
2023-02-23 15:29:19 -05:00
|
|
|
test/translation_tests.cpp \
|
2017-12-08 12:00:13 -08:00
|
|
|
test/txindex_tests.cpp \
|
2021-10-28 12:54:19 +01:00
|
|
|
test/txpackage_tests.cpp \
|
2021-11-05 10:40:55 +02:00
|
|
|
test/txreconciliation_tests.cpp \
|
2021-11-12 10:59:36 +01:00
|
|
|
test/txrequest_tests.cpp \
|
2017-11-18 00:48:34 -08:00
|
|
|
test/txvalidation_tests.cpp \
|
2015-03-03 09:59:32 -05:00
|
|
|
test/txvalidationcache_tests.cpp \
|
2014-12-16 15:50:31 +01:00
|
|
|
test/uint256_tests.cpp \
|
2018-04-18 08:01:48 -04:00
|
|
|
test/util_tests.cpp \
|
2021-11-12 10:59:36 +01:00
|
|
|
test/util_threadnames_tests.cpp \
|
2018-04-18 08:01:48 -04:00
|
|
|
test/validation_block_tests.cpp \
|
2020-04-14 14:00:37 -04:00
|
|
|
test/validation_chainstate_tests.cpp \
|
2019-12-12 14:11:03 -05:00
|
|
|
test/validation_chainstatemanager_tests.cpp \
|
2019-09-24 14:10:18 -04:00
|
|
|
test/validation_flush_tests.cpp \
|
2021-11-12 10:59:36 +01:00
|
|
|
test/validation_tests.cpp \
|
2020-04-07 08:03:39 -04:00
|
|
|
test/validationinterface_tests.cpp \
|
2020-11-26 01:08:13 +00:00
|
|
|
test/versionbits_tests.cpp \
|
2025-04-05 18:42:18 +02:00
|
|
|
test/xoroshiro128plusplus_tests.cpp \
|
2019-03-20 10:34:38 +00:00
|
|
|
test/pegin_spent_tests.cpp \
|
2019-09-25 16:08:07 +02:00
|
|
|
test/dynafed_tests.cpp \
|
2019-03-20 10:34:38 +00:00
|
|
|
test/blind_tests.cpp
|
2020-11-14 16:52:06 +00:00
|
|
|
# ELEMENTS (last 3 tests)
|
2014-05-28 13:38:41 -04:00
|
|
|
|
|
|
|
|
if ENABLE_WALLET
|
|
|
|
|
BITCOIN_TESTS += \
|
2022-08-12 16:29:41 -04:00
|
|
|
wallet/test/feebumper_tests.cpp \
|
2021-06-04 18:38:13 -04:00
|
|
|
wallet/test/spend_tests.cpp \
|
2015-02-03 21:09:47 +01:00
|
|
|
wallet/test/wallet_tests.cpp \
|
2020-03-10 07:42:31 +00:00
|
|
|
wallet/test/walletdb_tests.cpp \
|
2018-04-05 16:00:39 -04:00
|
|
|
wallet/test/wallet_crypto_tests.cpp \
|
2021-02-16 22:36:26 -05:00
|
|
|
wallet/test/wallet_transaction_tests.cpp \
|
2018-09-10 20:49:17 -04:00
|
|
|
wallet/test/coinselector_tests.cpp \
|
2019-06-06 09:53:16 +02:00
|
|
|
wallet/test/init_tests.cpp \
|
2020-02-04 17:24:48 -05:00
|
|
|
wallet/test/ismine_tests.cpp \
|
2022-09-28 12:10:38 +01:00
|
|
|
wallet/test/rpc_util_tests.cpp \
|
2022-09-07 16:02:16 -03:00
|
|
|
wallet/test/scriptpubkeyman_tests.cpp \
|
2022-07-31 17:25:04 -03:00
|
|
|
wallet/test/walletload_tests.cpp \
|
|
|
|
|
wallet/test/group_outputs_tests.cpp
|
2019-05-21 12:23:42 +01:00
|
|
|
# ELEMENTS: disable PSBT test
|
|
|
|
|
# wallet/test/psbt_wallet_tests.cpp
|
2018-04-09 19:55:49 -04:00
|
|
|
|
2021-01-24 11:09:24 -05:00
|
|
|
FUZZ_SUITE_LD_COMMON +=\
|
|
|
|
|
$(SQLITE_LIBS) \
|
|
|
|
|
$(BDB_LIBS)
|
|
|
|
|
|
2020-10-19 15:34:21 -04:00
|
|
|
if USE_BDB
|
|
|
|
|
BITCOIN_TESTS += wallet/test/db_tests.cpp
|
|
|
|
|
endif
|
|
|
|
|
|
2021-10-21 14:07:36 +02:00
|
|
|
FUZZ_WALLET_SRC = \
|
2023-06-16 20:30:46 +05:30
|
|
|
wallet/test/fuzz/coincontrol.cpp \
|
2022-09-28 12:10:38 +01:00
|
|
|
wallet/test/fuzz/coinselection.cpp \
|
2023-05-12 12:53:59 -03:00
|
|
|
wallet/test/fuzz/fees.cpp \
|
2022-09-28 12:10:38 +01:00
|
|
|
wallet/test/fuzz/parse_iso8601.cpp
|
2022-03-17 01:28:01 +01:00
|
|
|
|
|
|
|
|
if USE_SQLITE
|
|
|
|
|
FUZZ_WALLET_SRC += \
|
2021-10-21 14:07:36 +02:00
|
|
|
wallet/test/fuzz/notifications.cpp
|
|
|
|
|
endif # USE_SQLITE
|
2021-01-24 11:09:24 -05:00
|
|
|
|
2018-04-09 19:55:49 -04:00
|
|
|
BITCOIN_TEST_SUITE += \
|
|
|
|
|
wallet/test/wallet_test_fixture.cpp \
|
2018-09-10 20:49:17 -04:00
|
|
|
wallet/test/wallet_test_fixture.h \
|
|
|
|
|
wallet/test/init_test_fixture.cpp \
|
|
|
|
|
wallet/test/init_test_fixture.h
|
2021-10-21 14:07:36 +02:00
|
|
|
endif # ENABLE_WALLET
|
2014-05-28 13:38:41 -04:00
|
|
|
|
2018-04-09 19:55:49 -04:00
|
|
|
test_test_bitcoin_SOURCES = $(BITCOIN_TEST_SUITE) $(BITCOIN_TESTS) $(JSON_TEST_FILES) $(RAW_TEST_FILES)
|
2022-09-09 17:55:21 +01:00
|
|
|
test_test_bitcoin_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(TESTDEFS) $(BOOST_CPPFLAGS) $(EVENT_CFLAGS)
|
2019-11-21 21:13:08 +01:00
|
|
|
test_test_bitcoin_LDADD = $(LIBTEST_UTIL)
|
2014-05-28 13:38:41 -04:00
|
|
|
if ENABLE_WALLET
|
|
|
|
|
test_test_bitcoin_LDADD += $(LIBBITCOIN_WALLET)
|
2022-05-30 10:24:00 +01:00
|
|
|
test_test_bitcoin_CPPFLAGS += $(BDB_CPPFLAGS)
|
2014-05-28 13:38:41 -04:00
|
|
|
endif
|
2018-05-08 10:27:57 -07:00
|
|
|
|
2021-12-20 10:53:01 -05:00
|
|
|
test_test_bitcoin_LDADD += $(LIBBITCOIN_NODE) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) \
|
2024-11-27 14:53:17 +02:00
|
|
|
$(LIBLEVELDB) $(LIBMEMENV) $(LIBSECP256K1) $(LIBELEMENTSSIMPLICITY) $(EVENT_LIBS) $(EVENT_PTHREADS_LIBS) $(MINISKETCH_LIBS)
|
2017-07-07 16:03:24 +02:00
|
|
|
test_test_bitcoin_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
2014-06-06 10:57:28 -04:00
|
|
|
|
2020-02-23 01:34:13 +02:00
|
|
|
test_test_bitcoin_LDADD += $(BDB_LIBS) $(MINIUPNPC_LIBS) $(NATPMP_LIBS) $(SQLITE_LIBS)
|
2020-07-17 14:43:29 +08: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 12:06:32 -05:00
|
|
|
if ENABLE_ZMQ
|
2019-02-28 15:45:26 -05:00
|
|
|
test_test_bitcoin_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
|
2021-01-24 11:09:24 -05:00
|
|
|
FUZZ_SUITE_LD_COMMON += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
|
2014-11-18 12:06:32 -05:00
|
|
|
endif
|
2019-01-25 18:35:36 -05:00
|
|
|
|
2021-01-24 11:09:24 -05:00
|
|
|
if ENABLE_FUZZ_BINARY
|
2022-09-09 17:55:21 +01:00
|
|
|
test_fuzz_fuzz_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS)
|
2020-12-03 16:42:49 +01:00
|
|
|
test_fuzz_fuzz_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
2024-12-02 17:25:16 +00:00
|
|
|
test_fuzz_fuzz_CFLAGS = $(AM_CFLAGS) $(PIE_FLAGS)
|
2020-12-03 16:42:49 +01:00
|
|
|
test_fuzz_fuzz_LDADD = $(FUZZ_SUITE_LD_COMMON)
|
2021-10-21 12:52:18 +02:00
|
|
|
test_fuzz_fuzz_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS) $(RUNTIME_LDFLAGS)
|
2020-12-03 16:42:49 +01:00
|
|
|
test_fuzz_fuzz_SOURCES = \
|
2021-10-21 14:07:36 +02:00
|
|
|
$(FUZZ_WALLET_SRC) \
|
2020-12-03 16:42:49 +01:00
|
|
|
test/fuzz/addition_overflow.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 \
|
2023-07-06 14:19:29 -04:00
|
|
|
test/fuzz/bip324.cpp \
|
2022-02-22 20:34:20 -05:00
|
|
|
test/fuzz/bitdeque.cpp \
|
2020-12-03 16:42:49 +01:00
|
|
|
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 \
|
2023-01-31 18:04:31 -05:00
|
|
|
test/fuzz/coinscache_sim.cpp \
|
2020-12-03 16:42:49 +01:00
|
|
|
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_common.cpp \
|
2021-08-07 10:55:33 +00:00
|
|
|
test/fuzz/crypto_diff_fuzz_chacha20.cpp \
|
2020-12-03 16:42:49 +01:00
|
|
|
test/fuzz/crypto_hkdf_hmac_sha256_l32.cpp \
|
|
|
|
|
test/fuzz/crypto_poly1305.cpp \
|
|
|
|
|
test/fuzz/cuckoocache.cpp \
|
|
|
|
|
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 \
|
2022-12-08 12:47:24 +00:00
|
|
|
test/fuzz/headerssync.cpp \
|
2020-12-03 16:42:49 +01:00
|
|
|
test/fuzz/hex.cpp \
|
|
|
|
|
test/fuzz/http_request.cpp \
|
2021-03-04 15:32:11 +01:00
|
|
|
test/fuzz/i2p.cpp \
|
2020-12-03 16:42:49 +01: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 \
|
2022-04-13 14:11:59 +02:00
|
|
|
test/fuzz/miniscript.cpp \
|
2021-11-12 16:19:56 +01:00
|
|
|
test/fuzz/minisketch.cpp \
|
2023-02-16 15:31:44 +00:00
|
|
|
test/fuzz/mini_miner.cpp \
|
2020-11-24 01:35:37 +01:00
|
|
|
test/fuzz/muhash.cpp \
|
2020-12-03 16:42:49 +01:00
|
|
|
test/fuzz/multiplication_overflow.cpp \
|
|
|
|
|
test/fuzz/net.cpp \
|
|
|
|
|
test/fuzz/net_permissions.cpp \
|
|
|
|
|
test/fuzz/netaddress.cpp \
|
2020-06-29 22:11:13 +00:00
|
|
|
test/fuzz/netbase_dns_lookup.cpp \
|
2020-09-18 13:47:00 +00:00
|
|
|
test/fuzz/node_eviction.cpp \
|
2021-05-23 08:10:25 -07:00
|
|
|
test/fuzz/p2p_transport_serialization.cpp \
|
2020-12-03 16:42:49 +01:00
|
|
|
test/fuzz/parse_hd_keypath.cpp \
|
|
|
|
|
test/fuzz/parse_numbers.cpp \
|
|
|
|
|
test/fuzz/parse_script.cpp \
|
|
|
|
|
test/fuzz/parse_univalue.cpp \
|
2023-01-16 16:16:07 +01:00
|
|
|
test/fuzz/partially_downloaded_block.cpp \
|
2020-12-03 16:42:49 +01:00
|
|
|
test/fuzz/policy_estimator.cpp \
|
|
|
|
|
test/fuzz/policy_estimator_io.cpp \
|
2022-06-11 10:48:35 +02:00
|
|
|
test/fuzz/poolresource.cpp \
|
2020-12-03 16:42:49 +01:00
|
|
|
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 06:35:46 +00:00
|
|
|
test/fuzz/rpc.cpp \
|
2020-12-03 16:42:49 +01: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 \
|
2022-02-15 12:22:23 +01:00
|
|
|
test/fuzz/script_format.cpp \
|
2020-12-03 16:42:49 +01:00
|
|
|
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 \
|
2024-12-02 17:25:16 +00:00
|
|
|
test/fuzz/simplicity_compute_amr.c \
|
2024-04-20 11:34:45 +02:00
|
|
|
test/fuzz/simplicity.cpp \
|
fuzz: add second simplicity fuzz test
The first fuzztest takes a Simplicity program and a transaction and
directly calls the Simplicity interpreter with some context cobbled
together from the transaction. It also tries messing with the budget
and computes AMRs to check that the AMR-check works, even though on
the blockchain AMRs are never used.
It also attempts mangling programs to directly fuzz the parser, type
inference and CMR checking.
THIS test, on the other hand, takes a transaction, looks for Simplicity
programs (or witnesses which look like Simplicity programs), computes
their CMRs to produce a correct corresponding scriptPubKey, creates
scriptchecks, and executes them. This should do an end-to-end coverage
of the whole Simplicity consensus logic, including all the new branches
in interpreter.cpp.
To produce seeds for this, I have a a local fuzz target which uses
rust-simplicity and rust-elements to produce programs, deep Taproot trees,
and transactions. I run this to get high coverage, then dump the
resulting complete transactions to disk, where they can be used as
seeds for this test.
2025-02-02 20:55:30 +00:00
|
|
|
test/fuzz/simplicity_tx.cpp \
|
2020-06-07 16:59:46 +00:00
|
|
|
test/fuzz/socks5.cpp \
|
2020-12-03 16:42:49 +01: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 21:05:27 +00:00
|
|
|
test/fuzz/torcontrol.cpp \
|
2020-12-03 16:42:49 +01:00
|
|
|
test/fuzz/transaction.cpp \
|
|
|
|
|
test/fuzz/tx_in.cpp \
|
|
|
|
|
test/fuzz/tx_out.cpp \
|
2021-01-14 21:26:19 +01:00
|
|
|
test/fuzz/tx_pool.cpp \
|
2022-06-22 20:44:43 +08:00
|
|
|
test/fuzz/txorphan.cpp \
|
2020-06-12 14:17:59 +00:00
|
|
|
test/fuzz/txrequest.cpp \
|
2021-04-03 13:39:42 +02:00
|
|
|
test/fuzz/utxo_snapshot.cpp \
|
2023-05-02 17:34:12 +02:00
|
|
|
test/fuzz/utxo_total_supply.cpp \
|
2021-03-16 18:35:45 +10:00
|
|
|
test/fuzz/validation_load_mempool.cpp \
|
2021-09-05 12:35:58 +00:00
|
|
|
test/fuzz/versionbits.cpp \
|
|
|
|
|
test/fuzz/witness_program.cpp
|
2021-01-24 11:09:24 -05:00
|
|
|
endif # ENABLE_FUZZ_BINARY
|
2014-11-18 12:06:32 -05:00
|
|
|
|
2014-05-28 13:38:41 -04:00
|
|
|
nodist_test_test_bitcoin_SOURCES = $(GENERATED_TEST_FILES)
|
|
|
|
|
|
|
|
|
|
$(BITCOIN_TESTS): $(GENERATED_TEST_FILES)
|
|
|
|
|
|
2022-08-07 12:13:51 +01:00
|
|
|
CLEAN_BITCOIN_TEST = test/*.gcda test/*.gcno test/fuzz/*.gcda test/fuzz/*.gcno test/util/*.gcda test/util/*.gcno $(GENERATED_TEST_FILES) $(addsuffix .log,$(basename $(BITCOIN_TESTS)))
|
2014-05-28 13:38:41 -04:00
|
|
|
|
|
|
|
|
CLEANFILES += $(CLEAN_BITCOIN_TEST)
|
|
|
|
|
|
2018-08-28 13:50:41 +02:00
|
|
|
if TARGET_WINDOWS
|
2014-05-28 13:38:41 -04:00
|
|
|
bitcoin_test: $(TEST_BINARY)
|
2018-08-28 13:50:41 +02: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 19:56:25 -04:00
|
|
|
check-local: $(BITCOIN_TESTS:.cpp=.cpp.test)
|
2018-01-23 03:53:26 +00:00
|
|
|
if BUILD_BITCOIN_TX
|
2021-09-02 10:49:21 +02:00
|
|
|
@echo "Running test/util/test_runner.py..."
|
|
|
|
|
$(PYTHON) $(top_builddir)/test/util/test_runner.py
|
2018-01-23 03:53:26 +00:00
|
|
|
endif
|
2018-04-23 00:39:12 -07:00
|
|
|
@echo "Running test/util/rpcauth-test.py..."
|
|
|
|
|
$(PYTHON) $(top_builddir)/test/util/rpcauth-test.py
|
2018-08-28 13:50:41 +02:00
|
|
|
if TARGET_WINDOWS
|
|
|
|
|
else
|
|
|
|
|
if ENABLE_BENCH
|
2022-09-25 12:46:32 -03:00
|
|
|
@echo "Running bench/bench_bitcoin (one iteration sanity check, only high priority)..."
|
2022-11-10 16:26:44 +00:00
|
|
|
$(BENCH_BINARY) -sanity-check -priority-level=high
|
2018-08-28 13:50:41 +02:00
|
|
|
endif
|
|
|
|
|
endif
|
2014-11-05 20:56:45 -05:00
|
|
|
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C secp256k1 check
|
2021-07-15 18:42:17 +00:00
|
|
|
|
2022-02-08 18:30:24 +01:00
|
|
|
if ENABLE_TESTS
|
2022-07-14 16:48:06 +01:00
|
|
|
UNIVALUE_TESTS = univalue/test/object univalue/test/unitester
|
2021-07-15 18:42:17 +00:00
|
|
|
noinst_PROGRAMS += $(UNIVALUE_TESTS)
|
|
|
|
|
TESTS += $(UNIVALUE_TESTS)
|
|
|
|
|
|
|
|
|
|
univalue_test_unitester_SOURCES = $(UNIVALUE_TEST_UNITESTER_INT)
|
|
|
|
|
univalue_test_unitester_LDADD = $(LIBUNIVALUE)
|
|
|
|
|
univalue_test_unitester_CPPFLAGS = -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT) -DJSON_TEST_SRC=\"$(srcdir)/$(UNIVALUE_TEST_DATA_DIR_INT)\"
|
|
|
|
|
univalue_test_unitester_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS)
|
|
|
|
|
|
|
|
|
|
univalue_test_object_SOURCES = $(UNIVALUE_TEST_OBJECT_INT)
|
|
|
|
|
univalue_test_object_LDADD = $(LIBUNIVALUE)
|
|
|
|
|
univalue_test_object_CPPFLAGS = -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT)
|
|
|
|
|
univalue_test_object_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS)
|
2016-01-14 00:26:23 +00:00
|
|
|
endif
|
2014-11-05 20:56:45 -05:00
|
|
|
|
2018-04-09 19:56:25 -04:00
|
|
|
%.cpp.test: %.cpp
|
2020-06-26 08:20:50 -05:00
|
|
|
@echo Running tests: $$(\
|
2022-03-30 11:55:44 +02:00
|
|
|
cat $< | \
|
|
|
|
|
grep -E "(BOOST_FIXTURE_TEST_SUITE\\(|BOOST_AUTO_TEST_SUITE\\()" | \
|
|
|
|
|
cut -d '(' -f 2 | cut -d ',' -f 1 | cut -d ')' -f 1\
|
|
|
|
|
) from $<
|
2022-03-30 11:13:40 +02:00
|
|
|
$(AM_V_at)export TEST_LOGFILE=$(abs_builddir)/$$(\
|
|
|
|
|
echo $< | grep -E -o "(wallet/test/.*\.cpp|test/.*\.cpp)" | $(SED) -e s/\.cpp/.log/ \
|
|
|
|
|
) && \
|
|
|
|
|
$(TEST_BINARY) --catch_system_errors=no -l test_suite -t "$$(\
|
2022-03-30 11:55:44 +02:00
|
|
|
cat $< | \
|
|
|
|
|
grep -E "(BOOST_FIXTURE_TEST_SUITE\\(|BOOST_AUTO_TEST_SUITE\\()" | \
|
|
|
|
|
cut -d '(' -f 2 | cut -d ',' -f 1 | cut -d ')' -f 1\
|
2022-03-30 11:13:40 +02:00
|
|
|
)" -- DEBUG_LOG_OUT > "$$TEST_LOGFILE" 2>&1 || (cat "$$TEST_LOGFILE" && false)
|
2018-04-09 19:56:25 -04:00
|
|
|
|
2014-06-04 17:13:03 -04:00
|
|
|
%.json.h: %.json
|
|
|
|
|
@$(MKDIR_P) $(@D)
|
2023-02-03 21:42:57 +01:00
|
|
|
$(AM_V_GEN) { \
|
2023-07-27 12:17:50 +02:00
|
|
|
echo "#include <string>" && \
|
2016-11-12 07:15:02 +00:00
|
|
|
echo "namespace json_tests{" && \
|
2023-07-27 12:17:50 +02:00
|
|
|
echo "static const std::string $(*F){" && \
|
2016-11-12 07:15:02 +00:00
|
|
|
$(HEXDUMP) -v -e '8/1 "0x%02x, "' -e '"\n"' $< | $(SED) -e 's/0x ,//g' && \
|
|
|
|
|
echo "};};"; \
|
|
|
|
|
} > "$@.new" && mv -f "$@.new" "$@"
|