From 516583405176d5a73543f1bd273a94362d64fa8c Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 26 Feb 2026 13:36:17 +0100 Subject: [PATCH] Introduce EndsWithBye log analysis check It was initially foreseen to just check the program exit code, but most executables don't return with 0 (so the CI would always fail). Add a separate check that will check for the Bye., only going through the last X lines instead of the entire file. --- ci-scripts/cls_loganalysis.py | 13 +++++++++++++ ci-scripts/tests/log-analysis.py | 17 +++++++++++++++++ ci-scripts/tests/log-analysis/with-bye.log | 3 +++ 3 files changed, 33 insertions(+) create mode 100644 ci-scripts/tests/log-analysis/with-bye.log diff --git a/ci-scripts/cls_loganalysis.py b/ci-scripts/cls_loganalysis.py index 38c36202bd..b28e217707 100644 --- a/ci-scripts/cls_loganalysis.py +++ b/ci-scripts/cls_loganalysis.py @@ -53,6 +53,19 @@ class LastLineContains: log = "" if success else f"could not find '{string}' in last line" return success, log +class EndsWithBye: + def run(file, option): + # no option: we ignore any + with open(file, "r") as f: + n = 0 + for line in reversed(f.readlines()): + if re.search(r'^Bye.\n', line, re.MULTILINE) is not None: + return True, "" + n = n + 1 + if n > 50: # if not found in last 50 lines, assume it does not exist + break + return False, "No Bye. message found, did not stop properly" + class RetxCheck(): def _parseList(s): if not s: diff --git a/ci-scripts/tests/log-analysis.py b/ci-scripts/tests/log-analysis.py index a4416305a8..2df23483d3 100644 --- a/ci-scripts/tests/log-analysis.py +++ b/ci-scripts/tests/log-analysis.py @@ -110,5 +110,22 @@ UE 257a: ulsch_rounds 41777/2863/10/0, ulsch_errors 0, ulsch_DTX 17, BLER 0.1145 self.assertTrue(result) self.assertEqual(log, expected) + def test_ends_no_bye(self): + f = "tests/log-analysis/arbitrary.log" + opt = None + result, log = cls_loganalysis.EndsWithBye.run(f, opt) + expected = "No Bye. message found, did not stop properly" + self.assertFalse(result) + self.assertEqual(log, expected) + + def test_ends_with_bye(self): + f = "tests/log-analysis/with-bye.log" + opt = None + result, log = cls_loganalysis.EndsWithBye.run(f, opt) + expected = "" + self.assertTrue(result) + self.assertEqual(log, expected) + + if __name__ == '__main__': unittest.main() diff --git a/ci-scripts/tests/log-analysis/with-bye.log b/ci-scripts/tests/log-analysis/with-bye.log new file mode 100644 index 0000000000..22abbfab05 --- /dev/null +++ b/ci-scripts/tests/log-analysis/with-bye.log @@ -0,0 +1,3 @@ +Some other logs +Bye. +process exited.