From 97d0b6534aff42e1ce4466523c29f1771553e885 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 16 Jun 2025 19:01:53 +0200 Subject: [PATCH] Implement generic CI step "may_fail" option There might be various occasions where a CI step should be attempted to be executed, despite a chance of failing. For instance, we might want to try executing an instable Iperf test, and still mark the CI as passing if it fails. This commit introduces a generic "may_fail" option that will mark any CI test as succeeded, despite having failed. Ideally, we would print a warning in the HTML code, but this is not possible because each step emits its own HTML code, instead of the main loop handling this. We can improve this in the future. --- ci-scripts/main.py | 5 ++++- ci-scripts/tests/test-runner/test.xml | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 333d515858..7aef60fa2a 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -626,6 +626,7 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re HTML.testCase_id=CiTestObj.testCase_id CiTestObj.desc = test.findtext('desc') always_exec = test.findtext('always_exec') in ['True', 'true', 'Yes', 'yes'] + may_fail = test.findtext('may_fail') in ['True', 'true', 'Yes', 'yes'] HTML.desc=CiTestObj.desc action = test.findtext('class') if (CheckClassValidity(xml_class_list, action, id) == False): @@ -639,7 +640,9 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re break try: test_succeeded = ExecuteActionWithParam(action) - if not test_succeeded: + if not test_succeeded and may_fail: + logging.warning(f"test ID {test_case_id} action {action} may or may not fail, proceeding despite error") + elif not test_succeeded: logging.error(f"test ID {test_case_id} action {action} failed ({test_succeeded}), skipping next tests") task_set_succeeded = False except Exception as e: diff --git a/ci-scripts/tests/test-runner/test.xml b/ci-scripts/tests/test-runner/test.xml index d5efacfdae..ec2515ec11 100644 --- a/ci-scripts/tests/test-runner/test.xml +++ b/ci-scripts/tests/test-runner/test.xml @@ -27,6 +27,8 @@ wrench 000001 + 000011 + 000012 000002 000003 000004 @@ -41,6 +43,23 @@ yes + + Custom_Command + This may fail + true + localhost + false + yes + + + + Custom_Command + This is still executed + localhost + true + yes + + Custom_Command This should fail