Skip to content

Commit 29d6634

Browse files
committed
Check that all test scripts in test/functional are being run
This commit checks that all of the python files in the test/functional directory are listed in test_runner.py.
1 parent 5114f81 commit 29d6634

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/functional/test_runner.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,13 @@
127127

128128
ALL_SCRIPTS = BASE_SCRIPTS + ZMQ_SCRIPTS + EXTENDED_SCRIPTS
129129

130+
NON_SCRIPTS = [
131+
# These are python files that live in the functional tests directory, but are not test scripts.
132+
"combine_logs.py",
133+
"create_cache.py",
134+
"test_runner.py",
135+
]
136+
130137
def main():
131138
# Parse arguments and pass through unrecognised args
132139
parser = argparse.ArgumentParser(add_help=False,
@@ -212,6 +219,8 @@ def main():
212219
subprocess.check_call([(config["environment"]["SRCDIR"] + '/test/functional/' + test_list[0].split()[0])] + ['-h'])
213220
sys.exit(0)
214221

222+
check_script_list(config["environment"]["SRCDIR"])
223+
215224
run_tests(test_list, config["environment"]["SRCDIR"], config["environment"]["BUILDDIR"], config["environment"]["EXEEXT"], args.jobs, args.coverage, passon_args)
216225

217226
def run_tests(test_list, src_dir, build_dir, exeext, jobs=1, enable_coverage=False, args=[]):
@@ -331,6 +340,18 @@ def get_next(self):
331340
return name, stdout, stderr, status, int(time.time() - time0)
332341
print('.', end='', flush=True)
333342

343+
def check_script_list(src_dir):
344+
"""Check scripts directory.
345+
346+
Check that there are no scripts in the functional tests directory which are
347+
not being run by pull-tester.py."""
348+
script_dir = src_dir + '/test/functional/'
349+
python_files = set([t for t in os.listdir(script_dir) if t[-3:] == ".py"])
350+
missed_tests = list(python_files - set(map(lambda x: x.split()[0], ALL_SCRIPTS + NON_SCRIPTS)))
351+
if len(missed_tests) != 0:
352+
print("The following scripts are not being run:" + str(missed_tests))
353+
print("Check the test lists in test_runner.py")
354+
sys.exit(1)
334355

335356
class RPCCoverage(object):
336357
"""

0 commit comments

Comments
 (0)