Browse Source
0.1563d66ba
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
MarcoFalke
8 years ago
160 changed files with 252 additions and 260 deletions
@ -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). |
|
@ -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) |
|
@ -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). |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue