Allow test cases to be skipped

Currently, functional test cases can either pass or fail. There are
occasions when it is helpful to skip tests, for example if the
system they are running on does not meet the requirements for the test.
The rest of the test suite can run without being marked as a failure.

This commit adds framework for tests to skip if their requirements
aren't met.
This commit is contained in:
John Newbery 2017-03-22 10:26:02 -04:00
parent 02d64bd929
commit 232b6665bc
2 changed files with 23 additions and 12 deletions
test/functional/test_framework

View file

@ -28,9 +28,12 @@ from .util import (
)
from .authproxy import JSONRPCException
class BitcoinTestFramework(object):
TEST_EXIT_PASSED = 0
TEST_EXIT_FAILED = 1
TEST_EXIT_SKIPPED = 77
def __init__(self):
self.num_nodes = 4
self.setup_clean_chain = False
@ -183,11 +186,11 @@ class BitcoinTestFramework(object):
print("".join(deque(open(f), MAX_LINES_TO_PRINT)))
if success:
self.log.info("Tests successful")
sys.exit(0)
sys.exit(self.TEST_EXIT_PASSED)
else:
self.log.error("Test failed. Test logging available at %s/test_framework.log", self.options.tmpdir)
logging.shutdown()
sys.exit(1)
sys.exit(self.TEST_EXIT_FAILED)
def _start_logging(self):
# Add logger and logging handlers