Skip to content

Commit fa6d14e

Browse files
author
MarcoFalke
committed
test: Treat exclude list warning as failure in CI
1 parent fc642c3 commit fa6d14e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

test/functional/test_runner.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,8 @@ def main():
446446
help="Leave bitcoinds and test.* datadir on exit or error")
447447
parser.add_argument('--resultsfile', '-r', help='store test results (as CSV) to the provided file')
448448

449-
450449
args, unknown_args = parser.parse_known_args()
450+
fail_on_warn = args.ci
451451
if not args.ansi:
452452
global DEFAULT, BOLD, GREEN, RED
453453
DEFAULT = ("", "")
@@ -524,8 +524,12 @@ def main():
524524
# Remove the test cases that the user has explicitly asked to exclude.
525525
# The user can specify a test case with or without the .py extension.
526526
if args.exclude:
527+
527528
def print_warning_missing_test(test_name):
528-
print("{}WARNING!{} Test '{}' not found in current test list.".format(BOLD[1], BOLD[0], test_name))
529+
print("{}WARNING!{} Test '{}' not found in current test list. Check the --exclude list.".format(BOLD[1], BOLD[0], test_name))
530+
if fail_on_warn:
531+
sys.exit(1)
532+
529533
def remove_tests(exclude_list):
530534
if not exclude_list:
531535
print_warning_missing_test(exclude_test)
@@ -562,7 +566,7 @@ def remove_tests(exclude_list):
562566
f"A minimum of {MIN_NO_CLEANUP_SPACE // (1024 * 1024 * 1024)} GB of free space is required.")
563567
passon_args.append("--nocleanup")
564568

565-
check_script_list(src_dir=config["environment"]["SRCDIR"], fail_on_warn=args.ci)
569+
check_script_list(src_dir=config["environment"]["SRCDIR"], fail_on_warn=fail_on_warn)
566570
check_script_prefixes()
567571

568572
if not args.keepcache:
@@ -871,7 +875,6 @@ def check_script_list(*, src_dir, fail_on_warn):
871875
if len(missed_tests) != 0:
872876
print("%sWARNING!%s The following scripts are not being run: %s. Check the test lists in test_runner.py." % (BOLD[1], BOLD[0], str(missed_tests)))
873877
if fail_on_warn:
874-
# On CI this warning is an error to prevent merging incomplete commits into master
875878
sys.exit(1)
876879

877880

0 commit comments

Comments
 (0)