Browse Source

Merge #9956: Reorganise qa directory

63d66ba Move src/test/bitcoin-util-test.py to test/util/bitcoin-util-test.py (John Newbery)
5b0bff4 Rename --enable-extended-rpc-tests to --enable-extended-functional-tests (John Newbery)
a9bd622 Rename test/pull-tester/rpc-tests.py to test/functional/test_runner.py (John Newbery)
c28ee91 Rename rpc-tests directory to functional (John Newbery)
00902c4 Rename qa directory to test (John Newbery)

Tree-SHA512: ee7125c0c647d81590177beef2c8852c4ef76fdcf888096d9d4d360562a01d8d3b453345c3040487b2a043935bd1e7e80018f34462d6e02262bedbe23edcc576
0.15
MarcoFalke 8 years ago
parent
commit
3192e5278a
No known key found for this signature in database
GPG Key ID: D2EA4850E7528B25
  1. 6
      .gitignore
  2. 2
      .travis.yml
  3. 76
      Makefile.am
  4. 4
      README.md
  5. 24
      configure.ac
  6. 2
      contrib/devtools/copyright_header.py
  7. 6
      contrib/rpm/bitcoin.spec
  8. 4
      doc/developer-notes.md
  9. 87
      qa/README.md
  10. 61
      src/Makefile.test.include
  11. 9
      src/test/README.md
  12. 45
      src/test/bitcoin-util-test.py
  13. 2
      src/test/buildenv.py.in
  14. 97
      test/README.md
  15. 0
      test/functional/.gitignore
  16. 0
      test/functional/README.md
  17. 0
      test/functional/abandonconflict.py
  18. 0
      test/functional/assumevalid.py
  19. 0
      test/functional/bip65-cltv-p2p.py
  20. 0
      test/functional/bip65-cltv.py
  21. 0
      test/functional/bip68-112-113-p2p.py
  22. 0
      test/functional/bip68-sequence.py
  23. 0
      test/functional/bip9-softforks.py
  24. 0
      test/functional/bipdersig-p2p.py
  25. 0
      test/functional/bipdersig.py
  26. 0
      test/functional/blockchain.py
  27. 0
      test/functional/bumpfee.py
  28. 2
      test/functional/config.ini.in
  29. 2
      test/functional/create_cache.py
  30. 0
      test/functional/decodescript.py
  31. 0
      test/functional/disablewallet.py
  32. 0
      test/functional/forknotify.py
  33. 0
      test/functional/fundrawtransaction.py
  34. 0
      test/functional/getblocktemplate_longpoll.py
  35. 0
      test/functional/getblocktemplate_proposals.py
  36. 0
      test/functional/getchaintips.py
  37. 0
      test/functional/httpbasics.py
  38. 0
      test/functional/import-rescan.py
  39. 0
      test/functional/importmulti.py
  40. 0
      test/functional/importprunedfunds.py
  41. 0
      test/functional/invalidateblock.py
  42. 0
      test/functional/invalidblockrequest.py
  43. 0
      test/functional/invalidtxrequest.py
  44. 0
      test/functional/keypool.py
  45. 0
      test/functional/listsinceblock.py
  46. 0
      test/functional/listtransactions.py
  47. 0
      test/functional/maxblocksinflight.py
  48. 0
      test/functional/maxuploadtarget.py
  49. 0
      test/functional/mempool_limit.py
  50. 0
      test/functional/mempool_packages.py
  51. 0
      test/functional/mempool_reorg.py
  52. 0
      test/functional/mempool_resurrect_test.py
  53. 0
      test/functional/mempool_spendcoinbase.py
  54. 0
      test/functional/merkle_blocks.py
  55. 0
      test/functional/multi_rpc.py
  56. 0
      test/functional/nodehandling.py
  57. 0
      test/functional/nulldummy.py
  58. 0
      test/functional/p2p-acceptblock.py
  59. 0
      test/functional/p2p-compactblocks.py
  60. 0
      test/functional/p2p-feefilter.py
  61. 0
      test/functional/p2p-fullblocktest.py
  62. 0
      test/functional/p2p-leaktests.py
  63. 0
      test/functional/p2p-mempool.py
  64. 0
      test/functional/p2p-segwit.py
  65. 0
      test/functional/p2p-timeouts.py
  66. 0
      test/functional/p2p-versionbits-warning.py
  67. 0
      test/functional/preciousblock.py
  68. 0
      test/functional/prioritise_transaction.py
  69. 0
      test/functional/proxy_test.py
  70. 0
      test/functional/pruning.py
  71. 0
      test/functional/rawtransactions.py
  72. 0
      test/functional/receivedby.py
  73. 0
      test/functional/reindex.py
  74. 0
      test/functional/replace-by-fee.py
  75. 0
      test/functional/rest.py
  76. 0
      test/functional/rpcbind_test.py
  77. 0
      test/functional/rpcnamedargs.py
  78. 0
      test/functional/segwit.py
  79. 0
      test/functional/sendheaders.py
  80. 0
      test/functional/signmessages.py
  81. 0
      test/functional/signrawtransactions.py
  82. 0
      test/functional/smartfees.py
  83. 0
      test/functional/test_framework/__init__.py
  84. 0
      test/functional/test_framework/address.py
  85. 0
      test/functional/test_framework/authproxy.py
  86. 0
      test/functional/test_framework/bignum.py
  87. 0
      test/functional/test_framework/blockstore.py
  88. 0
      test/functional/test_framework/blocktools.py
  89. 0
      test/functional/test_framework/comptool.py
  90. 0
      test/functional/test_framework/coverage.py
  91. 0
      test/functional/test_framework/key.py
  92. 0
      test/functional/test_framework/mininode.py
  93. 0
      test/functional/test_framework/netutil.py
  94. 0
      test/functional/test_framework/script.py
  95. 0
      test/functional/test_framework/siphash.py
  96. 0
      test/functional/test_framework/socks5.py
  97. 0
      test/functional/test_framework/test_framework.py
  98. 0
      test/functional/test_framework/util.py
  99. 37
      test/functional/test_runner.py
  100. 0
      test/functional/txn_clone.py
  101. Some files were not shown because too many files have changed in this diff Show More

