aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-05-19 07:12:22 -0400
committerMarcoFalke <falke.marco@gmail.com>2020-05-21 07:47:46 -0400
commitfaf1c3cc58d14f86ba5364e6ee5c8ef29cac2e26 (patch)
tree12d2cf0b282c05027c0ae1cc5bd2d1ffe8ef1139 /test
parent25ad2c623af30056ffb36dcd203a52edda2b170f (diff)
downloadbitcoin-faf1c3cc58d14f86ba5364e6ee5c8ef29cac2e26.tar.xz
test: Replace TEST_PREVIOUS_RELEASES env var with test_framework option
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/test_framework/test_framework.py23
1 files changed, 10 insertions, 13 deletions
diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py
index 6126efd842..45bca63c94 100755
--- a/test/functional/test_framework/test_framework.py
+++ b/test/functional/test_framework/test_framework.py
@@ -140,6 +140,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
sys.exit(exit_code)
def parse_args(self):
+ previous_releases_path = os.getenv("PREVIOUS_RELEASES_DIR") or os.getcwd() + "/releases"
parser = argparse.ArgumentParser(usage="%(prog)s [options]")
parser.add_argument("--nocleanup", dest="nocleanup", default=False, action="store_true",
help="Leave bitcoinds and test.* datadir on exit or error")
@@ -154,6 +155,9 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
help="Print out all RPC calls as they are made")
parser.add_argument("--portseed", dest="port_seed", default=os.getpid(), type=int,
help="The seed to use for assigning port numbers (default: current process id)")
+ parser.add_argument("--previous-releases", dest="prev_releases", action="store_true",
+ default=os.path.isdir(previous_releases_path),
+ help="Force test of previous releases (default: %(default)s)")
parser.add_argument("--coveragedir", dest="coveragedir",
help="Write tested RPC commands into this directory")
parser.add_argument("--configfile", dest="configfile",
@@ -174,6 +178,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
parser.add_argument('--timeout-factor', dest="timeout_factor", type=float, default=1.0, help='adjust test timeouts by a factor. Setting it to 0 disables all timeouts')
self.add_options(parser)
self.options = parser.parse_args()
+ self.options.previous_releases_path = previous_releases_path
def setup(self):
"""Call this method to start up the test framework object with options set."""
@@ -190,18 +195,16 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
fname_bitcoind = os.path.join(
config["environment"]["BUILDDIR"],
"src",
- "bitcoind" + config["environment"]["EXEEXT"]
+ "bitcoind" + config["environment"]["EXEEXT"],
)
fname_bitcoincli = os.path.join(
config["environment"]["BUILDDIR"],
"src",
- "bitcoin-cli" + config["environment"]["EXEEXT"]
+ "bitcoin-cli" + config["environment"]["EXEEXT"],
)
self.options.bitcoind = os.getenv("BITCOIND", default=fname_bitcoind)
self.options.bitcoincli = os.getenv("BITCOINCLI", default=fname_bitcoincli)
- self.options.previous_releases_path = os.getenv("PREVIOUS_RELEASES_DIR") or os.getcwd() + "/releases"
-
os.environ['PATH'] = os.pathsep.join([
os.path.join(config['environment']['BUILDDIR'], 'src'),
os.path.join(config['environment']['BUILDDIR'], 'src', 'qt'), os.environ['PATH']
@@ -684,17 +687,11 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
def has_previous_releases(self):
"""Checks whether previous releases are present and enabled."""
- if os.getenv("TEST_PREVIOUS_RELEASES") == "false":
- # disabled
- return False
-
if not os.path.isdir(self.options.previous_releases_path):
- if os.getenv("TEST_PREVIOUS_RELEASES") == "true":
- raise AssertionError("TEST_PREVIOUS_RELEASES=true but releases missing: {}".format(
+ if self.options.prev_releases:
+ raise AssertionError("Force test of previous releases but releases missing: {}".format(
self.options.previous_releases_path))
- # missing
- return False
- return True
+ return self.options.prev_releases
def is_cli_compiled(self):
"""Checks whether bitcoin-cli was compiled."""