ci: Fail CI when tests are skipped

This commit is contained in:
Bastien Nocera 2022-04-28 10:09:15 +02:00
parent f6cfb32568
commit 3d9a706ba0
2 changed files with 26 additions and 0 deletions

25
.ci/fail_skipped_tests.py Executable file
View file

@ -0,0 +1,25 @@
#!/usr/bin/python3
from lxml import etree
import sys
def format_title(title):
"""Put title in a box"""
box = {
'tl': '', 'tr': '', 'bl': '', 'br': '', 'h': '', 'v': '',
}
hline = box['h'] * (len(title) + 2)
return '\n'.join([
f"{box['tl']}{hline}{box['tr']}",
f"{box['v']} {title} {box['v']}",
f"{box['bl']}{hline}{box['br']}",
])
tree = etree.parse(sys.argv[1])
for suite in tree.xpath('/testsuites/testsuite'):
skipped = suite.get('skipped')
if int(skipped) != 0:
print(format_title('Tests were skipped when they should not have been. All the tests must be run in the CI'),
end='\n\n', flush=True)
sys.exit(1)

View file

@ -28,6 +28,7 @@ build_stable:
- ninja -v -C _build uninstall
- ninja -v -C _build dist
- meson test -C _build
- .ci/fail_skipped_tests.py _build/meson-logs/testlog.junit.xml
artifacts:
when: always
paths: