osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40335?usp=email )
Change subject: testenv: check eclipse-titan version ......................................................................
testenv: check eclipse-titan version
The osmocom:latest repository currently has eclipse-titan 9.0.0 and we assume that the user has at least this version installed. Add a check to avoid subtle unexpected errors caused by using older versions.
Related: I57eecd6e0ea9e488a2110b029ddc313bd05cd1fa Change-Id: Icace325f492ce803d6f25a30b128ee0676e16727 --- M _testenv/testenv/requirements.py 1 file changed, 27 insertions(+), 0 deletions(-)
Approvals: fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified
diff --git a/_testenv/testenv/requirements.py b/_testenv/testenv/requirements.py index cd320d5..5ab61ad 100644 --- a/_testenv/testenv/requirements.py +++ b/_testenv/testenv/requirements.py @@ -1,8 +1,10 @@ # Copyright 2024 sysmocom - s.f.m.c. GmbH # SPDX-License-Identifier: GPL-3.0-or-later +from packaging.version import Version import logging import os.path import shutil +import subprocess import sys import testenv import testenv.cmd @@ -69,6 +71,30 @@ sys.exit(1)
+def check_ttcn3_compiler_version(): + if testenv.args.podman: + return + + ttcn3_min_version = "9.0.0" + + v = subprocess.run(["ttcn3_compiler", "-v"], capture_output=True, text=True) + current = None + for line in v.stderr.split("\n"): + if not line.startswith("Version: "): + continue + + current = line.split(":", 1)[1].strip() + if Version(current) >= Version(ttcn3_min_version): + return + + logging.error(f"Found ttcn3_compiler version {current}, but {ttcn3_min_version} or higher is required.") + + if not current: + logging.error("Could not parse ttcn3_compiler version.") + logging.error(f"Please install at least version {ttcn3_min_version} and try again.") + sys.exit(1) + + def check_fftranscode(): cmd = [ "grep", @@ -98,6 +124,7 @@
def check(): check_programs() + check_ttcn3_compiler_version()
if not testenv.args.podman: check_fftranscode()