aboutsummaryrefslogtreecommitdiff
path: root/src/test/Makefile.am
diff options
context:
space:
mode:
authorCory Fields <cory-nospam-@coryfields.com>2013-09-10 15:18:09 -0400
committerCory Fields <cory-nospam-@coryfields.com>2013-09-16 12:53:11 -0400
commit152e51c7af2624831cc4796e06bf3b72787cc85f (patch)
treed943cbc4159b2e88f0ee68907edf51b9f673d6a8 /src/test/Makefile.am
parent08081e393b6d3249c19395f91537a7d824ec7333 (diff)
downloadbitcoin-152e51c7af2624831cc4796e06bf3b72787cc85f.tar.xz
included-tests: generate binary data from test files for inclusion into test binaries
This change moves test data into the binaries rather than reading them from the disk at runtime. Advantages: - Tests become distributable - Cross-compile friendly. Build on one machine and execute in an arbitrary location on another. - Easier testing for backports. Users can verify that tests pass without having to track down corresponding test data. - More trustworthy test results and easier quality assurance as tests make fewer assumptions about their environment. - Tests could theoretically run at client/daemon startup and exit on failure. Disadvantages: - Required 'hexdump' build-dependency. This is a standard bsd tool that should be usable everywhere. It is likely already installed on all build-machines. - Tests can no longer be fudged after build by altering test-data.
Diffstat (limited to 'src/test/Makefile.am')
-rw-r--r--src/test/Makefile.am27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/test/Makefile.am b/src/test/Makefile.am
index 2995deff0a..d193b729f8 100644
--- a/src/test/Makefile.am
+++ b/src/test/Makefile.am
@@ -10,19 +10,20 @@ bin_PROGRAMS = test_bitcoin
TESTS = test_bitcoin
-TEST_DATA_DIR=$(srcdir)/data
+JSON_TEST_FILES= data/script_valid.json \
+ data/base58_keys_valid.json data/sig_canonical.json \
+ data/sig_noncanonical.json \
+ data/base58_encode_decode.json \
+ data/base58_keys_invalid.json \
+ data/script_invalid.json data/tx_invalid.json \
+ data/tx_valid.json
-TEST_DATA_FILES= $(TEST_DATA_DIR)/script_valid.json \
- $(TEST_DATA_DIR)/base58_keys_valid.json $(TEST_DATA_DIR)/sig_canonical.json \
- $(TEST_DATA_DIR)/sig_noncanonical.json \
- $(TEST_DATA_DIR)/base58_encode_decode.json $(TEST_DATA_DIR)/alertTests \
- $(TEST_DATA_DIR)/base58_keys_invalid.json \
- $(TEST_DATA_DIR)/script_invalid.json $(TEST_DATA_DIR)/tx_invalid.json \
- $(TEST_DATA_DIR)/tx_valid.json
+RAW_TEST_FILES = data/alertTests.raw
+
+BUILT_SOURCES = $(JSON_TEST_FILES:.json=.json.h) $(RAW_TEST_FILES:.raw=.raw.h)
# test_bitcoin binary #
-test_bitcoin_CPPFLAGS = $(AM_CPPFLAGS) $(TESTDEFS) \
- -DTEST_DATA_DIR=$(abs_srcdir)/data
+test_bitcoin_CPPFLAGS = $(AM_CPPFLAGS) $(TESTDEFS)
test_bitcoin_LDADD = $(LIBBITCOIN) $(LIBLEVELDB) $(LIBMEMENV) \
$(BOOST_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIB)
test_bitcoin_SOURCES = accounting_tests.cpp alert_tests.cpp \
@@ -33,6 +34,8 @@ test_bitcoin_SOURCES = accounting_tests.cpp alert_tests.cpp \
netbase_tests.cpp pmt_tests.cpp rpc_tests.cpp script_P2SH_tests.cpp \
script_tests.cpp serialize_tests.cpp sigopcount_tests.cpp test_bitcoin.cpp \
transaction_tests.cpp uint160_tests.cpp uint256_tests.cpp util_tests.cpp \
- wallet_tests.cpp $(TEST_DATA_FILES)
+ wallet_tests.cpp $(JSON_TEST_FILES) $(RAW_TEST_FILES)
+
+nodist_test_bitcoin_SOURCES = $(BUILT_SOURCES)
-CLEANFILES = *.gcda *.gcno
+CLEANFILES = *.gcda *.gcno $(BUILT_SOURCES)