Skip to content

Commit

Permalink
[ci] Report summary of failed tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Axel-Naumann committed Aug 23, 2023
1 parent 171fe5e commit 06415cf
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions .github/workflows/root-ci-config/build_root.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import datetime
import os
import shutil
import subprocess
import tarfile
from hashlib import sha1

Expand Down Expand Up @@ -125,11 +126,24 @@ def main():
if args.coverage:
create_coverage_xml()

if ctest_returncode != 0:
die(msg=f"TEST FAILURE: ctest exited with code {ctest_returncode}")
if testing and ctest_returncode != 0:
handle_test_failure(ctest_returncode)

print_trace()

def handle_test_failure(ctest_returncode):
logloc = f'{WORKDIR}/Testing/Temporary/LastTestsFailed.log'
if os.path.isfile(logloc):
with open(logloc, 'r') as logf:
print(logf.read())
else:
print(f'Internal error: cannot find {logloc}\nAdding some debug output:')
subprocess.run(f'ls -l {WORKDIR}', shell=True, check=False, stderr=subprocess.STDOUT)
subprocess.run(f'ls -l {WORKDIR}/Testing', shell=True, check=False, stderr=subprocess.STDOUT)
subprocess.run(f'ls -l {WORKDIR}/Testing/Temporary', shell=True, check=False, stderr=subprocess.STDOUT)

die(msg=f"TEST FAILURE: ctest exited with code {ctest_returncode}")


def parse_args():
# it is difficult to use boolean flags from github actions, use strings to convey
Expand Down Expand Up @@ -281,12 +295,12 @@ def archive_and_upload(archive_name, prefix):

@github_log_group("Configure")
def cmake_configure(options, buildtype):
result = subprocess_with_log(f"""
cmake -S '{WORKDIR}/src' -B '{WORKDIR}/build' {options} -DCMAKE_BUILD_TYPE={buildtype}
""")
result = subprocess_with_log(f"""
cmake -S '{WORKDIR}/src' -B '{WORKDIR}/build' {options} -DCMAKE_BUILD_TYPE={buildtype}
""")

if result != 0:
die(result, "Failed cmake generation step")
if result != 0:
die(result, "Failed cmake generation step")


@github_log_group("Dump existing configuration")
Expand Down

0 comments on commit 06415cf

Please sign in to comment.