Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
12 changes: 11 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
118 changes: 118 additions & 0 deletions qa/pull-tester/rpc-tests.py
Original file line number Diff line number Diff line change
@@ -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] + "..."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I think having the testscript name in bold was nice:

print  "Running testscript \033[1m" + testScripts[i] + "\033[0m..." 

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried, tried double and triple and quadruple escaping that python
usually needs, and also tried the termcolor module. It doesn't work
from python and in a "mingw" shell. It will probably work on a native
unix shell but I can't test that out as I'm on Windows. Any suggestions
welcome...

On 01/10/2015 11:09 AM, Wladimir J. van der Laan wrote:

In qa/pull-tester/rpc-tests.py
#6616 (comment):

+# '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] + "..." 
    

Nit: I think having the testscript name in bold was nice:

|print "Running testscript \033[1m" + testScripts[i] + "\033[0m..." |


Reply to this email directly or view it on GitHub
https://github.com/bitcoin/bitcoin/pull/6616/files#r40946395.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried, tried double and triple and quadruple escaping that python
usually needs, and also tried the termcolor module. It doesn't work
from python and in a "mingw" shell. It will probably work on a native
unix shell but I can't test that out as I'm on Windows. Any suggestions
welcome...

Ok, no problem, then leave it like this. Escape-code based formatting probably doesn't work on windows at all.
If we want this it needs to be conditional on the terminal type, which is too much bother...

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"
89 changes: 0 additions & 89 deletions qa/pull-tester/rpc-tests.sh

This file was deleted.

4 changes: 1 addition & 3 deletions qa/pull-tester/tests-config.sh.in → qa/pull-tester/tests_config.py.in
100755 → 100644
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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}"

10 changes: 7 additions & 3 deletions qa/rpc-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to get the backticks ` right. (L44 as well)

Also, https://github.com/ptschip/bitcoin/blob/all_python/README.md#automated-testing needs update?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, done both

On 03/09/2015 11:08 AM, MarcoFalke wrote:

In qa/rpc-tests/README.md
#6616 (comment):

@@ -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

Make sure to get the backticks ` right. (L44 as well)

Also,
https://github.com/ptschip/bitcoin/blob/all_python/README.md#automated-testing
needs update?


Reply to this email directly or view it on GitHub
https://github.com/bitcoin/bitcoin/pull/6616/files#r38677104.


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:

Expand All @@ -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
Expand Down