diff options
author | John Newbery <john@johnnewbery.com> | 2017-03-08 17:46:18 -0500 |
---|---|---|
committer | John Newbery <john@johnnewbery.com> | 2017-03-20 10:40:31 -0400 |
commit | 63d66ba20a634b54f6d5e8b051fb4a106f2cef6c (patch) | |
tree | e6c1211ac2cedbfbe61061fc405914262da4437e | |
parent | 5b0bff4581cf5cbecce35df46075ba256b4974f5 (diff) |
Move src/test/bitcoin-util-test.py to test/util/bitcoin-util-test.py
-rw-r--r-- | .gitignore | 6 | ||||
-rw-r--r-- | Makefile.am | 56 | ||||
-rw-r--r-- | configure.ac | 9 | ||||
-rw-r--r-- | contrib/rpm/bitcoin.spec | 4 | ||||
-rw-r--r-- | src/Makefile.test.include | 61 | ||||
-rw-r--r-- | src/test/README.md | 9 | ||||
-rwxr-xr-x | src/test/bitcoin-util-test.py | 45 | ||||
-rw-r--r-- | src/test/buildenv.py.in | 2 | ||||
-rw-r--r-- | test/README.md | 60 | ||||
-rw-r--r-- | test/util/bctest.py (renamed from src/test/bctest.py) | 6 | ||||
-rwxr-xr-x | test/util/bitcoin-util-test.py | 36 | ||||
-rw-r--r-- | test/util/buildenv.py.in | 4 | ||||
-rw-r--r-- | test/util/data/bitcoin-util-test.json (renamed from src/test/data/bitcoin-util-test.json) | 0 | ||||
-rw-r--r-- | test/util/data/blanktxv1.hex (renamed from src/test/data/blanktxv1.hex) | 0 | ||||
-rw-r--r-- | test/util/data/blanktxv1.json (renamed from src/test/data/blanktxv1.json) | 0 | ||||
-rw-r--r-- | test/util/data/blanktxv2.hex (renamed from src/test/data/blanktxv2.hex) | 0 | ||||
-rw-r--r-- | test/util/data/blanktxv2.json (renamed from src/test/data/blanktxv2.json) | 0 | ||||
-rw-r--r-- | test/util/data/tt-delin1-out.hex (renamed from src/test/data/tt-delin1-out.hex) | 0 | ||||
-rw-r--r-- | test/util/data/tt-delin1-out.json (renamed from src/test/data/tt-delin1-out.json) | 0 | ||||
-rw-r--r-- | test/util/data/tt-delout1-out.hex (renamed from src/test/data/tt-delout1-out.hex) | 0 | ||||
-rw-r--r-- | test/util/data/tt-delout1-out.json (renamed from src/test/data/tt-delout1-out.json) | 0 | ||||
-rw-r--r-- | test/util/data/tt-locktime317000-out.hex (renamed from src/test/data/tt-locktime317000-out.hex) | 0 | ||||
-rw-r--r-- | test/util/data/tt-locktime317000-out.json (renamed from src/test/data/tt-locktime317000-out.json) | 0 | ||||
-rw-r--r-- | test/util/data/tx394b54bb.hex (renamed from src/test/data/tx394b54bb.hex) | 0 | ||||
-rw-r--r-- | test/util/data/txcreate1.hex (renamed from src/test/data/txcreate1.hex) | 0 | ||||
-rw-r--r-- | test/util/data/txcreate1.json (renamed from src/test/data/txcreate1.json) | 0 | ||||
-rw-r--r-- | test/util/data/txcreate2.hex (renamed from src/test/data/txcreate2.hex) | 0 | ||||
-rw-r--r-- | test/util/data/txcreate2.json (renamed from src/test/data/txcreate2.json) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatedata1.hex (renamed from src/test/data/txcreatedata1.hex) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatedata1.json (renamed from src/test/data/txcreatedata1.json) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatedata2.hex (renamed from src/test/data/txcreatedata2.hex) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatedata2.json (renamed from src/test/data/txcreatedata2.json) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatedata_seq0.hex (renamed from src/test/data/txcreatedata_seq0.hex) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatedata_seq0.json (renamed from src/test/data/txcreatedata_seq0.json) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatedata_seq1.hex (renamed from src/test/data/txcreatedata_seq1.hex) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatedata_seq1.json (renamed from src/test/data/txcreatedata_seq1.json) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatemultisig1.hex (renamed from src/test/data/txcreatemultisig1.hex) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatemultisig1.json (renamed from src/test/data/txcreatemultisig1.json) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatemultisig2.hex (renamed from src/test/data/txcreatemultisig2.hex) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatemultisig2.json (renamed from src/test/data/txcreatemultisig2.json) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatemultisig3.hex (renamed from src/test/data/txcreatemultisig3.hex) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatemultisig3.json (renamed from src/test/data/txcreatemultisig3.json) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatemultisig4.hex (renamed from src/test/data/txcreatemultisig4.hex) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatemultisig4.json (renamed from src/test/data/txcreatemultisig4.json) | 0 | ||||
-rw-r--r-- | test/util/data/txcreateoutpubkey1.hex (renamed from src/test/data/txcreateoutpubkey1.hex) | 0 | ||||
-rw-r--r-- | test/util/data/txcreateoutpubkey1.json (renamed from src/test/data/txcreateoutpubkey1.json) | 0 | ||||
-rw-r--r-- | test/util/data/txcreateoutpubkey2.hex (renamed from src/test/data/txcreateoutpubkey2.hex) | 0 | ||||
-rw-r--r-- | test/util/data/txcreateoutpubkey2.json (renamed from src/test/data/txcreateoutpubkey2.json) | 0 | ||||
-rw-r--r-- | test/util/data/txcreateoutpubkey3.hex (renamed from src/test/data/txcreateoutpubkey3.hex) | 0 | ||||
-rw-r--r-- | test/util/data/txcreateoutpubkey3.json (renamed from src/test/data/txcreateoutpubkey3.json) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatescript1.hex (renamed from src/test/data/txcreatescript1.hex) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatescript1.json (renamed from src/test/data/txcreatescript1.json) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatescript2.hex (renamed from src/test/data/txcreatescript2.hex) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatescript2.json (renamed from src/test/data/txcreatescript2.json) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatescript3.hex (renamed from src/test/data/txcreatescript3.hex) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatescript3.json (renamed from src/test/data/txcreatescript3.json) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatescript4.hex (renamed from src/test/data/txcreatescript4.hex) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatescript4.json (renamed from src/test/data/txcreatescript4.json) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatesignv1.hex (renamed from src/test/data/txcreatesignv1.hex) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatesignv1.json (renamed from src/test/data/txcreatesignv1.json) | 0 | ||||
-rw-r--r-- | test/util/data/txcreatesignv2.hex (renamed from src/test/data/txcreatesignv2.hex) | 0 |
61 files changed, 146 insertions, 152 deletions
diff --git a/.gitignore b/.gitignore index 479889cb78..f1e9ca20c1 100644 --- a/.gitignore +++ b/.gitignore @@ -101,9 +101,9 @@ coverage_percent.txt linux-coverage-build linux-build win32-build -qa/pull-tester/tests_config.py -qa/pull-tester/tests_config.ini -qa/cache/* +test/functional/config.ini +test/util/buildenv.py +test/cache/* !src/leveldb*/Makefile diff --git a/Makefile.am b/Makefile.am index 12ddfcd995..e82704dbdf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -225,8 +225,64 @@ dist_noinst_SCRIPTS = autogen.sh EXTRA_DIST = $(top_srcdir)/share/genbuild.sh test/functional/test_runner.py test/functional $(DIST_CONTRIB) $(DIST_DOCS) $(WINDOWS_PACKAGING) $(OSX_PACKAGING) $(BIN_CHECKS) +EXTRA_DIST += \ + test/util/bctest.py \ + test/util/bitcoin-util-test.py \ + test/util/data/bitcoin-util-test.json \ + test/util/data/blanktxv1.hex \ + test/util/data/blanktxv1.json \ + test/util/data/blanktxv2.hex \ + test/util/data/blanktxv2.json \ + test/util/data/tt-delin1-out.hex \ + test/util/data/tt-delin1-out.json \ + test/util/data/tt-delout1-out.hex \ + test/util/data/tt-delout1-out.json \ + test/util/data/tt-locktime317000-out.hex \ + test/util/data/tt-locktime317000-out.json \ + test/util/data/tx394b54bb.hex \ + test/util/data/txcreate1.hex \ + test/util/data/txcreate1.json \ + test/util/data/txcreate2.hex \ + test/util/data/txcreate2.json \ + test/util/data/txcreatedata1.hex \ + test/util/data/txcreatedata1.json \ + test/util/data/txcreatedata2.hex \ + test/util/data/txcreatedata2.json \ + test/util/data/txcreatedata_seq0.hex \ + test/util/data/txcreatedata_seq0.json \ + test/util/data/txcreatedata_seq1.hex \ + test/util/data/txcreatedata_seq1.json \ + test/util/data/txcreatemultisig1.hex \ + test/util/data/txcreatemultisig1.json \ + test/util/data/txcreatemultisig2.hex \ + test/util/data/txcreatemultisig2.json \ + test/util/data/txcreatemultisig3.hex \ + test/util/data/txcreatemultisig3.json \ + test/util/data/txcreatemultisig4.hex \ + test/util/data/txcreatemultisig4.json \ + test/util/data/txcreateoutpubkey1.hex \ + test/util/data/txcreateoutpubkey1.json \ + test/util/data/txcreateoutpubkey2.hex \ + test/util/data/txcreateoutpubkey2.json \ + test/util/data/txcreateoutpubkey3.hex \ + test/util/data/txcreateoutpubkey3.json \ + test/util/data/txcreatescript1.hex \ + test/util/data/txcreatescript1.json \ + test/util/data/txcreatescript2.hex \ + test/util/data/txcreatescript2.json \ + test/util/data/txcreatescript3.hex \ + test/util/data/txcreatescript3.json \ + test/util/data/txcreatescript4.hex \ + test/util/data/txcreatescript4.json \ + test/util/data/txcreatesignv1.hex \ + test/util/data/txcreatesignv1.json \ + test/util/data/txcreatesignv2.hex + CLEANFILES = $(OSX_DMG) $(BITCOIN_WIN_INSTALLER) +# This file is problematic for out-of-tree builds if it exists. +DISTCLEANFILES = test/util/buildenv.pyc + .INTERMEDIATE: $(COVERAGE_INFO) DISTCHECK_CONFIGURE_FLAGS = --enable-man diff --git a/configure.ac b/configure.ac index cd1d4204c1..2a9ee018a0 100644 --- a/configure.ac +++ b/configure.ac @@ -1147,9 +1147,12 @@ AC_SUBST(EVENT_PTHREADS_LIBS) AC_SUBST(ZMQ_LIBS) AC_SUBST(PROTOBUF_LIBS) AC_SUBST(QR_LIBS) -AC_CONFIG_FILES([Makefile src/Makefile doc/man/Makefile share/setup.nsi share/qt/Info.plist src/test/buildenv.py test/functional/config.ini]) +AC_CONFIG_FILES([Makefile src/Makefile doc/man/Makefile share/setup.nsi share/qt/Info.plist test/functional/config.ini]) +AC_CONFIG_FILES([test/util/buildenv.py],[chmod +x test/util/buildenv.py]) AC_CONFIG_FILES([contrib/devtools/split-debug.sh],[chmod +x contrib/devtools/split-debug.sh]) AC_CONFIG_LINKS([test/functional/test_runner.py:test/functional/test_runner.py]) +AC_CONFIG_LINKS([test/util/bitcoin-util-test.py:test/util/bitcoin-util-test.py]) +AC_CONFIG_LINKS([test/util/bctest.py:test/util/bctest.py]) dnl boost's m4 checks do something really nasty: they export these vars. As a dnl result, they leak into secp256k1's configure and crazy things happen. @@ -1197,8 +1200,8 @@ esac dnl Replace the BUILDDIR path with the correct Windows path if compiling on Native Windows case ${OS} in *Windows*) - sed 's/BUILDDIR="\/\([[a-z]]\)/BUILDDIR="\1:/' test/pull-tester/tests_config.py > test/pull-tester/tests_config-2.py - mv test/pull-tester/tests_config-2.py test/pull-tester/tests_config.py + sed 's/BUILDDIR="\/\([[a-z]]\)/BUILDDIR="\1:/' test/functional/config.ini > test/functional/config-2.ini + mv test/functional/config-2.ini test/functional/config.ini ;; esac diff --git a/contrib/rpm/bitcoin.spec b/contrib/rpm/bitcoin.spec index 54d6618391..cc54fcaf3d 100644 --- a/contrib/rpm/bitcoin.spec +++ b/contrib/rpm/bitcoin.spec @@ -311,9 +311,7 @@ rm -f %{buildroot}%{_bindir}/test_* %check make check -pushd src -srcdir=. test/bitcoin-util-test.py -popd +srcdir=src test/bitcoin-util-test.py test/functional/test_runner.py --extended %post libs -p /sbin/ldconfig diff --git a/src/Makefile.test.include b/src/Makefile.test.include index cfd08b8238..fe0ed59fe2 100644 --- a/src/Makefile.test.include +++ b/src/Makefile.test.include @@ -8,60 +8,6 @@ noinst_PROGRAMS += test/test_bitcoin_fuzzy TEST_SRCDIR = test TEST_BINARY=test/test_bitcoin$(EXEEXT) - -EXTRA_DIST += \ - test/bctest.py \ - test/bitcoin-util-test.py \ - test/data/bitcoin-util-test.json \ - test/data/blanktxv1.hex \ - test/data/blanktxv1.json \ - test/data/blanktxv2.hex \ - test/data/blanktxv2.json \ - test/data/tt-delin1-out.hex \ - test/data/tt-delin1-out.json \ - test/data/tt-delout1-out.hex \ - test/data/tt-delout1-out.json \ - test/data/tt-locktime317000-out.hex \ - test/data/tt-locktime317000-out.json \ - test/data/tx394b54bb.hex \ - test/data/txcreate1.hex \ - test/data/txcreate1.json \ - test/data/txcreate2.hex \ - test/data/txcreate2.json \ - test/data/txcreatedata1.hex \ - test/data/txcreatedata1.json \ - test/data/txcreatedata2.hex \ - test/data/txcreatedata2.json \ - test/data/txcreatedata_seq0.hex \ - test/data/txcreatedata_seq0.json \ - test/data/txcreatedata_seq1.hex \ - test/data/txcreatedata_seq1.json \ - test/data/txcreatemultisig1.hex \ - test/data/txcreatemultisig1.json \ - test/data/txcreatemultisig2.hex \ - test/data/txcreatemultisig2.json \ - test/data/txcreatemultisig3.hex \ - test/data/txcreatemultisig3.json \ - test/data/txcreatemultisig4.hex \ - test/data/txcreatemultisig4.json \ - test/data/txcreateoutpubkey1.hex \ - test/data/txcreateoutpubkey1.json \ - test/data/txcreateoutpubkey2.hex \ - test/data/txcreateoutpubkey2.json \ - test/data/txcreateoutpubkey3.hex \ - test/data/txcreateoutpubkey3.json \ - test/data/txcreatescript1.hex \ - test/data/txcreatescript1.json \ - test/data/txcreatescript2.hex \ - test/data/txcreatescript2.json \ - test/data/txcreatescript3.hex \ - test/data/txcreatescript3.json \ - test/data/txcreatescript4.hex \ - test/data/txcreatescript4.json \ - test/data/txcreatesignv1.hex \ - test/data/txcreatesignv1.json \ - test/data/txcreatesignv2.hex - JSON_TEST_FILES = \ test/data/script_tests.json \ test/data/base58_keys_valid.json \ @@ -191,9 +137,6 @@ CLEAN_BITCOIN_TEST = test/*.gcda test/*.gcno $(GENERATED_TEST_FILES) CLEANFILES += $(CLEAN_BITCOIN_TEST) -# This file is problematic for out-of-tree builds if it exists. -DISTCLEANFILES += test/buildenv.pyc - bitcoin_test: $(TEST_BINARY) bitcoin_test_check: $(TEST_BINARY) FORCE @@ -203,8 +146,8 @@ bitcoin_test_clean : FORCE rm -f $(CLEAN_BITCOIN_TEST) $(test_test_bitcoin_OBJECTS) $(TEST_BINARY) check-local: - @echo "Running test/bitcoin-util-test.py..." - $(AM_V_at)srcdir=$(srcdir) PYTHONPATH=$(builddir)/test $(PYTHON) $(srcdir)/test/bitcoin-util-test.py + @echo "Running test/util/bitcoin-util-test.py..." + $(PYTHON) $(top_builddir)/test/util/bitcoin-util-test.py $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C secp256k1 check if EMBEDDED_UNIVALUE $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C univalue check diff --git a/src/test/README.md b/src/test/README.md index 8f99804e10..eeb04c6ffa 100644 --- a/src/test/README.md +++ b/src/test/README.md @@ -50,12 +50,3 @@ examine `uint256_tests.cpp`. For further reading, I found the following website to be helpful in explaining how the boost unit test framework works: [http://www.alittlemadness.com/2009/03/31/c-unit-testing-with-boosttest/](http://www.alittlemadness.com/2009/03/31/c-unit-testing-with-boosttest/). - -### bitcoin-util-test.py - -The test directory also contains the bitcoin-util-test.py tool, which tests bitcoin utils (currently just bitcoin-tx). This test gets run automatically during the `make check` build process. It is also possible to run the test manually from the src directory: - -``` -test/bitcoin-util-test.py --srcdir=[current directory] - -``` diff --git a/src/test/bitcoin-util-test.py b/src/test/bitcoin-util-test.py deleted file mode 100755 index e2087187aa..0000000000 --- a/src/test/bitcoin-util-test.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python -# Copyright 2014 BitPay Inc. -# Copyright 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. -from __future__ import division,print_function,unicode_literals -import os -import bctest -import buildenv -import argparse -import logging - -help_text="""Test framework for bitcoin utils. - -Runs automatically during `make check`. - -Can also be run manually from the src directory by specifying the source directory: - -test/bitcoin-util-test.py --srcdir='srcdir' [--verbose] -""" - -if __name__ == '__main__': - # Try to get the source directory from the environment variables. This will - # be set for `make check` automated runs. If environment variable is not set, - # then get the source directory from command line args. - try: - srcdir = os.environ["srcdir"] - verbose = False - except: - parser = argparse.ArgumentParser(description=help_text) - parser.add_argument('-s', '--srcdir') - parser.add_argument('-v', '--verbose', action='store_true') - args = parser.parse_args() - srcdir = args.srcdir - verbose = args.verbose - - if verbose: - level = logging.DEBUG - else: - level = logging.ERROR - formatter = '%(asctime)s - %(levelname)s - %(message)s' - # Add the format/level to the logger - logging.basicConfig(format = formatter, level=level) - - bctest.bctester(srcdir + "/test/data", "bitcoin-util-test.json", buildenv) diff --git a/src/test/buildenv.py.in b/src/test/buildenv.py.in deleted file mode 100644 index 153f34a3db..0000000000 --- a/src/test/buildenv.py.in +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env python -exeext="@EXEEXT@" diff --git a/test/README.md b/test/README.md index 3bf43717fc..dec8db960d 100644 --- a/test/README.md +++ b/test/README.md @@ -1,29 +1,32 @@ -The [functional](/test/functional/) folder contains a script test_runner - to call multiple functional tests from its folder. +This directory contains integration tests that test bitcoind and its +utilities in their entirety. It does not contain unit tests, which +can be found in [/src/test](/src/test), [/src/wallet/test](/src/wallet/test), +etc. -Every pull request to the bitcoin repository is built and run through -the regression test suite. You can also run all or only individual -tests locally. +There are currently two sets of tests in this directory: -Test dependencies -================= -Before running the tests, the following must be installed. +- [functional](/test/functional) which test the functionality of +bitcoind and bitcoin-qt by interacting with them through the RPC and P2P +interfaces. +- [util](test/util) which tests the bitcoin utilities, currently only +bitcoin-tx. -Unix ----- -The python3-zmq library is required. On Ubuntu or Debian it can be installed via: -``` -sudo apt-get install python3-zmq -``` +The util tests are run as part of `make check` target. The functional +tests are run by the travis continuous build process whenever a pull +request is opened. Both sets of tests can also be run locally. -OS X ------- -``` -pip3 install pyzmq -``` +Functional Test dependencies +============================ +The ZMQ functional test requires a python ZMQ library. To install it: + +- on Unix, run `sudo apt-get install python3-zmq` +- on mac OS, run `pip3 install pyzmq` -Running tests -============= +Running tests locally +===================== + +Functional tests +---------------- You can run any single test by calling @@ -80,8 +83,15 @@ rm -rf cache killall bitcoind ``` -Writing tests -============= -You are encouraged to write tests for new or existing features. -Further information about the test framework and individual functional +Util tests +---------- + +Util tests can be run locally by running `test/util/bitcoin-util-test.py`. +Use the `-v` option for verbose output. + +Writing functional tests +======================== + +You are encouraged to write functional tests for new or existing features. +Further information about the functional test framework and individual tests is found in [test/functional](/test/functional). diff --git a/src/test/bctest.py b/test/util/bctest.py index c69f52afc3..dfe3a123d1 100644 --- a/src/test/bctest.py +++ b/test/util/bctest.py @@ -23,14 +23,14 @@ def parse_output(a, fmt): else: raise NotImplementedError("Don't know how to compare %s" % fmt) -def bctest(testDir, testObj, exeext): +def bctest(testDir, testObj, buildenv): """Runs a single test, comparing output and RC to expected output and RC. Raises an error if input can't be read, executable fails, or output/RC are not as expected. Error is caught by bctester() and reported. """ # Get the exec names and arguments - execprog = testObj['exec'] + exeext + execprog = buildenv.BUILDDIR + "/src/" + testObj['exec'] + buildenv.exeext execargs = testObj['args'] execrun = [execprog] + execargs @@ -112,7 +112,7 @@ def bctester(testDir, input_basename, buildenv): for testObj in input_data: try: - bctest(testDir, testObj, buildenv.exeext) + bctest(testDir, testObj, buildenv) logging.info("PASSED: " + testObj["description"]) except: logging.info("FAILED: " + testObj["description"]) diff --git a/test/util/bitcoin-util-test.py b/test/util/bitcoin-util-test.py new file mode 100755 index 0000000000..e09a25159d --- /dev/null +++ b/test/util/bitcoin-util-test.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python +# Copyright 2014 BitPay Inc. +# Copyright 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. +from __future__ import division,print_function,unicode_literals +import os +import sys +import argparse +import logging + +help_text="""Test framework for bitcoin utils. + +Runs automatically during `make check`. + +Can also be run manually.""" + +if __name__ == '__main__': + sys.path.append(os.path.dirname(os.path.abspath(__file__))) + import buildenv + import bctest + + parser = argparse.ArgumentParser(description=help_text) + parser.add_argument('-v', '--verbose', action='store_true') + args = parser.parse_args() + verbose = args.verbose + + if verbose: + level = logging.DEBUG + else: + level = logging.ERROR + formatter = '%(asctime)s - %(levelname)s - %(message)s' + # Add the format/level to the logger + logging.basicConfig(format = formatter, level=level) + + bctest.bctester(buildenv.SRCDIR + "/test/util/data", "bitcoin-util-test.json", buildenv) diff --git a/test/util/buildenv.py.in b/test/util/buildenv.py.in new file mode 100644 index 0000000000..33030b0348 --- /dev/null +++ b/test/util/buildenv.py.in @@ -0,0 +1,4 @@ +#!/usr/bin/env python +exeext="@EXEEXT@" +SRCDIR="@abs_top_srcdir@" +BUILDDIR="@abs_top_builddir@" diff --git a/src/test/data/bitcoin-util-test.json b/test/util/data/bitcoin-util-test.json index a80ab51901..a80ab51901 100644 --- a/src/test/data/bitcoin-util-test.json +++ b/test/util/data/bitcoin-util-test.json diff --git a/src/test/data/blanktxv1.hex b/test/util/data/blanktxv1.hex index 36b6f00fb6..36b6f00fb6 100644 --- a/src/test/data/blanktxv1.hex +++ b/test/util/data/blanktxv1.hex diff --git a/src/test/data/blanktxv1.json b/test/util/data/blanktxv1.json index 51c25a5a98..51c25a5a98 100644 --- a/src/test/data/blanktxv1.json +++ b/test/util/data/blanktxv1.json diff --git a/src/test/data/blanktxv2.hex b/test/util/data/blanktxv2.hex index 22d830eda1..22d830eda1 100644 --- a/src/test/data/blanktxv2.hex +++ b/test/util/data/blanktxv2.hex diff --git a/src/test/data/blanktxv2.json b/test/util/data/blanktxv2.json index 266919f445..266919f445 100644 --- a/src/test/data/blanktxv2.json +++ b/test/util/data/blanktxv2.json diff --git a/src/test/data/tt-delin1-out.hex b/test/util/data/tt-delin1-out.hex index 42ad840f43..42ad840f43 100644 --- a/src/test/data/tt-delin1-out.hex +++ b/test/util/data/tt-delin1-out.hex diff --git a/src/test/data/tt-delin1-out.json b/test/util/data/tt-delin1-out.json index 712a2c27f8..712a2c27f8 100644 --- a/src/test/data/tt-delin1-out.json +++ b/test/util/data/tt-delin1-out.json diff --git a/src/test/data/tt-delout1-out.hex b/test/util/data/tt-delout1-out.hex index cc60c3fac6..cc60c3fac6 100644 --- a/src/test/data/tt-delout1-out.hex +++ b/test/util/data/tt-delout1-out.hex diff --git a/src/test/data/tt-delout1-out.json b/test/util/data/tt-delout1-out.json index afc4e95762..afc4e95762 100644 --- a/src/test/data/tt-delout1-out.json +++ b/test/util/data/tt-delout1-out.json diff --git a/src/test/data/tt-locktime317000-out.hex b/test/util/data/tt-locktime317000-out.hex index 287f420a40..287f420a40 100644 --- a/src/test/data/tt-locktime317000-out.hex +++ b/test/util/data/tt-locktime317000-out.hex diff --git a/src/test/data/tt-locktime317000-out.json b/test/util/data/tt-locktime317000-out.json index 2b9075f8ac..2b9075f8ac 100644 --- a/src/test/data/tt-locktime317000-out.json +++ b/test/util/data/tt-locktime317000-out.json diff --git a/src/test/data/tx394b54bb.hex b/test/util/data/tx394b54bb.hex index 33f26cb4d6..33f26cb4d6 100644 --- a/src/test/data/tx394b54bb.hex +++ b/test/util/data/tx394b54bb.hex diff --git a/src/test/data/txcreate1.hex b/test/util/data/txcreate1.hex index 9ec6ee3531..9ec6ee3531 100644 --- a/src/test/data/txcreate1.hex +++ b/test/util/data/txcreate1.hex diff --git a/src/test/data/txcreate1.json b/test/util/data/txcreate1.json index f83e036f33..f83e036f33 100644 --- a/src/test/data/txcreate1.json +++ b/test/util/data/txcreate1.json diff --git a/src/test/data/txcreate2.hex b/test/util/data/txcreate2.hex index 38bb7b1046..38bb7b1046 100644 --- a/src/test/data/txcreate2.hex +++ b/test/util/data/txcreate2.hex diff --git a/src/test/data/txcreate2.json b/test/util/data/txcreate2.json index fb5e177db7..fb5e177db7 100644 --- a/src/test/data/txcreate2.json +++ b/test/util/data/txcreate2.json diff --git a/src/test/data/txcreatedata1.hex b/test/util/data/txcreatedata1.hex index cefd1a05a6..cefd1a05a6 100644 --- a/src/test/data/txcreatedata1.hex +++ b/test/util/data/txcreatedata1.hex diff --git a/src/test/data/txcreatedata1.json b/test/util/data/txcreatedata1.json index 760518d30a..760518d30a 100644 --- a/src/test/data/txcreatedata1.json +++ b/test/util/data/txcreatedata1.json diff --git a/src/test/data/txcreatedata2.hex b/test/util/data/txcreatedata2.hex index d69cf58ba1..d69cf58ba1 100644 --- a/src/test/data/txcreatedata2.hex +++ b/test/util/data/txcreatedata2.hex diff --git a/src/test/data/txcreatedata2.json b/test/util/data/txcreatedata2.json index 3c6da40f90..3c6da40f90 100644 --- a/src/test/data/txcreatedata2.json +++ b/test/util/data/txcreatedata2.json diff --git a/src/test/data/txcreatedata_seq0.hex b/test/util/data/txcreatedata_seq0.hex index 54b89d2381..54b89d2381 100644 --- a/src/test/data/txcreatedata_seq0.hex +++ b/test/util/data/txcreatedata_seq0.hex diff --git a/src/test/data/txcreatedata_seq0.json b/test/util/data/txcreatedata_seq0.json index d272a4c447..d272a4c447 100644 --- a/src/test/data/txcreatedata_seq0.json +++ b/test/util/data/txcreatedata_seq0.json diff --git a/src/test/data/txcreatedata_seq1.hex b/test/util/data/txcreatedata_seq1.hex index 4cedcd975c..4cedcd975c 100644 --- a/src/test/data/txcreatedata_seq1.hex +++ b/test/util/data/txcreatedata_seq1.hex diff --git a/src/test/data/txcreatedata_seq1.json b/test/util/data/txcreatedata_seq1.json index d323255418..d323255418 100644 --- a/src/test/data/txcreatedata_seq1.json +++ b/test/util/data/txcreatedata_seq1.json diff --git a/src/test/data/txcreatemultisig1.hex b/test/util/data/txcreatemultisig1.hex index 9c00004d38..9c00004d38 100644 --- a/src/test/data/txcreatemultisig1.hex +++ b/test/util/data/txcreatemultisig1.hex diff --git a/src/test/data/txcreatemultisig1.json b/test/util/data/txcreatemultisig1.json index f6ce43c202..f6ce43c202 100644 --- a/src/test/data/txcreatemultisig1.json +++ b/test/util/data/txcreatemultisig1.json diff --git a/src/test/data/txcreatemultisig2.hex b/test/util/data/txcreatemultisig2.hex index 07835c54d3..07835c54d3 100644 --- a/src/test/data/txcreatemultisig2.hex +++ b/test/util/data/txcreatemultisig2.hex diff --git a/src/test/data/txcreatemultisig2.json b/test/util/data/txcreatemultisig2.json index e09d22060f..e09d22060f 100644 --- a/src/test/data/txcreatemultisig2.json +++ b/test/util/data/txcreatemultisig2.json diff --git a/src/test/data/txcreatemultisig3.hex b/test/util/data/txcreatemultisig3.hex index 8d34f28f87..8d34f28f87 100644 --- a/src/test/data/txcreatemultisig3.hex +++ b/test/util/data/txcreatemultisig3.hex diff --git a/src/test/data/txcreatemultisig3.json b/test/util/data/txcreatemultisig3.json index 88e32bd310..88e32bd310 100644 --- a/src/test/data/txcreatemultisig3.json +++ b/test/util/data/txcreatemultisig3.json diff --git a/src/test/data/txcreatemultisig4.hex b/test/util/data/txcreatemultisig4.hex index 7da54366c7..7da54366c7 100644 --- a/src/test/data/txcreatemultisig4.hex +++ b/test/util/data/txcreatemultisig4.hex diff --git a/src/test/data/txcreatemultisig4.json b/test/util/data/txcreatemultisig4.json index fc69c7269c..fc69c7269c 100644 --- a/src/test/data/txcreatemultisig4.json +++ b/test/util/data/txcreatemultisig4.json diff --git a/src/test/data/txcreateoutpubkey1.hex b/test/util/data/txcreateoutpubkey1.hex index 4a08244b2f..4a08244b2f 100644 --- a/src/test/data/txcreateoutpubkey1.hex +++ b/test/util/data/txcreateoutpubkey1.hex diff --git a/src/test/data/txcreateoutpubkey1.json b/test/util/data/txcreateoutpubkey1.json index 6019fa2dcd..6019fa2dcd 100644 --- a/src/test/data/txcreateoutpubkey1.json +++ b/test/util/data/txcreateoutpubkey1.json diff --git a/src/test/data/txcreateoutpubkey2.hex b/test/util/data/txcreateoutpubkey2.hex index 8283c722ab..8283c722ab 100644 --- a/src/test/data/txcreateoutpubkey2.hex +++ b/test/util/data/txcreateoutpubkey2.hex diff --git a/src/test/data/txcreateoutpubkey2.json b/test/util/data/txcreateoutpubkey2.json index 6fc3d57527..6fc3d57527 100644 --- a/src/test/data/txcreateoutpubkey2.json +++ b/test/util/data/txcreateoutpubkey2.json diff --git a/src/test/data/txcreateoutpubkey3.hex b/test/util/data/txcreateoutpubkey3.hex index 84adff4d89..84adff4d89 100644 --- a/src/test/data/txcreateoutpubkey3.hex +++ b/test/util/data/txcreateoutpubkey3.hex diff --git a/src/test/data/txcreateoutpubkey3.json b/test/util/data/txcreateoutpubkey3.json index a1a25fc834..a1a25fc834 100644 --- a/src/test/data/txcreateoutpubkey3.json +++ b/test/util/data/txcreateoutpubkey3.json diff --git a/src/test/data/txcreatescript1.hex b/test/util/data/txcreatescript1.hex index 0adce270fb..0adce270fb 100644 --- a/src/test/data/txcreatescript1.hex +++ b/test/util/data/txcreatescript1.hex diff --git a/src/test/data/txcreatescript1.json b/test/util/data/txcreatescript1.json index 8ffecba411..8ffecba411 100644 --- a/src/test/data/txcreatescript1.json +++ b/test/util/data/txcreatescript1.json diff --git a/src/test/data/txcreatescript2.hex b/test/util/data/txcreatescript2.hex index 5afe8786e3..5afe8786e3 100644 --- a/src/test/data/txcreatescript2.hex +++ b/test/util/data/txcreatescript2.hex diff --git a/src/test/data/txcreatescript2.json b/test/util/data/txcreatescript2.json index 41eb69f1af..41eb69f1af 100644 --- a/src/test/data/txcreatescript2.json +++ b/test/util/data/txcreatescript2.json diff --git a/src/test/data/txcreatescript3.hex b/test/util/data/txcreatescript3.hex index 8a2b973bf0..8a2b973bf0 100644 --- a/src/test/data/txcreatescript3.hex +++ b/test/util/data/txcreatescript3.hex diff --git a/src/test/data/txcreatescript3.json b/test/util/data/txcreatescript3.json index 90e7e27f9f..90e7e27f9f 100644 --- a/src/test/data/txcreatescript3.json +++ b/test/util/data/txcreatescript3.json diff --git a/src/test/data/txcreatescript4.hex b/test/util/data/txcreatescript4.hex index b4cfe58f42..b4cfe58f42 100644 --- a/src/test/data/txcreatescript4.hex +++ b/test/util/data/txcreatescript4.hex diff --git a/src/test/data/txcreatescript4.json b/test/util/data/txcreatescript4.json index 11783751a4..11783751a4 100644 --- a/src/test/data/txcreatescript4.json +++ b/test/util/data/txcreatescript4.json diff --git a/src/test/data/txcreatesignv1.hex b/test/util/data/txcreatesignv1.hex index a46fcc88cb..a46fcc88cb 100644 --- a/src/test/data/txcreatesignv1.hex +++ b/test/util/data/txcreatesignv1.hex diff --git a/src/test/data/txcreatesignv1.json b/test/util/data/txcreatesignv1.json index ff39e71b40..ff39e71b40 100644 --- a/src/test/data/txcreatesignv1.json +++ b/test/util/data/txcreatesignv1.json diff --git a/src/test/data/txcreatesignv2.hex b/test/util/data/txcreatesignv2.hex index ee425cd98c..ee425cd98c 100644 --- a/src/test/data/txcreatesignv2.hex +++ b/test/util/data/txcreatesignv2.hex |