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

2
.gitignore vendored
View File

@ -80,7 +80,6 @@ Bitcoin-Qt.app
# Unit-tests # Unit-tests
Makefile.test Makefile.test
bitcoin-qt_test bitcoin-qt_test
src/test/buildenv.py
# Resources cpp # Resources cpp
qrc_*.cpp qrc_*.cpp
@ -102,7 +101,6 @@ linux-coverage-build
linux-build linux-build
win32-build win32-build
test/functional/config.ini test/functional/config.ini
test/util/buildenv.py
test/cache/* test/cache/*
!src/leveldb*/Makefile !src/leveldb*/Makefile

View File

@ -277,9 +277,6 @@ EXTRA_DIST += \
CLEANFILES = $(OSX_DMG) $(BITCOIN_WIN_INSTALLER) 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) .INTERMEDIATE: $(COVERAGE_INFO)
DISTCHECK_CONFIGURE_FLAGS = --enable-man DISTCHECK_CONFIGURE_FLAGS = --enable-man

View File

@ -1160,8 +1160,7 @@ AC_SUBST(EVENT_PTHREADS_LIBS)
AC_SUBST(ZMQ_LIBS) AC_SUBST(ZMQ_LIBS)
AC_SUBST(PROTOBUF_LIBS) AC_SUBST(PROTOBUF_LIBS)
AC_SUBST(QR_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([Makefile src/Makefile doc/man/Makefile share/setup.nsi share/qt/Info.plist test/functional/config.ini test/util/config.ini])
AC_CONFIG_FILES([test/util/buildenv.py],[chmod +x test/util/buildenv.py])
AC_CONFIG_FILES([contrib/devtools/split-debug.sh],[chmod +x contrib/devtools/split-debug.sh]) AC_CONFIG_FILES([contrib/devtools/split-debug.sh],[chmod +x contrib/devtools/split-debug.sh])
AC_CONFIG_FILES([doc/Doxyfile]) AC_CONFIG_FILES([doc/Doxyfile])
AC_CONFIG_LINKS([test/functional/test_runner.py:test/functional/test_runner.py]) AC_CONFIG_LINKS([test/functional/test_runner.py:test/functional/test_runner.py])

View File

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