Merge #9578: Add missing mempool lock for CalculateMemPoolAncestors
[bitcoinplatinum.git] / src / test / bitcoin-util-test.py
blobe2087187aaba6a28f545435ead3935926da5007f
1 #!/usr/bin/env python
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
7 import os
8 import bctest
9 import buildenv
10 import argparse
11 import logging
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]
20 """
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.
26 try:
27 srcdir = os.environ["srcdir"]
28 verbose = False
29 except:
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()
34 srcdir = args.srcdir
35 verbose = args.verbose
37 if verbose:
38 level = logging.DEBUG
39 else:
40 level = logging.ERROR
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)