mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 11:57:28 -03:00
test: Add option to skip unit tests for the test runner
This commit is contained in:
parent
1ac627c485
commit
5f240ab2e8
1 changed files with 12 additions and 9 deletions
|
@ -434,6 +434,8 @@ def main():
|
||||||
parser.add_argument('--tmpdirprefix', '-t', default=tempfile.gettempdir(), help="Root directory for datadirs")
|
parser.add_argument('--tmpdirprefix', '-t', default=tempfile.gettempdir(), help="Root directory for datadirs")
|
||||||
parser.add_argument('--failfast', '-F', action='store_true', help='stop execution after the first test failure')
|
parser.add_argument('--failfast', '-F', action='store_true', help='stop execution after the first test failure')
|
||||||
parser.add_argument('--filter', help='filter scripts to run by regular expression')
|
parser.add_argument('--filter', help='filter scripts to run by regular expression')
|
||||||
|
parser.add_argument('--skipunit', '-u', action='store_true', help='skip unit tests for the test framework')
|
||||||
|
|
||||||
|
|
||||||
args, unknown_args = parser.parse_known_args()
|
args, unknown_args = parser.parse_known_args()
|
||||||
if not args.ansi:
|
if not args.ansi:
|
||||||
|
@ -544,9 +546,10 @@ def main():
|
||||||
combined_logs_len=args.combinedlogslen,
|
combined_logs_len=args.combinedlogslen,
|
||||||
failfast=args.failfast,
|
failfast=args.failfast,
|
||||||
use_term_control=args.ansi,
|
use_term_control=args.ansi,
|
||||||
|
skipunit=args.skipunit,
|
||||||
)
|
)
|
||||||
|
|
||||||
def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=False, args=None, combined_logs_len=0, failfast=False, use_term_control):
|
def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=False, args=None, combined_logs_len=0, failfast=False, use_term_control, skipunit=False):
|
||||||
args = args or []
|
args = args or []
|
||||||
|
|
||||||
# Warn if bitcoind is already running
|
# Warn if bitcoind is already running
|
||||||
|
@ -563,20 +566,20 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=
|
||||||
if os.path.isdir(cache_dir):
|
if os.path.isdir(cache_dir):
|
||||||
print("%sWARNING!%s There is a cache directory here: %s. If tests fail unexpectedly, try deleting the cache directory." % (BOLD[1], BOLD[0], cache_dir))
|
print("%sWARNING!%s There is a cache directory here: %s. If tests fail unexpectedly, try deleting the cache directory." % (BOLD[1], BOLD[0], cache_dir))
|
||||||
|
|
||||||
# Test Framework Tests
|
|
||||||
print("Running Unit Tests for Test Framework Modules")
|
|
||||||
|
|
||||||
tests_dir = src_dir + '/test/functional/'
|
tests_dir = src_dir + '/test/functional/'
|
||||||
# This allows `test_runner.py` to work from an out-of-source build directory using a symlink,
|
# This allows `test_runner.py` to work from an out-of-source build directory using a symlink,
|
||||||
# a hard link or a copy on any platform. See https://github.com/bitcoin/bitcoin/pull/27561.
|
# a hard link or a copy on any platform. See https://github.com/bitcoin/bitcoin/pull/27561.
|
||||||
sys.path.append(tests_dir)
|
sys.path.append(tests_dir)
|
||||||
|
|
||||||
test_framework_tests = unittest.TestSuite()
|
if not skipunit:
|
||||||
for module in TEST_FRAMEWORK_MODULES:
|
print("Running Unit Tests for Test Framework Modules")
|
||||||
test_framework_tests.addTest(unittest.TestLoader().loadTestsFromName("test_framework.{}".format(module)))
|
test_framework_tests = unittest.TestSuite()
|
||||||
result = unittest.TextTestRunner(verbosity=1, failfast=True).run(test_framework_tests)
|
for module in TEST_FRAMEWORK_MODULES:
|
||||||
if not result.wasSuccessful():
|
test_framework_tests.addTest(unittest.TestLoader().loadTestsFromName("test_framework.{}".format(module)))
|
||||||
sys.exit("Early exiting after failure in TestFramework unit tests")
|
result = unittest.TextTestRunner(verbosity=1, failfast=True).run(test_framework_tests)
|
||||||
|
if not result.wasSuccessful():
|
||||||
|
sys.exit("Early exiting after failure in TestFramework unit tests")
|
||||||
|
|
||||||
flags = ['--cachedir={}'.format(cache_dir)] + args
|
flags = ['--cachedir={}'.format(cache_dir)] + args
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue