1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
#!/usr/bin/python3
# Tests need to be added to meson.build. This script makes sure they are.
import os
from os import path
import logging
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.WARNING)
dead_tests = []
def check_dir(dir_path):
logger.info('checking ' + dir_path)
assert path.isdir(dir_path)
meson_path = path.join(dir_path, 'meson.build')
assert path.isfile(meson_path)
with open(meson_path, 'r') as f:
meson = f.read()
for filename in os.listdir(dir_path):
root, ext = path.splitext(filename)
if root.startswith('test-'):
search_str = "'" + root + "'"
if search_str in meson:
logger.info(search_str + ' is in meson')
else:
logger.info(search_str + ' is not in meson')
dead_tests.append(path.join(dir_path, filename))
else:
logger.info(filename + ' ignored')
if __name__ == '__main__':
test_dir = path.dirname(path.realpath(__file__))
check_dir(path.join(test_dir, 'integration-tests'))
check_dir(path.join(test_dir, 'smoke-tests'))
check_dir(path.join(test_dir, 'unit-tests'))
if dead_tests:
print('The following test(s) have not been added to meson:')
for test in dead_tests:
print(' ' + test)
exit(1)
|