aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorptschip <peter.tschipper@gmail.com>2015-08-26 03:05:36 -0700
committerptschip <peter.tschipper@gmail.com>2015-10-01 11:28:11 -0700
commit5467820be5404fa736436a1202079e764a4308b4 (patch)
tree64474b1acd9e650aabf9fe9298600dd36ae263f7
parentf297042cae572753e6c25d25caf92091e88b76df (diff)
Migrated rpc-tests.sh to all python rpc-tests.py
1) created rpc-tests.py 2) deleted rpc-tests.sh 3) travis.yml points to rpc-tests.py 4) Modified Makefile.am 5) Updated README.md 6) Added tests_config.py and deleted tests-config.sh 7) Modified configure.ac with script to set correct path in tests_config.py
-rw-r--r--.travis.yml2
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac12
-rw-r--r--qa/pull-tester/rpc-tests.py118
-rwxr-xr-xqa/pull-tester/rpc-tests.sh89
-rw-r--r--[-rwxr-xr-x]qa/pull-tester/tests_config.py.in (renamed from qa/pull-tester/tests-config.sh.in)4
-rw-r--r--qa/rpc-tests/README.md10
7 files changed, 139 insertions, 98 deletions
diff --git a/.travis.yml b/.travis.yml
index 3e7077ab26..8e9684826f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -69,6 +69,6 @@ script:
- make $MAKEJOBS $GOAL || ( echo "Build failure. Verbose build follows." && make $GOAL V=1 ; false )
- export LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/depends/$HOST/lib
- if [ "$RUN_TESTS" = "true" ]; then make check; fi
- - if [ "$RUN_TESTS" = "true" ]; then qa/pull-tester/rpc-tests.sh; fi
+ - if [ "$RUN_TESTS" = "true" ]; then qa/pull-tester/rpc-tests.py; fi
after_script:
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then (echo "Upload goes here. Something like: scp -r $BASE_OUTDIR server" || echo "upload failed"); fi
diff --git a/Makefile.am b/Makefile.am
index dfde0d43ec..8a7140398f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -204,7 +204,7 @@ endif
dist_noinst_SCRIPTS = autogen.sh
-EXTRA_DIST = $(top_srcdir)/share/genbuild.sh qa/pull-tester/rpc-tests.sh qa/rpc-tests $(DIST_DOCS) $(WINDOWS_PACKAGING) $(OSX_PACKAGING)
+EXTRA_DIST = $(top_srcdir)/share/genbuild.sh qa/pull-tester/rpc-tests.py qa/pull-tester/tests_config.py qa/rpc-tests $(DIST_DOCS) $(WINDOWS_PACKAGING) $(OSX_PACKAGING)
CLEANFILES = $(OSX_DMG) $(BITCOIN_WIN_INSTALLER)
diff --git a/configure.ac b/configure.ac
index dbdc356f5d..5a0b4ae9cb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -914,7 +914,8 @@ AC_SUBST(MINIUPNPC_CPPFLAGS)
AC_SUBST(MINIUPNPC_LIBS)
AC_CONFIG_FILES([Makefile src/Makefile share/setup.nsi share/qt/Info.plist src/test/buildenv.py])
AC_CONFIG_FILES([qa/pull-tester/run-bitcoind-for-test.sh],[chmod +x qa/pull-tester/run-bitcoind-for-test.sh])
-AC_CONFIG_FILES([qa/pull-tester/tests-config.sh],[chmod +x qa/pull-tester/tests-config.sh])
+AC_CONFIG_FILES([qa/pull-tester/tests_config.py],[chmod +x qa/pull-tester/tests_config.py])
+chmod +x qa/pull-tester/rpc-tests.py
dnl boost's m4 checks do something really nasty: they export these vars. As a
dnl result, they leak into secp256k1's configure and crazy things happen.
@@ -954,3 +955,12 @@ case $host in
chmod 755 libtool
;;
esac
+
+dnl Replace the BUILDDIR path with the correct Windows path if compiling on Native Windows
+case ${OS} in
+ *Windows*)
+ sed 's/BUILDDIR="\/\([[a-z]]\)/BUILDDIR="\1:/' qa/pull-tester/tests_config.py > qa/pull-tester/tests_config-2.py
+ mv qa/pull-tester/tests_config-2.py qa/pull-tester/tests_config.py
+ chmod +x qa/pull-tester/tests_config.py
+ ;;
+esac
diff --git a/qa/pull-tester/rpc-tests.py b/qa/pull-tester/rpc-tests.py
new file mode 100644
index 0000000000..68c1c0471e
--- /dev/null
+++ b/qa/pull-tester/rpc-tests.py
@@ -0,0 +1,118 @@
+#!/usr/bin/env python2
+
+# Copyright (c) 2014 The Bitcoin Core developers
+# Distributed under the MIT software license, see the accompanying
+# file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+#
+# Run Regression Test Suite
+#
+
+import os
+import sys
+import subprocess
+import re
+from tests_config import *
+from sets import Set
+
+#If imported values are not defined then set to zero (or disabled)
+if not vars().has_key('ENABLE_WALLET'):
+ ENABLE_WALLET=0
+if not vars().has_key('ENABLE_BITCOIND'):
+ ENABLE_BITCOIND=0
+if not vars().has_key('ENABLE_UTILS'):
+ ENABLE_UTILS=0
+if not vars().has_key('ENABLE_ZMQ'):
+ ENABLE_ZMQ=0
+
+#Create a set to store arguments and create the passOn string
+opts = Set()
+passOn = ""
+p = re.compile("^--")
+for i in range(1,len(sys.argv)):
+ if (p.match(sys.argv[i]) or sys.argv[i] == "-h"):
+ passOn += " " + sys.argv[i]
+ else:
+ opts.add(sys.argv[i])
+
+#Set env vars
+buildDir = BUILDDIR
+os.environ["BITCOIND"] = buildDir + '/src/bitcoind' + EXEEXT
+os.environ["BITCOINCLI"] = buildDir + '/src/bitcoin-cli' + EXEEXT
+
+#Disable Windows tests by default
+if EXEEXT == ".exe" and "-win" not in opts:
+ print "Win tests currently disabled. Use -win option to enable"
+ sys.exit(0)
+
+#Tests
+testScripts = [
+ 'wallet.py',
+ 'listtransactions.py',
+ 'mempool_resurrect_test.py',
+ 'txn_doublespend.py --mineblock',
+ 'txn_clone.py',
+ 'getchaintips.py',
+ 'rawtransactions.py',
+ 'rest.py',
+ 'mempool_spendcoinbase.py',
+ 'mempool_coinbase_spends.py',
+ 'httpbasics.py',
+ 'zapwallettxes.py',
+ 'proxy_test.py',
+ 'merkle_blocks.py',
+ 'fundrawtransaction.py',
+ 'signrawtransactions.py',
+ 'walletbackup.py',
+ 'nodehandling.py',
+ 'reindex.py',
+ 'decodescript.py',
+ 'p2p-fullblocktest.py',
+]
+testScriptsExt = [
+ 'bipdersig-p2p.py',
+ 'bipdersig.py',
+ 'getblocktemplate_longpoll.py',
+ 'getblocktemplate_proposals.py',
+ 'txn_doublespend.py',
+ 'txn_clone.py --mineblock',
+ 'pruning.py',
+ 'forknotify.py',
+ 'invalidateblock.py',
+ 'keypool.py',
+ 'receivedby.py',
+ 'rpcbind_test.py',
+# 'script_test.py',
+ 'smartfees.py',
+ 'maxblocksinflight.py',
+ 'invalidblockrequest.py',
+# 'forknotify.py',
+ 'p2p-acceptblock.py',
+ 'mempool_packages.py',
+]
+
+#Enable ZMQ tests
+if ENABLE_ZMQ == 1:
+ testScripts.append('zmq_test.py')
+
+if(ENABLE_WALLET == 1 and ENABLE_UTILS == 1 and ENABLE_BITCOIND == 1):
+ rpcTestDir = buildDir + '/qa/rpc-tests/'
+ #Run Tests
+ for i in range(len(testScripts)):
+ if (len(opts) == 0 or (len(opts) == 1 and "-win" in opts ) or '-extended' in opts
+ or testScripts[i] in opts or re.sub(".py$", "", testScripts[i]) in opts ):
+ print "Running testscript " + testScripts[i] + "..."
+ subprocess.call(rpcTestDir + testScripts[i] + " --srcdir " + buildDir + '/src ' + passOn,shell=True)
+ #exit if help is called so we print just one set of instructions
+ p = re.compile(" -h| --help")
+ if p.match(passOn):
+ sys.exit(0)
+
+ #Run Extended Tests
+ for i in range(len(testScriptsExt)):
+ if ('-extended' in opts or testScriptsExt[i] in opts
+ or re.sub(".py$", "", testScriptsExt[i]) in opts):
+ print "Running 2nd level testscript " + testScriptsExt[i] + "..."
+ subprocess.call(rpcTestDir + testScriptsExt[i] + " --srcdir " + buildDir + '/src ' + passOn,shell=True)
+else:
+ print "No rpc tests to run. Wallet, utils, and bitcoind must all be enabled"
diff --git a/qa/pull-tester/rpc-tests.sh b/qa/pull-tester/rpc-tests.sh
deleted file mode 100755
index 7e1d2e8e50..0000000000
--- a/qa/pull-tester/rpc-tests.sh
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/bin/bash
-set -e
-
-CURDIR=$(cd $(dirname "$0"); pwd)
-# Get BUILDDIR and REAL_BITCOIND
-. "${CURDIR}/tests-config.sh"
-
-export BITCOIND=${REAL_BITCOIND}
-export BITCOINCLI=${REAL_BITCOINCLI}
-
-if [ "x${EXEEXT}" = "x.exe" ]; then
- echo "Win tests currently disabled"
- exit 0
-fi
-
-#Run the tests
-
-testScripts=(
- 'wallet.py'
- 'listtransactions.py'
- 'mempool_resurrect_test.py'
- 'txn_doublespend.py --mineblock'
- 'txn_clone.py'
- 'getchaintips.py'
- 'rawtransactions.py'
- 'rest.py'
- 'mempool_spendcoinbase.py'
- 'mempool_coinbase_spends.py'
- 'httpbasics.py'
- 'zapwallettxes.py'
- 'proxy_test.py'
- 'merkle_blocks.py'
- 'fundrawtransaction.py'
- 'signrawtransactions.py'
- 'walletbackup.py'
- 'nodehandling.py'
- 'reindex.py'
- 'decodescript.py'
- 'p2p-fullblocktest.py'
-);
-testScriptsExt=(
- 'bipdersig-p2p.py'
- 'bipdersig.py'
- 'getblocktemplate_longpoll.py'
- 'getblocktemplate_proposals.py'
- 'txn_doublespend.py'
- 'txn_clone.py --mineblock'
- 'pruning.py'
- 'forknotify.py'
- 'invalidateblock.py'
- 'keypool.py'
- 'receivedby.py'
- 'rpcbind_test.py'
-# 'script_test.py'
- 'smartfees.py'
- 'maxblocksinflight.py'
- 'invalidblockrequest.py'
-# 'forknotify.py'
- 'p2p-acceptblock.py'
- 'mempool_packages.py'
-);
-
-if [ "x$ENABLE_ZMQ" = "x1" ]; then
- testScripts+=('zmq_test.py')
-fi
-
-extArg="-extended"
-passOn=${@#$extArg}
-
-if [ "x${ENABLE_BITCOIND}${ENABLE_UTILS}${ENABLE_WALLET}" = "x111" ]; then
- for (( i = 0; i < ${#testScripts[@]}; i++ ))
- do
- if [ -z "$1" ] || [ "${1:0:1}" == "-" ] || [ "$1" == "${testScripts[$i]}" ] || [ "$1.py" == "${testScripts[$i]}" ]
- then
- echo -e "Running testscript \033[1m${testScripts[$i]}...\033[0m"
- ${BUILDDIR}/qa/rpc-tests/${testScripts[$i]} --srcdir "${BUILDDIR}/src" ${passOn}
- fi
- done
- for (( i = 0; i < ${#testScriptsExt[@]}; i++ ))
- do
- if [ "$1" == $extArg ] || [ "$1" == "${testScriptsExt[$i]}" ] || [ "$1.py" == "${testScriptsExt[$i]}" ]
- then
- echo -e "Running \033[1m2nd level\033[0m testscript \033[1m${testScriptsExt[$i]}...\033[0m"
- ${BUILDDIR}/qa/rpc-tests/${testScriptsExt[$i]} --srcdir "${BUILDDIR}/src" ${passOn}
- fi
- done
-else
- echo "No rpc tests to run. Wallet, utils, and bitcoind must all be enabled"
-fi
diff --git a/qa/pull-tester/tests-config.sh.in b/qa/pull-tester/tests_config.py.in
index e881a95110..937b4231f1 100755..100644
--- a/qa/pull-tester/tests-config.sh.in
+++ b/qa/pull-tester/tests_config.py.in
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env python2
# Copyright (c) 2013-2014 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -12,6 +12,4 @@ EXEEXT="@EXEEXT@"
@BUILD_BITCOIND_TRUE@ENABLE_BITCOIND=1
@ENABLE_ZMQ_TRUE@ENABLE_ZMQ=1
-REAL_BITCOIND="$BUILDDIR/src/bitcoind${EXEEXT}"
-REAL_BITCOINCLI="$BUILDDIR/src/bitcoin-cli${EXEEXT}"
diff --git a/qa/rpc-tests/README.md b/qa/rpc-tests/README.md
index c6d1721282..3391ee03ae 100644
--- a/qa/rpc-tests/README.md
+++ b/qa/rpc-tests/README.md
@@ -37,9 +37,13 @@ Helper functions for creating blocks and transactions.
Notes
=====
-You can run a single test by calling `qa/pull-tester/rpc-tests.sh <testname>`.
+You can run any single test by calling qa/pull-tester/rpc-tests.py <testname>
-Run all possible tests with `qa/pull-tester/rpc-tests.sh -extended`.
+Or you can run any combination of tests by calling `qa/pull-tester/rpc-tests.py <testname1> <testname2> <testname3> ...`
+
+Run the regression test suite with `qa/pull-tester/rpc-tests.py'
+
+Run all possible tests with `qa/pull-tester/rpc-tests.py -extended`
Possible options:
@@ -53,7 +57,7 @@ Possible options:
--tracerpc Print out all RPC calls as they are made
```
-If you set the environment variable `PYTHON_DEBUG=1` you will get some debug output (example: `PYTHON_DEBUG=1 qa/pull-tester/rpc-tests.sh wallet`).
+If you set the environment variable `PYTHON_DEBUG=1` you will get some debug output (example: `PYTHON_DEBUG=1 qa/pull-tester/rpc-tests.py wallet`).
A 200-block -regtest blockchain and wallets for four nodes
is created the first time a regression test is run and