2 # Copyright 2014 BitPay Inc.
3 # Copyright 2016 The Bitcoin Core developers
4 # Distributed under the MIT software license, see the accompanying
5 # file COPYING or http://www.opensource.org/licenses/mit-license.php.
6 from __future__
import division
,print_function
,unicode_literals
13 help_text
="""Test framework for bitcoin utils.
15 Runs automatically during `make check`.
17 Can also be run manually from the src directory by specifying the source directory:
19 test/bitcoin-util-test.py --srcdir='srcdir' [--verbose]
22 if __name__
== '__main__':
23 # Try to get the source directory from the environment variables. This will
24 # be set for `make check` automated runs. If environment variable is not set,
25 # then get the source directory from command line args.
27 srcdir
= os
.environ
["srcdir"]
30 parser
= argparse
.ArgumentParser(description
=help_text
)
31 parser
.add_argument('-s', '--srcdir')
32 parser
.add_argument('-v', '--verbose', action
='store_true')
33 args
= parser
.parse_args()
35 verbose
= args
.verbose
41 formatter
= '%(asctime)s - %(levelname)s - %(message)s'
42 # Add the format/level to the logger
43 logging
.basicConfig(format
= formatter
, level
=level
)
45 bctest
.bctester(srcdir
+ "/test/data", "bitcoin-util-test.json", buildenv
)