diff options
author | MarcoFalke <falke.marco@gmail.com> | 2017-10-01 11:19:49 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2017-10-04 11:59:33 +0200 |
commit | e169349f8c25d8998492b38500c1fee1074ed6fe (patch) | |
tree | 733117b510b3c09e2aa4cec8b73e7e7e2d4a1319 | |
parent | 806c78f014f6be9e12afb181d85e135f3b44e33e (diff) | |
download | bitcoin-e169349f8c25d8998492b38500c1fee1074ed6fe.tar.xz |
qa: Restore bitcoin-util-test py2 compatibility
Github-Pull: #11433
Rebased-From: fafff1220cf798e25f02cdd8affb70506dd366cc
-rw-r--r-- | src/Makefile.test.include | 2 | ||||
-rwxr-xr-x | test/util/bitcoin-util-test.py | 13 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/Makefile.test.include b/src/Makefile.test.include index 3a932f460d..b48bfc76b7 100644 --- a/src/Makefile.test.include +++ b/src/Makefile.test.include @@ -147,7 +147,7 @@ bitcoin_test_clean : FORCE check-local: @echo "Running test/util/bitcoin-util-test.py..." - $(top_builddir)/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 diff --git a/test/util/bitcoin-util-test.py b/test/util/bitcoin-util-test.py index d15d6a6011..ef34955d90 100755 --- a/test/util/bitcoin-util-test.py +++ b/test/util/bitcoin-util-test.py @@ -9,9 +9,14 @@ Runs automatically during `make check`. Can also be run manually.""" +from __future__ import division,print_function,unicode_literals + import argparse import binascii -import configparser +try: + import configparser +except ImportError: + import ConfigParser as configparser import difflib import json import logging @@ -22,7 +27,9 @@ import sys def main(): config = configparser.ConfigParser() - config.read_file(open(os.path.dirname(__file__) + "/../config.ini")) + config.optionxform = str + config.readfp(open(os.path.join(os.path.dirname(__file__), "../config.ini"))) + env_conf = dict(config.items('environment')) parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('-v', '--verbose', action='store_true') @@ -37,7 +44,7 @@ def main(): # Add the format/level to the logger logging.basicConfig(format=formatter, level=level) - bctester(config["environment"]["SRCDIR"] + "/test/util/data", "bitcoin-util-test.json", config["environment"]) + bctester(os.path.join(env_conf["SRCDIR"], "test/util/data"), "bitcoin-util-test.json", env_conf) def bctester(testDir, input_basename, buildenv): """ Loads and parses the input file, runs all tests and reports results""" |