6
.gitignore vendored

@ -101,9 +101,9 @@ coverage_percent.txt @@ -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

2
.travis.yml

@ -70,7 +70,7 @@ script: @@ -70,7 +70,7 @@ script:
- make $MAKEJOBS $GOAL || ( echo "Build failure. Verbose build follows." && make $GOAL V=1 ; false )
- export LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/depends/$HOST/lib
- if [ "$RUN_TESTS" = "true" ]; then make $MAKEJOBS check VERBOSE=1; fi
- if [ "$RUN_TESTS" = "true" ]; then qa/pull-tester/rpc-tests.py --coverage; fi
- if [ "$RUN_TESTS" = "true" ]; then test/functional/test_runner.py --coverage; fi
after_script:
- echo $TRAVIS_COMMIT_RANGE
- echo $TRAVIS_COMMIT_LOG

76
Makefile.am

@ -61,7 +61,7 @@ OSX_PACKAGING = $(OSX_DEPLOY_SCRIPT) $(OSX_FANCY_PLIST) $(OSX_INSTALLER_ICONS) \ @@ -61,7 +61,7 @@ OSX_PACKAGING = $(OSX_DEPLOY_SCRIPT) $(OSX_FANCY_PLIST) $(OSX_INSTALLER_ICONS) \
COVERAGE_INFO = baseline_filtered_combined.info baseline.info \
leveldb_baseline.info test_bitcoin_filtered.info total_coverage.info \
baseline_filtered.info rpc_test.info rpc_test_filtered.info \
baseline_filtered.info functional_test.info functional_test_filtered.info \
leveldb_baseline_filtered.info test_bitcoin_coverage.info test_bitcoin.info
dist-hook:
@ -194,20 +194,20 @@ test_bitcoin.info: baseline_filtered_combined.info @@ -194,20 +194,20 @@ test_bitcoin.info: baseline_filtered_combined.info
test_bitcoin_filtered.info: test_bitcoin.info
$(LCOV) -r $< "/usr/include/*" -o $@
rpc_test.info: test_bitcoin_filtered.info
-@TIMEOUT=15 python qa/pull-tester/rpc-tests.py $(EXTENDED_RPC_TESTS)
$(LCOV) -c -d $(abs_builddir)/src --t rpc-tests -o $@
functional_test.info: test_bitcoin_filtered.info
-@TIMEOUT=15 python test/functional/test_runner.py $(EXTENDED_FUNCTIONAL_TESTS)
$(LCOV) -c -d $(abs_builddir)/src --t functional-tests -o $@
$(LCOV) -z -d $(abs_builddir)/src
$(LCOV) -z -d $(abs_builddir)/src/leveldb
rpc_test_filtered.info: rpc_test.info
functional_test_filtered.info: functional_test.info
$(LCOV) -r $< "/usr/include/*" -o $@
test_bitcoin_coverage.info: baseline_filtered_combined.info test_bitcoin_filtered.info
$(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a test_bitcoin_filtered.info -o $@
total_coverage.info: baseline_filtered_combined.info test_bitcoin_filtered.info rpc_test_filtered.info
$(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a test_bitcoin_filtered.info -a rpc_test_filtered.info -o $@ | $(GREP) "\%" | $(AWK) '{ print substr($$3,2,50) "/" $$5 }' > coverage_percent.txt
total_coverage.info: baseline_filtered_combined.info test_bitcoin_filtered.info functional_test_filtered.info
$(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a test_bitcoin_filtered.info -a functional_test_filtered.info -o $@ | $(GREP) "\%" | $(AWK) '{ print substr($$3,2,50) "/" $$5 }' > coverage_percent.txt
test_bitcoin.coverage/.dirstamp: test_bitcoin_coverage.info
$(GENHTML) -s $< -o $(@D)
@ -223,14 +223,70 @@ endif @@ -223,14 +223,70 @@ endif
dist_noinst_SCRIPTS = autogen.sh
EXTRA_DIST = $(top_srcdir)/share/genbuild.sh qa/pull-tester/rpc-tests.py qa/rpc-tests $(DIST_CONTRIB) $(DIST_DOCS) $(WINDOWS_PACKAGING) $(OSX_PACKAGING) $(BIN_CHECKS)
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
clean-local:
rm -rf coverage_percent.txt test_bitcoin.coverage/ total.coverage/ qa/tmp/ cache/ $(OSX_APP)
rm -rf qa/pull-tester/__pycache__
rm -rf coverage_percent.txt test_bitcoin.coverage/ total.coverage/ test/tmp/ cache/ $(OSX_APP)
rm -rf test/functional/__pycache__

4
README.md

@ -54,9 +54,9 @@ submit new unit tests for old code. Unit tests can be compiled and run @@ -54,9 +54,9 @@ submit new unit tests for old code. Unit tests can be compiled and run
(assuming they weren't disabled in configure) with: `make check`. Further details on running
and extending unit tests can be found in [/src/test/README.md](/src/test/README.md).
There are also [regression and integration tests](/qa) of the RPC interface, written
There are also [regression and integration tests](/test), written
in Python, that are run automatically on the build server.
These tests can be run (if the [test dependencies](/qa) are installed) with: `qa/pull-tester/rpc-tests.py`
These tests can be run (if the [test dependencies](/test) are installed) with: `test/functional/test_runner.py`
The Travis CI system makes sure that every pull request is built for Windows, Linux, and OS X, and that unit/sanity tests are run automatically.

24
configure.ac

@ -124,10 +124,10 @@ AC_ARG_ENABLE(bench, @@ -124,10 +124,10 @@ AC_ARG_ENABLE(bench,
[use_bench=$enableval],
[use_bench=yes])
AC_ARG_ENABLE([extended-rpc-tests],
AS_HELP_STRING([--enable-extended-rpc-tests],[enable expensive RPC tests when using lcov (default no)]),
[use_extended_rpc_tests=$enableval],
[use_extended_rpc_tests=no])
AC_ARG_ENABLE([extended-functional-tests],
AS_HELP_STRING([--enable-extended-functional-tests],[enable expensive functional tests when using lcov (default no)]),
[use_extended_functional_tests=$enableval],
[use_extended_functional_tests=no])
AC_ARG_WITH([qrencode],
[AS_HELP_STRING([--with-qrencode],
@ -414,8 +414,8 @@ if test x$use_pkgconfig = xyes; then @@ -414,8 +414,8 @@ if test x$use_pkgconfig = xyes; then
])
fi
if test x$use_extended_rpc_tests != xno; then
AC_SUBST(EXTENDED_RPC_TESTS, -extended)
if test x$use_extended_functional_tests != xno; then
AC_SUBST(EXTENDED_FUNCTIONAL_TESTS, --extended)
fi
if test x$use_lcov = xyes; then
@ -1147,10 +1147,12 @@ AC_SUBST(EVENT_PTHREADS_LIBS) @@ -1147,10 +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])
AC_CONFIG_FILES([qa/pull-tester/tests_config.ini],[chmod +x qa/pull-tester/tests_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([qa/pull-tester/rpc-tests.py:qa/pull-tester/rpc-tests.py])
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.
@ -1198,8 +1200,8 @@ esac @@ -1198,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:/' qa/pull-tester/tests_config.py > qa/pull-tester/tests_config-2.py
mv qa/pull-tester/tests_config-2.py qa/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

2
contrib/devtools/copyright_header.py

@ -32,7 +32,7 @@ EXCLUDE = [ @@ -32,7 +32,7 @@ EXCLUDE = [
'src/tinyformat.h',
'src/leveldb/util/env_win.cc',
'src/crypto/ctaes/bench.c',
'qa/rpc-tests/test_framework/bignum.py',
'test/functional/test_framework/bignum.py',
# python init:
'*__init__.py',
]

6
contrib/rpm/bitcoin.spec

@ -311,10 +311,8 @@ rm -f %{buildroot}%{_bindir}/test_* @@ -311,10 +311,8 @@ rm -f %{buildroot}%{_bindir}/test_*
%check
make check
pushd src
srcdir=. test/bitcoin-util-test.py
popd
qa/pull-tester/rpc-tests.py -extended
srcdir=src test/bitcoin-util-test.py
test/functional/test_runner.py --extended
%post libs -p /sbin/ldconfig

4
doc/developer-notes.md

@ -132,7 +132,7 @@ Run with the -testnet option to run with "play bitcoins" on the test network, if @@ -132,7 +132,7 @@ Run with the -testnet option to run with "play bitcoins" on the test network, if
are testing multi-machine code that needs to operate across the internet.
If you are testing something that can run on one machine, run with the -regtest option.
In regression test mode, blocks can be created on-demand; see qa/rpc-tests/ for tests
In regression test mode, blocks can be created on-demand; see test/functional/ for tests
that run in -regtest mode.
**DEBUG_LOCKORDER**
@ -252,7 +252,7 @@ Wallet @@ -252,7 +252,7 @@ Wallet
- *Rationale*: In RPC code that conditionally uses the wallet (such as
`validateaddress`) it is easy to forget that global pointer `pwalletMain`
can be NULL. See `qa/rpc-tests/disablewallet.py` for functional tests
can be NULL. See `test/functional/disablewallet.py` for functional tests
exercising the API with `-disablewallet`
- Include `db_cxx.h` (BerkeleyDB header) only when `ENABLE_WALLET` is set

87
qa/README.md

@ -1,87 +0,0 @@ @@ -1,87 +0,0 @@
The [pull-tester](/qa/pull-tester/) folder contains a script to call
multiple tests from the [rpc-tests](/qa/rpc-tests/) folder.
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.
Test dependencies
=================
Before running the tests, the following must be installed.
Unix
----
The python3-zmq library is required. On Ubuntu or Debian it can be installed via:
```
sudo apt-get install python3-zmq
```
OS X
------
```
pip3 install pyzmq
```
Running tests
=============
You can run any single test by calling
qa/pull-tester/rpc-tests.py <testname>
Or you can run any combination of tests by calling
qa/pull-tester/rpc-tests.py <testname1> <testname2> <testname3> ...
Run the regression test suite with
qa/pull-tester/rpc-tests.py
Run all possible tests with
qa/pull-tester/rpc-tests.py --extended
By default, tests will be run in parallel. To specify how many jobs to run,
append `--jobs=n` (default n=4).
If you want to create a basic coverage report for the RPC test suite, append `--coverage`.
Possible options, which apply to each individual test run:
```
-h, --help show this help message and exit
--nocleanup Leave bitcoinds and test.* datadir on exit or error
--noshutdown Don't stop bitcoinds after the test execution
--srcdir=SRCDIR Source directory containing bitcoind/bitcoin-cli
(default: ../../src)
--tmpdir=TMPDIR Root directory for datadirs
--tracerpc Print out all RPC calls as they are made
--coveragedir=COVERAGEDIR
Write tested RPC commands into this directory
```
If you set the environment variable `PYTHON_DEBUG=1` you will get some debug
output (example: `PYTHON_DEBUG=1 qa/pull-tester/rpc-tests.py wallet`).
A 200-block -regtest blockchain and wallets for four nodes
is created the first time a regression test is run and
is stored in the cache/ directory. Each node has 25 mature
blocks (25*50=1250 BTC) in its wallet.
After the first run, the cache/ blockchain and wallets are
copied into a temporary directory and used as the initial
test state.
If you get into a bad state, you should be able
to recover with:
```bash
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 RPC
tests is found in [qa/rpc-tests](/qa/rpc-tests).

61
src/Makefile.test.include

@ -8,60 +8,6 @@ noinst_PROGRAMS += test/test_bitcoin_fuzzy @@ -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) @@ -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 @@ -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

9
src/test/README.md

@ -50,12 +50,3 @@ examine `uint256_tests.cpp`. @@ -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]
```

45
src/test/bitcoin-util-test.py

@ -1,45 +0,0 @@ @@ -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)

2
src/test/buildenv.py.in

@ -1,2 +0,0 @@ @@ -1,2 +0,0 @@
#!/usr/bin/env python
exeext="@EXEEXT@"

97
test/README.md

@ -0,0 +1,97 @@ @@ -0,0 +1,97 @@
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.
There are currently two sets of tests in this directory:
- [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.
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.
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 locally
=====================
Functional tests
----------------
You can run any single test by calling
test/functional/test_runner.py <testname>
Or you can run any combination of tests by calling
test/functional/test_runner.py <testname1> <testname2> <testname3> ...
Run the regression test suite with
test/functional/test_runner.py
Run all possible tests with
test/functional/test_runner.py --extended
By default, tests will be run in parallel. To specify how many jobs to run,
append `--jobs=n` (default n=4).
If you want to create a basic coverage report for the RPC test suite, append `--coverage`.
Possible options, which apply to each individual test run:
```
-h, --help show this help message and exit
--nocleanup Leave bitcoinds and test.* datadir on exit or error
--noshutdown Don't stop bitcoinds after the test execution
--srcdir=SRCDIR Source directory containing bitcoind/bitcoin-cli
(default: ../../src)
--tmpdir=TMPDIR Root directory for datadirs
--tracerpc Print out all RPC calls as they are made
--coveragedir=COVERAGEDIR
Write tested RPC commands into this directory
```
If you set the environment variable `PYTHON_DEBUG=1` you will get some debug
output (example: `PYTHON_DEBUG=1 test/functional/test_runner.py wallet`).
A 200-block -regtest blockchain and wallets for four nodes
is created the first time a regression test is run and
is stored in the cache/ directory. Each node has 25 mature
blocks (25*50=1250 BTC) in its wallet.
After the first run, the cache/ blockchain and wallets are
copied into a temporary directory and used as the initial
test state.
If you get into a bad state, you should be able
to recover with:
```bash
rm -rf cache
killall bitcoind
```
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).

0
qa/rpc-tests/.gitignore → test/functional/.gitignore vendored

0
qa/rpc-tests/README.md → test/functional/README.md

0
qa/rpc-tests/abandonconflict.py → test/functional/abandonconflict.py

0
qa/rpc-tests/assumevalid.py → test/functional/assumevalid.py

0
qa/rpc-tests/bip65-cltv-p2p.py → test/functional/bip65-cltv-p2p.py

0
qa/rpc-tests/bip65-cltv.py → test/functional/bip65-cltv.py

0
qa/rpc-tests/bip68-112-113-p2p.py → test/functional/bip68-112-113-p2p.py

0
qa/rpc-tests/bip68-sequence.py → test/functional/bip68-sequence.py

0
qa/rpc-tests/bip9-softforks.py → test/functional/bip9-softforks.py

0
qa/rpc-tests/bipdersig-p2p.py → test/functional/bipdersig-p2p.py

0
qa/rpc-tests/bipdersig.py → test/functional/bipdersig.py

0
qa/rpc-tests/blockchain.py → test/functional/blockchain.py

0
qa/rpc-tests/bumpfee.py → test/functional/bumpfee.py

2
qa/pull-tester/tests_config.ini.in → test/functional/config.ini.in

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# These environment variables are set by the build process and read by
# rpc-tests.py
# test/functional/test_runner.py
[environment]
SRCDIR=@abs_top_srcdir@

2
qa/rpc-tests/create_cache.py → test/functional/create_cache.py

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
"""Create a blockchain cache.
Creating a cache of the blockchain speeds up test execution when running
multiple qa tests. This helper script is executed by rpc-tests when multiple
multiple functional tests. This helper script is executed by test_runner when multiple
tests are being run in parallel.
"""

0
qa/rpc-tests/decodescript.py → test/functional/decodescript.py

0
qa/rpc-tests/disablewallet.py → test/functional/disablewallet.py

0
qa/rpc-tests/forknotify.py → test/functional/forknotify.py

0
qa/rpc-tests/fundrawtransaction.py → test/functional/fundrawtransaction.py

0
qa/rpc-tests/getblocktemplate_longpoll.py → test/functional/getblocktemplate_longpoll.py

0
qa/rpc-tests/getblocktemplate_proposals.py → test/functional/getblocktemplate_proposals.py

0
qa/rpc-tests/getchaintips.py → test/functional/getchaintips.py

0
qa/rpc-tests/httpbasics.py → test/functional/httpbasics.py

0
qa/rpc-tests/import-rescan.py → test/functional/import-rescan.py

0
qa/rpc-tests/importmulti.py → test/functional/importmulti.py

0
qa/rpc-tests/importprunedfunds.py → test/functional/importprunedfunds.py

0
qa/rpc-tests/invalidateblock.py → test/functional/invalidateblock.py

0
qa/rpc-tests/invalidblockrequest.py → test/functional/invalidblockrequest.py

0
qa/rpc-tests/invalidtxrequest.py → test/functional/invalidtxrequest.py

0
qa/rpc-tests/keypool.py → test/functional/keypool.py

0
qa/rpc-tests/listsinceblock.py → test/functional/listsinceblock.py

0
qa/rpc-tests/listtransactions.py → test/functional/listtransactions.py

0
qa/rpc-tests/maxblocksinflight.py → test/functional/maxblocksinflight.py

0
qa/rpc-tests/maxuploadtarget.py → test/functional/maxuploadtarget.py

0
qa/rpc-tests/mempool_limit.py → test/functional/mempool_limit.py

0
qa/rpc-tests/mempool_packages.py → test/functional/mempool_packages.py

0
qa/rpc-tests/mempool_reorg.py → test/functional/mempool_reorg.py

0
qa/rpc-tests/mempool_resurrect_test.py → test/functional/mempool_resurrect_test.py

0
qa/rpc-tests/mempool_spendcoinbase.py → test/functional/mempool_spendcoinbase.py

0
qa/rpc-tests/merkle_blocks.py → test/functional/merkle_blocks.py

0
qa/rpc-tests/multi_rpc.py → test/functional/multi_rpc.py

0
qa/rpc-tests/nodehandling.py → test/functional/nodehandling.py

0
qa/rpc-tests/nulldummy.py → test/functional/nulldummy.py

0
qa/rpc-tests/p2p-acceptblock.py → test/functional/p2p-acceptblock.py

0
qa/rpc-tests/p2p-compactblocks.py → test/functional/p2p-compactblocks.py

0
qa/rpc-tests/p2p-feefilter.py → test/functional/p2p-feefilter.py

0
qa/rpc-tests/p2p-fullblocktest.py → test/functional/p2p-fullblocktest.py

0
qa/rpc-tests/p2p-leaktests.py → test/functional/p2p-leaktests.py

0
qa/rpc-tests/p2p-mempool.py → test/functional/p2p-mempool.py

0
qa/rpc-tests/p2p-segwit.py → test/functional/p2p-segwit.py

0
qa/rpc-tests/p2p-timeouts.py → test/functional/p2p-timeouts.py

0
qa/rpc-tests/p2p-versionbits-warning.py → test/functional/p2p-versionbits-warning.py

0
qa/rpc-tests/preciousblock.py → test/functional/preciousblock.py

0
qa/rpc-tests/prioritise_transaction.py → test/functional/prioritise_transaction.py

0
qa/rpc-tests/proxy_test.py → test/functional/proxy_test.py

0
qa/rpc-tests/pruning.py → test/functional/pruning.py

0
qa/rpc-tests/rawtransactions.py → test/functional/rawtransactions.py

0
qa/rpc-tests/receivedby.py → test/functional/receivedby.py

0
qa/rpc-tests/reindex.py → test/functional/reindex.py

0
qa/rpc-tests/replace-by-fee.py → test/functional/replace-by-fee.py

0
qa/rpc-tests/rest.py → test/functional/rest.py

0
qa/rpc-tests/rpcbind_test.py → test/functional/rpcbind_test.py

0
qa/rpc-tests/rpcnamedargs.py → test/functional/rpcnamedargs.py

0
qa/rpc-tests/segwit.py → test/functional/segwit.py

0
qa/rpc-tests/sendheaders.py → test/functional/sendheaders.py

0
qa/rpc-tests/signmessages.py → test/functional/signmessages.py

0
qa/rpc-tests/signrawtransactions.py → test/functional/signrawtransactions.py

0
qa/rpc-tests/smartfees.py → test/functional/smartfees.py

0
qa/rpc-tests/test_framework/__init__.py → test/functional/test_framework/__init__.py

0
qa/rpc-tests/test_framework/address.py → test/functional/test_framework/address.py

0
qa/rpc-tests/test_framework/authproxy.py → test/functional/test_framework/authproxy.py

0
qa/rpc-tests/test_framework/bignum.py → test/functional/test_framework/bignum.py

0
qa/rpc-tests/test_framework/blockstore.py → test/functional/test_framework/blockstore.py

0
qa/rpc-tests/test_framework/blocktools.py → test/functional/test_framework/blocktools.py

0
qa/rpc-tests/test_framework/comptool.py → test/functional/test_framework/comptool.py

0
qa/rpc-tests/test_framework/coverage.py → test/functional/test_framework/coverage.py

0
qa/rpc-tests/test_framework/key.py → test/functional/test_framework/key.py

0
qa/rpc-tests/test_framework/mininode.py → test/functional/test_framework/mininode.py

0
qa/rpc-tests/test_framework/netutil.py → test/functional/test_framework/netutil.py

0
qa/rpc-tests/test_framework/script.py → test/functional/test_framework/script.py

0
qa/rpc-tests/test_framework/siphash.py → test/functional/test_framework/siphash.py

0
qa/rpc-tests/test_framework/socks5.py → test/functional/test_framework/socks5.py

0
qa/rpc-tests/test_framework/test_framework.py → test/functional/test_framework/test_framework.py

0
qa/rpc-tests/test_framework/util.py → test/functional/test_framework/util.py

37
qa/pull-tester/rpc-tests.py → test/functional/test_runner.py

@ -2,16 +2,15 @@ @@ -2,16 +2,15 @@
# Copyright (c) 2014-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.
"""
rpc-tests.py - run regression test suite
"""Run regression test suite.
This module calls down into individual test cases via subprocess. It will
forward all unrecognized arguments onto the individual test scripts.
RPC tests are disabled on Windows by default. Use --force to run them anyway.
Functional tests are disabled on Windows by default. Use --force to run them anyway.
For a description of arguments recognized by test scripts, see
`qa/pull-tester/test_framework/test_framework.py:BitcoinTestFramework.main`.
`test/functional/test_framework/test_framework.py:BitcoinTestFramework.main`.
"""
@ -87,7 +86,7 @@ BASE_SCRIPTS= [ @@ -87,7 +86,7 @@ BASE_SCRIPTS= [
ZMQ_SCRIPTS = [
# ZMQ test can only be run if bitcoin was built with zmq-enabled.
# call rpc_tests.py with -nozmq to explicitly exclude these tests.
# call test_runner.py with -nozmq to explicitly exclude these tests.
"zmq_test.py"]
EXTENDED_SCRIPTS = [
@ -127,7 +126,7 @@ ALL_SCRIPTS = BASE_SCRIPTS + ZMQ_SCRIPTS + EXTENDED_SCRIPTS @@ -127,7 +126,7 @@ ALL_SCRIPTS = BASE_SCRIPTS + ZMQ_SCRIPTS + EXTENDED_SCRIPTS
def main():
# Parse arguments and pass through unrecognised args
parser = argparse.ArgumentParser(add_help=False,
usage='%(prog)s [rpc-test.py options] [script options] [scripts]',
usage='%(prog)s [test_runner.py options] [script options] [scripts]',
description=__doc__,
epilog='''
Help text and arguments for individual test script:''',
@ -147,7 +146,7 @@ def main(): @@ -147,7 +146,7 @@ def main():
# Read config generated by configure.
config = configparser.ConfigParser()
config.read_file(open(os.path.dirname(__file__) + "/tests_config.ini"))
config.read_file(open(os.path.dirname(__file__) + "/config.ini"))
enable_wallet = config["components"].getboolean("ENABLE_WALLET")
enable_utils = config["components"].getboolean("ENABLE_UTILS")
@ -161,7 +160,7 @@ def main(): @@ -161,7 +160,7 @@ def main():
sys.exit(0)
if not (enable_wallet and enable_utils and enable_bitcoind):
print("No rpc tests to run. Wallet, utils, and bitcoind must all be enabled")
print("No functional tests to run. Wallet, utils, and bitcoind must all be enabled")
print("Rerun `configure` with -enable-wallet, -with-utils and -with-daemon and rerun make")
sys.exit(0)
@ -171,7 +170,7 @@ def main(): @@ -171,7 +170,7 @@ def main():
import zmq
except ImportError:
print("ERROR: \"import zmq\" failed. Use -nozmq to run without the ZMQ tests."
"To run zmq tests, see dependency info in /qa/README.md.")
"To run zmq tests, see dependency info in /test/README.md.")
raise
# Build list of tests
@ -200,13 +199,13 @@ def main(): @@ -200,13 +199,13 @@ def main():
if not test_list:
print("No valid test scripts specified. Check that your test is in one "
"of the test lists in rpc-tests.py, or run rpc-tests.py with no arguments to run all tests")
"of the test lists in test_runner.py, or run test_runner.py with no arguments to run all tests")
sys.exit(0)
if args.help:
# Print help for rpc-tests.py, then print help of the first script and exit.
# Print help for test_runner.py, then print help of the first script and exit.
parser.print_help()
subprocess.check_call((config["environment"]["SRCDIR"] + '/qa/rpc-tests/' + test_list[0]).split() + ['-h'])
subprocess.check_call((config["environment"]["SRCDIR"] + '/test/functional/' + test_list[0]).split() + ['-h'])
sys.exit(0)
run_tests(test_list, config["environment"]["SRCDIR"], config["environment"]["BUILDDIR"], config["environment"]["EXEEXT"], args.jobs, args.coverage, passon_args)
@ -222,10 +221,10 @@ def run_tests(test_list, src_dir, build_dir, exeext, jobs=1, enable_coverage=Fal @@ -222,10 +221,10 @@ def run_tests(test_list, src_dir, build_dir, exeext, jobs=1, enable_coverage=Fal
if "BITCOIND" not in os.environ:
os.environ["BITCOIND"] = build_dir + '/src/bitcoind' + exeext
tests_dir = src_dir + '/qa/rpc-tests/'
tests_dir = src_dir + '/test/functional/'
flags = ["--srcdir={}/src".format(build_dir)] + args
flags.append("--cachedir=%s/qa/cache" % build_dir)
flags.append("--cachedir=%s/test/cache" % build_dir)
if enable_coverage:
coverage = RPCCoverage()
@ -243,7 +242,7 @@ def run_tests(test_list, src_dir, build_dir, exeext, jobs=1, enable_coverage=Fal @@ -243,7 +242,7 @@ def run_tests(test_list, src_dir, build_dir, exeext, jobs=1, enable_coverage=Fal
time_sum = 0
time0 = time.time()
job_queue = RPCTestHandler(jobs, tests_dir, test_list, flags)
job_queue = TestHandler(jobs, tests_dir, test_list, flags)
max_len_name = len(max(test_list, key=len))
results = BOLD[1] + "%s | %s | %s\n\n" % ("TEST".ljust(max_len_name), "PASSED", "DURATION") + BOLD[0]
@ -271,7 +270,7 @@ def run_tests(test_list, src_dir, build_dir, exeext, jobs=1, enable_coverage=Fal @@ -271,7 +270,7 @@ def run_tests(test_list, src_dir, build_dir, exeext, jobs=1, enable_coverage=Fal
sys.exit(not all_passed)
class RPCTestHandler:
class TestHandler:
"""
Trigger the testscrips passed in via the list.
"""
@ -325,7 +324,7 @@ class RPCTestHandler: @@ -325,7 +324,7 @@ class RPCTestHandler:
class RPCCoverage(object):
"""
Coverage reporting utilities for pull-tester.
Coverage reporting utilities for test_runner.
Coverage calculation works by having each test script subprocess write
coverage files into a particular directory. These files contain the RPC
@ -335,7 +334,7 @@ class RPCCoverage(object): @@ -335,7 +334,7 @@ class RPCCoverage(object):
After all tests complete, the commands run are combined and diff'd against
the complete list to calculate uncovered RPC commands.
See also: qa/rpc-tests/test_framework/coverage.py
See also: test/functional/test_framework/coverage.py
"""
def __init__(self):
@ -363,7 +362,7 @@ class RPCCoverage(object): @@ -363,7 +362,7 @@ class RPCCoverage(object):
Return a set of currently untested RPC commands.
"""
# This is shared from `qa/rpc-tests/test-framework/coverage.py`
# This is shared from `test/functional/test-framework/coverage.py`
reference_filename = 'rpc_interface.txt'
coverage_file_prefix = 'coverage.'

0
qa/rpc-tests/txn_clone.py → test/functional/txn_clone.py

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save