Use an .ini config file for environment vars in bitcoin-util-test.py

This commit is contained in:
John Newbery
2017-03-21 14:38:09 -04:00
parent e9265df15b
commit 89fcd3586c
6 changed files with 20 additions and 12 deletions

View File

@@ -9,6 +9,7 @@ Runs automatically during `make check`.
Can also be run manually."""
import configparser
import os
import sys
import argparse
@@ -16,9 +17,15 @@ import logging
if __name__ == '__main__':
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import buildenv
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()

View File

@@ -1,4 +0,0 @@
#!/usr/bin/env python
exeext="@EXEEXT@"
SRCDIR="@abs_top_srcdir@"
BUILDDIR="@abs_top_builddir@"

11
test/util/config.ini.in Normal file
View File

@@ -0,0 +1,11 @@
# Copyright (c) 2013-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# These environment variables are set by the build process and read by
# test/util/bitcoin-util-test.py
[environment]
SRCDIR=@abs_top_srcdir@
BUILDDIR=@abs_top_builddir@
EXEEXT=@EXEEXT@