Browse Source

Use shared config file for functional and util tests

The functional tests and util tests both require a config file that is
generated by ./configure. This commit merges those two config
files into a single configuration file that can be shared by both tests.

The config from config.ini is put into a Namespace object to maintain
the interface with bctest.py. A future commit could change this
interface to use a dictionary instead of a namespace.
0.15
John Newbery 8 years ago
parent
commit
95836c5eba
  1. 2
      .gitignore
  2. 6
      configure.ac
  3. 2
      test/config.ini.in
  4. 2
      test/functional/test_runner.py
  5. 2
      test/util/bitcoin-util-test.py
  6. 11
      test/util/config.ini.in

2
.gitignore vendored

@ -100,7 +100,7 @@ coverage_percent.txt
linux-coverage-build linux-coverage-build
linux-build linux-build
win32-build win32-build
test/functional/config.ini test/config.ini
test/cache/* test/cache/*
!src/leveldb*/Makefile !src/leveldb*/Makefile

6
configure.ac

@ -1160,7 +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 test/util/config.ini]) AC_CONFIG_FILES([Makefile src/Makefile doc/man/Makefile share/setup.nsi share/qt/Info.plist test/config.ini])
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])
@ -1213,8 +1213,8 @@ esac
dnl Replace the BUILDDIR path with the correct Windows path if compiling on Native Windows dnl Replace the BUILDDIR path with the correct Windows path if compiling on Native Windows
case ${OS} in case ${OS} in
*Windows*) *Windows*)
sed 's/BUILDDIR="\/\([[a-z]]\)/BUILDDIR="\1:/' test/functional/config.ini > test/functional/config-2.ini sed 's/BUILDDIR="\/\([[a-z]]\)/BUILDDIR="\1:/' test/config.ini > test/config-2.ini
mv test/functional/config-2.ini test/functional/config.ini mv test/config-2.ini test/config.ini
;; ;;
esac esac

2
test/functional/config.ini.in → test/config.ini.in

@ -3,7 +3,7 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
# These environment variables are set by the build process and read by # These environment variables are set by the build process and read by
# test/functional/test_runner.py # test/functional/test_runner.py and test/util/bitcoin-util-test.py
[environment] [environment]
SRCDIR=@abs_top_srcdir@ SRCDIR=@abs_top_srcdir@

2
test/functional/test_runner.py

@ -179,7 +179,7 @@ def main():
# Read config generated by configure. # Read config generated by configure.
config = configparser.ConfigParser() config = configparser.ConfigParser()
configfile = os.path.abspath(os.path.dirname(__file__)) + "/config.ini" configfile = os.path.abspath(os.path.dirname(__file__)) + "/../config.ini"
config.read_file(open(configfile)) config.read_file(open(configfile))
passon_args.append("--configfile=%s" % configfile) passon_args.append("--configfile=%s" % configfile)

2
test/util/bitcoin-util-test.py

@ -20,7 +20,7 @@ if __name__ == '__main__':
import bctest import bctest
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read_file(open(os.path.dirname(__file__) + "/config.ini")) config.read_file(open(os.path.dirname(__file__) + "/../config.ini"))
buildenv = argparse.Namespace(exeext=config["environment"]["EXEEXT"], buildenv = argparse.Namespace(exeext=config["environment"]["EXEEXT"],
SRCDIR=config["environment"]["SRCDIR"], SRCDIR=config["environment"]["SRCDIR"],

11
test/util/config.ini.in

@ -1,11 +0,0 @@
# 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@
Loading…
Cancel
Save