diff --git a/.travis/test_06_script_b.sh b/.travis/test_06_script_b.sh index 79bf261d9..939ac2032 100755 --- a/.travis/test_06_script_b.sh +++ b/.travis/test_06_script_b.sh @@ -16,6 +16,6 @@ fi if [ "$RUN_FUNCTIONAL_TESTS" = "true" ]; then BEGIN_FOLD functional-tests - DOCKER_EXEC LOCAL_NTP=1 ./qa/pull-tester/rpc-tests.py -parallel=1 --coverage + DOCKER_EXEC LOCAL_NTP=1 ./qa/pull-tester/rpc-tests.py -parallel=1 --coverage --failfast END_FOLD fi diff --git a/qa/pull-tester/rpc-tests.py b/qa/pull-tester/rpc-tests.py index 0ddc44e58..5ebbf12af 100755 --- a/qa/pull-tester/rpc-tests.py +++ b/qa/pull-tester/rpc-tests.py @@ -181,7 +181,7 @@ 'mnemonic.py', 'sendtoaddress.py', 'stakeimmaturebalance.py', - 'rpc-help.py', + 'rpc-help.py', ] #if ENABLE_ZMQ: # testScripts.append('zmq_test.py') @@ -257,6 +257,12 @@ def runtests(): print('stderr:\n' if not stderr == '' else '', stderr) results += "%s | %s | %s s\n" % (name.ljust(max_len_name), str(passed).ljust(6), duration) print("Pass: %s%s%s, Duration: %s s\n" % (BOLD[1], passed, BOLD[0], duration)) + + # Check if we need to quit + if FAILFAST and not passed: + logging.debug("Early exiting after test failure") + break + results += BOLD[1] + "\n%s | %s | %s s (accumulated)" % ("ALL".ljust(max_len_name), str(all_passed).ljust(6), time_sum) + BOLD[0] print(results) print("\nRuntime: %s s" % (int(time.time() - time0))) diff --git a/qa/rpc-tests/test_framework/test_framework.py b/qa/rpc-tests/test_framework/test_framework.py index ce6aa3b0c..3292f3b92 100755 --- a/qa/rpc-tests/test_framework/test_framework.py +++ b/qa/rpc-tests/test_framework/test_framework.py @@ -23,6 +23,7 @@ stop_node, wait_navcoinds, enable_coverage, + failfast, check_json_precision, initialize_chain_clean, PortSeed, @@ -120,6 +121,9 @@ def main(self): help="The seed to use for assigning port numbers (default: current process id)") parser.add_option("--coveragedir", dest="coveragedir", help="Write tested RPC commands into this directory") + parser.add_option('--failfast', action='store_true', + help='stop execution after the first test failure') + self.add_options(parser) (self.options, self.args) = parser.parse_args() @@ -131,6 +135,9 @@ def main(self): if self.options.coveragedir: enable_coverage(self.options.coveragedir) + if self.options.failfast: + failfast(self.options.failfast) + PortSeed.n = self.options.port_seed os.environ['PATH'] = self.options.srcdir+":"+self.options.srcdir+"/qt:"+os.environ['PATH'] diff --git a/qa/rpc-tests/test_framework/util.py b/qa/rpc-tests/test_framework/util.py index 505bc7b8b..59171a2cc 100755 --- a/qa/rpc-tests/test_framework/util.py +++ b/qa/rpc-tests/test_framework/util.py @@ -27,6 +27,7 @@ from .authproxy import AuthServiceProxy, JSONRPCException COVERAGE_DIR = None +FAILFAST = False # The maximum number of nodes a single test can spawn MAX_NODES = 8 @@ -51,7 +52,7 @@ class PortSeed: def enable_mocktime(): #For backwared compatibility of the python scripts - #with previous versions of the cache, set MOCKTIME + #with previous versions of the cache, set MOCKTIME #to Jan 1, 2014 + (201 * 10 * 60) global MOCKTIME MOCKTIME = 1388534400 + (201 * 10 * 60) @@ -68,6 +69,11 @@ def enable_coverage(dirname): global COVERAGE_DIR COVERAGE_DIR = dirname +def failfast(failfast): + """Quit the test suite as soon as we have a failed test""" + global FAILFAST + FAILFAST = failfast + def get_rpc_proxy(url, node_number, timeout=None): """ diff --git a/qa/rpc-tests/wallet-hd.py b/qa/rpc-tests/wallet-hd.py index d32e5043e..47275a292 100755 --- a/qa/rpc-tests/wallet-hd.py +++ b/qa/rpc-tests/wallet-hd.py @@ -38,7 +38,7 @@ def run_test (self): non_hd_add = self.nodes[0].getnewaddress() self.nodes[1].importprivkey(self.nodes[0].dumpprivkey(non_hd_add)) - # This should be enough to keep the master key and the non-HD key + # This should be enough to keep the master key and the non-HD key self.nodes[1].backupwallet(tmpdir + "hd.bak") #self.nodes[1].dumpwallet(tmpdir + "hd.dump")