aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2017-03-31 22:44:04 -0400
committerJohn Newbery <john@johnnewbery.com>2017-08-10 12:50:51 -0400
commitcc5d38f4b826b897dd818bb22c7f5d881718fd35 (patch)
tree86a1724d6e52a629649dbac7bbe1bececb73d2a5 /test/functional
parentfa646369489d5655ac187f2a9e151317829581df (diff)
Add option to attach a python debugger if test fails
Diffstat (limited to 'test/functional')
-rwxr-xr-xtest/functional/test_framework/test_framework.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py
index 8d698a7327..e562d11938 100755
--- a/test/functional/test_framework/test_framework.py
+++ b/test/functional/test_framework/test_framework.py
@@ -11,6 +11,7 @@ import http.client
import logging
import optparse
import os
+import pdb
import shutil
import subprocess
import sys
@@ -125,6 +126,8 @@ class BitcoinTestFramework(object):
help="Write tested RPC commands into this directory")
parser.add_option("--configfile", dest="configfile",
help="Location of the test framework config file")
+ parser.add_option("--pdbonfailure", dest="pdbonfailure", default=False, action="store_true",
+ help="Attach a python debugger if test fails")
self.add_options(parser)
(self.options, self.args) = parser.parse_args()
@@ -162,6 +165,10 @@ class BitcoinTestFramework(object):
except KeyboardInterrupt as e:
self.log.warning("Exiting after keyboard interrupt")
+ if success == TestStatus.FAILED and self.options.pdbonfailure:
+ print("Testcase failed. Attaching python debugger. Enter ? for help")
+ pdb.set_trace()
+
if not self.options.noshutdown:
self.log.info("Stopping nodes")
if self.nodes: