aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2017-03-21 14:38:09 -0400
committerJohn Newbery <john@johnnewbery.com>2017-05-03 14:18:14 -0400
commit89fcd3586c9714a923b6a3147f60e43d5de74942 (patch)
tree4cf324feafd10daecd38edee3860a4c62f40b334
parente9265df15b04178b40ab3bacfe6a944f0fb9ad27 (diff)
Use an .ini config file for environment vars in bitcoin-util-test.py
-rw-r--r--.gitignore2
-rw-r--r--Makefile.am3
-rw-r--r--configure.ac3
-rwxr-xr-xtest/util/bitcoin-util-test.py9
-rw-r--r--test/util/buildenv.py.in4
-rw-r--r--test/util/config.ini.in11
6 files changed, 20 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore
index f1e9ca20c1..aa37e381e2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -80,7 +80,6 @@ Bitcoin-Qt.app
# Unit-tests
Makefile.test
bitcoin-qt_test
-src/test/buildenv.py
# Resources cpp
qrc_*.cpp
@@ -102,7 +101,6 @@ linux-coverage-build
linux-build
win32-build
test/functional/config.ini
-test/util/buildenv.py
test/cache/*
!src/leveldb*/Makefile
diff --git a/Makefile.am b/Makefile.am
index 3a56eea0c0..b0ba0c8504 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -277,9 +277,6 @@ EXTRA_DIST += \
CLEANFILES = $(OSX_DMG) $(BITCOIN_WIN_INSTALLER)
-# This file is problematic for out-of-tree builds if it exists.
-DISTCLEANFILES = test/util/buildenv.pyc
-
.INTERMEDIATE: $(COVERAGE_INFO)
DISTCHECK_CONFIGURE_FLAGS = --enable-man
diff --git a/configure.ac b/configure.ac
index 3672700488..26a9d082c6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1160,8 +1160,7 @@ AC_SUBST(EVENT_PTHREADS_LIBS)
AC_SUBST(ZMQ_LIBS)
AC_SUBST(PROTOBUF_LIBS)
AC_SUBST(QR_LIBS)
-AC_CONFIG_FILES([Makefile src/Makefile doc/man/Makefile share/setup.nsi share/qt/Info.plist test/functional/config.ini])
-AC_CONFIG_FILES([test/util/buildenv.py],[chmod +x test/util/buildenv.py])
+AC_CONFIG_FILES([Makefile src/Makefile doc/man/Makefile share/setup.nsi share/qt/Info.plist test/functional/config.ini test/util/config.ini])
AC_CONFIG_FILES([contrib/devtools/split-debug.sh],[chmod +x contrib/devtools/split-debug.sh])
AC_CONFIG_FILES([doc/Doxyfile])
AC_CONFIG_LINKS([test/functional/test_runner.py:test/functional/test_runner.py])
diff --git a/test/util/bitcoin-util-test.py b/test/util/bitcoin-util-test.py
index 0c67663edb..f85bd13f93 100755
--- a/test/util/bitcoin-util-test.py
+++ b/test/util/bitcoin-util-test.py
@@ -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()
diff --git a/test/util/buildenv.py.in b/test/util/buildenv.py.in
deleted file mode 100644
index 33030b0348..0000000000
--- a/test/util/buildenv.py.in
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/env python
-exeext="@EXEEXT@"
-SRCDIR="@abs_top_srcdir@"
-BUILDDIR="@abs_top_builddir@"
diff --git a/test/util/config.ini.in b/test/util/config.ini.in
new file mode 100644
index 0000000000..a1f8f09cec
--- /dev/null
+++ b/test/util/config.ini.in
@@ -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@