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

Zcash: Migrated our test list over, and other necessary modifications.
The UI changes were not migrated.
This commit is contained in:
ptschip 2015-08-26 03:05:36 -07:00 committed by Jack Grigg
parent 4761c9f2bc
commit 772d780730
6 changed files with 196 additions and 188 deletions

View File

@ -147,7 +147,7 @@ dist_noinst_SCRIPTS = autogen.sh zcutil/build-debian-package.sh zcutil/build.sh
RUST_DIST = $(top_srcdir)/.cargo $(top_srcdir)/Cargo.toml $(top_srcdir)/Cargo.lock rust-toolchain
EXTRA_DIST = $(top_srcdir)/share/genbuild.sh qa/pull-tester/rpc-tests.sh qa/rpc-tests qa/zcash $(DIST_DOCS) $(BIN_CHECKS) $(RUST_DIST)
EXTRA_DIST = $(top_srcdir)/share/genbuild.sh qa/pull-tester/rpc-tests.py qa/pull-tester/tests_config.py qa/rpc-tests qa/zcash $(DIST_DOCS) $(BIN_CHECKS) $(RUST_DIST)
install-exec-hook:
mv $(DESTDIR)$(bindir)/fetch-params.sh $(DESTDIR)$(bindir)/zcash-fetch-params

View File

