Skip to content

Commit

Permalink
Merge #11433: qa: Restore bitcoin-util-test py2 compatibility
Browse files Browse the repository at this point in the history
fafff12 qa: Restore bitcoin-util-test py2 compatibility (MarcoFalke)

Pull request description:

  Currently `./configure && make check` will look for python3, then python2. As long as we support python2 (and use it as fallback), `make check` should run fine with both python2 and python3.

  Fixes #11352 by @Zenitur

Tree-SHA512: a335ebdd224328d6f924fe52a9b97de196926476c9ee04ce3280743ea93bcae355eb2d5d4bed4050c01b2e904105595eac7db2eaa9307207581caa0a98ebcc0b
  • Loading branch information
MarcoFalke committed Oct 3, 2017
2 parents dbc4ae0 + fafff12 commit b4a509a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Makefile.test.include
Expand Up @@ -149,7 +149,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
Expand Down
13 changes: 10 additions & 3 deletions test/util/bitcoin-util-test.py
Expand Up @@ -9,9 +9,14 @@
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
Expand All @@ -22,7 +27,9 @@

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')
Expand All @@ -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"""
Expand Down

0 comments on commit b4a509a

Please sign in to comment.