dogecoin/test/util/bitcoin-util-test.py
John Newbery 95836c5eba Use shared config file for functional and util tests
The functional tests and util tests both require a config file that is
generated by ./configure. This commit merges those two config
files into a single configuration file that can be shared by both tests.

The config from config.ini is put into a Namespace object to maintain
the interface with bctest.py. A future commit could change this
interface to use a dictionary instead of a namespace.
2017-05-03 14:18:30 -04:00

43 lines
1.4 KiB
Python
Executable file

#!/usr/bin/env python3
# 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.
"""Test framework for bitcoin utils.
Runs automatically during `make check`.
Can also be run manually."""
import configparser
import os
import sys
import argparse
import logging
if __name__ == '__main__':
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import bctest
config = configparser.ConfigParser()
config.read_file(open(os.path.dirname(__file__) + "/../config.ini"))
buildenv = argparse.Namespace(exeext=config["environment"]["EXEEXT"],
SRCDIR=config["environment"]["SRCDIR"],
BUILDDIR=config["environment"]["BUILDDIR"])
parser = argparse.ArgumentParser(description=__doc__)
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)