@ -969,7 +969,8 @@ AC_SUBST(ZMQ_LIBS)
AC_SUBST(LIBZCASH_LIBS)
AC_CONFIG_FILES([Makefile src/Makefile doc/man/Makefile 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.
@ -1010,6 +1011,15 @@ case $host in
;;
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
echo
echo "Options used to compile and link:"
echo " with wallet = $enable_wallet"

176
qa/pull-tester/rpc-tests.py Normal file
View File

@ -0,0 +1,176 @@
#!/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/zcashd' + EXEEXT
os.environ["BITCOINCLI"] = buildDir + '/src/zcash-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 = [
'paymentdisclosure.py',
'prioritisetransaction.py',
'wallet_treestate.py',
'wallet_anchorfork.py',
'wallet_changeaddresses.py',
'wallet_changeindicator.py',
'wallet_import_export.py',
'wallet_sendmany_any_taddr.py',
'wallet_shieldingcoinbase.py',
'wallet_shieldcoinbase_sprout.py',
'wallet_shieldcoinbase_sapling.py',
'wallet_listreceived.py',
'wallet.py',
'wallet_overwintertx.py',
'wallet_persistence.py',
'wallet_nullifiers.py',
'wallet_1941.py',
'wallet_addresses.py',
'wallet_sapling.py',
'wallet_listnotes.py',
'mergetoaddress_sprout.py',
'mergetoaddress_sapling.py',
'mergetoaddress_mixednotes.py',
'listtransactions.py',
'mempool_resurrect_test.py',
'txn_doublespend.py',
'txn_doublespend.py --mineblock',
'getchaintips.py',
'rawtransactions.py',
'getrawtransaction_insight.py',
'rest.py',
'mempool_limit.py',
'mempool_spendcoinbase.py',
'mempool_reorg.py',
'mempool_nu_activation.py',
'mempool_tx_expiry.py',
'httpbasics.py',
'multi_rpc.py',
'zapwallettxes.py',
'proxy_test.py',
'merkle_blocks.py',
'fundrawtransaction.py',
'signrawtransactions.py',
'signrawtransaction_offline.py',
'walletbackup.py',
'key_import_export.py',
'nodehandling.py',
'reindex.py',
'addressindex.py',
'spentindex.py',
'timestampindex.py',
'decodescript.py',
'p2p-fullblocktest.py',
'blockchain.py',
'disablewallet.py',
'zcjoinsplit.py',
'zcjoinsplitdoublespend.py',
'zkey_import_export.py',
'reorg_limit.py',
'getblocktemplate.py',
'bip65-cltv-p2p.py',
'bipdersig-p2p.py',
'p2p_nu_peer_management.py',
'rewind_index.py',
'p2p_txexpiry_dos.py',
'p2p_txexpiringsoon.py',
'p2p_node_bloom.py',
'regtest_signrawtransaction.py',
'finalsaplingroot.py',
'shorter_block_times.py',
'sprout_sapling_migration.py',
'turnstile.py',
'mining_shielded_coinbase.py',
'coinbase_funding_streams.py',
'framework.py',
'sapling_rewind_check.py',
'feature_zip221.py',
'upgrade_golden.py',
'post_heartwood_rollback.py',
'feature_logging.py',
'remove_sprout_shielding.py',
'feature_walletfile.py',
]
testScriptsExt = [
'getblocktemplate_longpoll.py',
'getblocktemplate_proposals.py',
'pruning.py',
'forknotify.py',
'hardforkdetection.py',
'invalidateblock.py',
'keypool.py',
'receivedby.py',
'rpcbind_test.py',
# 'script_test.py',
'smartfees.py',
'maxblocksinflight.py',
'invalidblockrequest.py',
# 'forknotify.py',
'p2p-acceptblock.py',
'wallet_db_flush.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"

View File

@ -1,180 +0,0 @@
#!/bin/bash
set -e -o pipefail
CURDIR=$(cd $(dirname "$0"); pwd)
# Get BUILDDIR and REAL_BITCOIND
. "${CURDIR}/tests-config.sh"
export BITCOIND=${REAL_BITCOIND}
export BITCOINCLI=${REAL_BITCOINCLI}
#Run the tests
testScripts=(
'paymentdisclosure.py'
'prioritisetransaction.py'
'wallet_treestate.py'
'wallet_anchorfork.py'
'wallet_changeaddresses.py'
'wallet_changeindicator.py'
'wallet_import_export.py'
'wallet_sendmany_any_taddr.py'
'wallet_shieldingcoinbase.py'
'wallet_shieldcoinbase_sprout.py'
'wallet_shieldcoinbase_sapling.py'
'wallet_listreceived.py'
'wallet.py'
'wallet_overwintertx.py'
'wallet_persistence.py'
'wallet_nullifiers.py'
'wallet_1941.py'
'wallet_addresses.py'
'wallet_sapling.py'
'wallet_listnotes.py'
'mergetoaddress_sprout.py'
'mergetoaddress_sapling.py'
'mergetoaddress_mixednotes.py'
'listtransactions.py'
'mempool_resurrect_test.py'
'txn_doublespend.py'
'txn_doublespend.py --mineblock'
'getchaintips.py'
'rawtransactions.py'
'getrawtransaction_insight.py'
'rest.py'
'mempool_limit.py'
'mempool_spendcoinbase.py'
'mempool_reorg.py'
'mempool_nu_activation.py'
'mempool_tx_expiry.py'
'httpbasics.py'
'multi_rpc.py'
'zapwallettxes.py'
'proxy_test.py'
'merkle_blocks.py'
'fundrawtransaction.py'
'signrawtransactions.py'
'signrawtransaction_offline.py'
'walletbackup.py'
'key_import_export.py'
'nodehandling.py'
'reindex.py'
'addressindex.py'
'spentindex.py'
'timestampindex.py'
'decodescript.py'
'p2p-fullblocktest.py'
'blockchain.py'
'disablewallet.py'
'zcjoinsplit.py'
'zcjoinsplitdoublespend.py'
'zkey_import_export.py'
'reorg_limit.py'
'getblocktemplate.py'
'bip65-cltv-p2p.py'
'bipdersig-p2p.py'
'p2p_nu_peer_management.py'
'rewind_index.py'
'p2p_txexpiry_dos.py'
'p2p_txexpiringsoon.py'
'p2p_node_bloom.py'
'regtest_signrawtransaction.py'
'finalsaplingroot.py'
'shorter_block_times.py'
'sprout_sapling_migration.py'
'turnstile.py'
'mining_shielded_coinbase.py'
'coinbase_funding_streams.py'
'framework.py'
'sapling_rewind_check.py'
'feature_zip221.py'
'upgrade_golden.py'
'post_heartwood_rollback.py'
'feature_logging.py'
'remove_sprout_shielding.py'
'feature_walletfile.py'
);
testScriptsExt=(
'getblocktemplate_longpoll.py'
'getblocktemplate_proposals.py'
'pruning.py'
'forknotify.py'
'hardforkdetection.py'
'invalidateblock.py'
'keypool.py'
'receivedby.py'
'rpcbind_test.py'
# 'script_test.py'
'smartfees.py'
'maxblocksinflight.py'
'invalidblockrequest.py'
# 'forknotify.py'
'p2p-acceptblock.py'
'wallet_db_flush.py'
);
if [ "x$ENABLE_ZMQ" = "x1" ]; then
testScripts+=('zmq_test.py')
fi
extArg="-extended"
passOn=${@#$extArg}
successCount=0
declare -a failures
function runTestScript
{
local testName="$1"
shift
echo -e "=== Running testscript ${testName} ==="
local startTime=$(date +%s)
if eval "$@"
then
successCount=$(expr $successCount + 1)
echo "--- Success: ${testName} ($(($(date +%s) - $startTime))s) ---"
else
failures[${#failures[@]}]="$testName"
echo "!!! FAIL: ${testName} ($(($(date +%s) - $startTime))s) !!!"
fi
echo
}
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
runTestScript \
"${testScripts[$i]}" \
"${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
runTestScript \
"${testScriptsExt[$i]}" \
"${BUILDDIR}/qa/rpc-tests/${testScriptsExt[$i]}" \
--srcdir "${BUILDDIR}/src" ${passOn}
fi
done
echo -e "\n\nTests completed: $(expr $successCount + ${#failures[@]})"
echo "successes $successCount; failures: ${#failures[@]}"
if [ ${#failures[@]} -gt 0 ]
then
echo -e "\nFailing tests: ${failures[*]}"
exit 1
else
exit 0
fi
else
echo "No rpc tests to run. Wallet, utils, and bitcoind must all be enabled"
fi

View File

@ -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 https://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/zcashd${EXEEXT}"
REAL_BITCOINCLI="$BUILDDIR/src/zcash-cli${EXEEXT}"

View File

@ -32,9 +32,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:
@ -48,7 +52,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