library/Misc_Helpers: add f_osmo_repo_is()
Create functions to check which from Osmocom repository the SUT is
running. Put it in Misc_Helpers instead of a new library file since
Misc_Helpers is already available in many/all? tests and it fits there
too.
Depends: docker-playground Ic06532f7a67e59458652c5cf4c8f6fee8113e703
Related: OS#5327
Change-Id: Ic33d08992ea84af006d133db6aec508a7b7c7f28
diff --git a/library/Misc_Helpers.ttcn b/library/Misc_Helpers.ttcn
index a402525..e01c170 100644
--- a/library/Misc_Helpers.ttcn
+++ b/library/Misc_Helpers.ttcn
@@ -1,5 +1,22 @@
module Misc_Helpers {
+modulepar {
+ charstring mp_osmo_repo := "nightly";
+}
+
+/* Test the Osmocom repository (nightly, latest, 2021q4, ...), from which the
+ * SUT is running (OS#4878). Usage examples:
+ * if (Misc_Helpers.f_osmo_repo_is("nightly")) {
+ * ...
+ * }
+ * if (Misc_Helpers.f_osmo_repo_is(("nightly", "2021q4"))) {
+ * ...
+ * }
+ */
+function f_osmo_repo_is(template charstring ver) return boolean {
+ return match(mp_osmo_repo, ver);
+}
+
/* Try to properly shutdown a testcase.
* The reliable method to stop a testcase without running into dynamic
* testcase errors due to unconnected ports receiving messages is to call