[tests] Add libFuzzer support.
[bitcoinplatinum.git] / src / Makefile.test.include
blobee1c11ff1f621b68d4c046c27ee8300c98fd936e
1 # Copyright (c) 2013-2016 The Bitcoin Core developers
2 # Distributed under the MIT software license, see the accompanying
3 # file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 TESTS += test/test_bitcoin
6 bin_PROGRAMS += test/test_bitcoin
7 noinst_PROGRAMS += test/test_bitcoin_fuzzy
8 TEST_SRCDIR = test
9 TEST_BINARY=test/test_bitcoin$(EXEEXT)
11 JSON_TEST_FILES = \
12   test/data/script_tests.json \
13   test/data/base58_keys_valid.json \
14   test/data/base58_encode_decode.json \
15   test/data/base58_keys_invalid.json \
16   test/data/tx_invalid.json \
17   test/data/tx_valid.json \
18   test/data/sighash.json
20 RAW_TEST_FILES =
22 GENERATED_TEST_FILES = $(JSON_TEST_FILES:.json=.json.h) $(RAW_TEST_FILES:.raw=.raw.h)
24 # test_bitcoin binary #
25 BITCOIN_TESTS =\
26   test/arith_uint256_tests.cpp \
27   test/scriptnum10.h \
28   test/addrman_tests.cpp \
29   test/amount_tests.cpp \
30   test/allocator_tests.cpp \
31   test/base32_tests.cpp \
32   test/base58_tests.cpp \
33   test/base64_tests.cpp \
34   test/bip32_tests.cpp \
35   test/blockencodings_tests.cpp \
36   test/bloom_tests.cpp \
37   test/bswap_tests.cpp \
38   test/checkqueue_tests.cpp \
39   test/coins_tests.cpp \
40   test/compress_tests.cpp \
41   test/crypto_tests.cpp \
42   test/cuckoocache_tests.cpp \
43   test/DoS_tests.cpp \
44   test/getarg_tests.cpp \
45   test/hash_tests.cpp \
46   test/key_tests.cpp \
47   test/limitedmap_tests.cpp \
48   test/dbwrapper_tests.cpp \
49   test/main_tests.cpp \
50   test/mempool_tests.cpp \
51   test/merkle_tests.cpp \
52   test/miner_tests.cpp \
53   test/multisig_tests.cpp \
54   test/net_tests.cpp \
55   test/netbase_tests.cpp \
56   test/pmt_tests.cpp \
57   test/policyestimator_tests.cpp \
58   test/pow_tests.cpp \
59   test/prevector_tests.cpp \
60   test/raii_event_tests.cpp \
61   test/random_tests.cpp \
62   test/reverselock_tests.cpp \
63   test/rpc_tests.cpp \
64   test/sanity_tests.cpp \
65   test/scheduler_tests.cpp \
66   test/script_P2SH_tests.cpp \
67   test/script_tests.cpp \
68   test/scriptnum_tests.cpp \
69   test/serialize_tests.cpp \
70   test/sighash_tests.cpp \
71   test/sigopcount_tests.cpp \
72   test/skiplist_tests.cpp \
73   test/streams_tests.cpp \
74   test/test_bitcoin.cpp \
75   test/test_bitcoin.h \
76   test/test_bitcoin_main.cpp \
77   test/test_random.h \
78   test/testutil.cpp \
79   test/testutil.h \
80   test/timedata_tests.cpp \
81   test/torcontrol_tests.cpp \
82   test/transaction_tests.cpp \
83   test/txvalidationcache_tests.cpp \
84   test/versionbits_tests.cpp \
85   test/uint256_tests.cpp \
86   test/univalue_tests.cpp \
87   test/util_tests.cpp
89 if ENABLE_WALLET
90 BITCOIN_TESTS += \
91   wallet/test/wallet_test_fixture.cpp \
92   wallet/test/wallet_test_fixture.h \
93   wallet/test/accounting_tests.cpp \
94   wallet/test/wallet_tests.cpp \
95   wallet/test/crypto_tests.cpp
96 endif
98 test_test_bitcoin_SOURCES = $(BITCOIN_TESTS) $(JSON_TEST_FILES) $(RAW_TEST_FILES)
99 test_test_bitcoin_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) -I$(builddir)/test/ $(TESTDEFS) $(EVENT_CFLAGS)
100 test_test_bitcoin_LDADD = $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBMEMENV) \
101   $(BOOST_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIB) $(LIBSECP256K1) $(EVENT_LIBS) $(EVENT_PTHREADS_LIBS)
102 test_test_bitcoin_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
103 if ENABLE_WALLET
104 test_test_bitcoin_LDADD += $(LIBBITCOIN_WALLET)
105 endif
107 test_test_bitcoin_LDADD += $(LIBBITCOIN_CONSENSUS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS)
108 test_test_bitcoin_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -static
110 if ENABLE_ZMQ
111 test_test_bitcoin_LDADD += $(ZMQ_LIBS)
112 endif
115 # test_bitcoin_fuzzy binary #
116 test_test_bitcoin_fuzzy_SOURCES = test/test_bitcoin_fuzzy.cpp
117 test_test_bitcoin_fuzzy_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
118 test_test_bitcoin_fuzzy_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
119 test_test_bitcoin_fuzzy_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
121 test_test_bitcoin_fuzzy_LDADD = \
122   $(LIBUNIVALUE) \
123   $(LIBBITCOIN_SERVER) \
124   $(LIBBITCOIN_COMMON) \
125   $(LIBBITCOIN_UTIL) \
126   $(LIBBITCOIN_CONSENSUS) \
127   $(LIBBITCOIN_CRYPTO) \
128   $(LIBSECP256K1)
130 test_test_bitcoin_fuzzy_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
133 nodist_test_test_bitcoin_SOURCES = $(GENERATED_TEST_FILES)
135 $(BITCOIN_TESTS): $(GENERATED_TEST_FILES)
137 CLEAN_BITCOIN_TEST = test/*.gcda test/*.gcno $(GENERATED_TEST_FILES)
139 CLEANFILES += $(CLEAN_BITCOIN_TEST)
141 bitcoin_test: $(TEST_BINARY)
143 bitcoin_test_check: $(TEST_BINARY) FORCE
144         $(MAKE) check-TESTS TESTS=$^
146 bitcoin_test_clean : FORCE
147         rm -f $(CLEAN_BITCOIN_TEST) $(test_test_bitcoin_OBJECTS) $(TEST_BINARY)
149 check-local:
150         @echo "Running test/util/bitcoin-util-test.py..."
151         $(PYTHON) $(top_builddir)/test/util/bitcoin-util-test.py
152         $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C secp256k1 check
153 if EMBEDDED_UNIVALUE
154         $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C univalue check
155 endif
157 %.json.h: %.json
158         @$(MKDIR_P) $(@D)
159         @{ \
160          echo "namespace json_tests{" && \
161          echo "static unsigned const char $(*F)[] = {" && \
162          $(HEXDUMP) -v -e '8/1 "0x%02x, "' -e '"\n"' $< | $(SED) -e 's/0x  ,//g' && \
163          echo "};};"; \
164         } > "$@.new" && mv -f "$@.new" "$@"
165         @echo "Generated $@"