From bfc0445eb94f134c87fb6971223742b155e3b904 Mon Sep 17 00:00:00 2001 From: Maksymilian Komarnicki <70346597+makz00@users.noreply.github.com> Date: Mon, 27 Nov 2023 10:22:55 +0100 Subject: [PATCH] Add fork repositories support for reporting regression tests (#508) --- .github/workflows/main.yml | 10 +++------- scripts/check_test_results.py | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+), 7 deletions(-) create mode 100755 scripts/check_test_results.py diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 41e20abc5..49a7c4398 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -97,12 +97,8 @@ jobs: . venv/bin/activate scripts/run_tests.py -a regression - - name: Test Report - uses: EnricoMi/publish-unit-test-result-action@v2 - with: - files: test/regression/cocotb/results.xml - check_name: cocotb test results - comment_mode: off + - name: Check for test failure + run: ./scripts/check_test_results.py unit-test: name: Run unit tests @@ -131,7 +127,7 @@ jobs: run: ./scripts/run_tests.py --verbose - name: Check traces - run: ./scripts/run_tests.py -t -c 1 TestCore + run: ./scripts/run_tests.py -t -c 1 TestCore lint: name: Check code formatting and typing diff --git a/scripts/check_test_results.py b/scripts/check_test_results.py new file mode 100755 index 000000000..c10af9bc2 --- /dev/null +++ b/scripts/check_test_results.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 + +import sys +import os +import pathlib +import xml.etree.ElementTree as eT + +FAILURE_TAG = "failure" +TOP_DIR = pathlib.Path(__file__).parent.parent +TEST_RESULTS_FILE = TOP_DIR.joinpath("test/regression/cocotb/results.xml") + +if not os.path.exists(TEST_RESULTS_FILE): + print("File not found: ", TEST_RESULTS_FILE) + sys.exit(1) + +tree = eT.parse(TEST_RESULTS_FILE) + +if len(list(tree.iter(FAILURE_TAG))) > 0: + print("Some regression tests failed") + sys.exit(1) + +print("All regression tests pass")