osmith has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39992?usp=email )
Change subject: ns: initial testenv config
......................................................................
ns: initial testenv config
Change-Id: I7b0d81db49dae0a3bb3d4c3b36fd3f8b4b590760
---
A _testenv/data/scripts/build_osmo_ns_dummy.sh
M _testenv/testenv/podman_install.py
A ns/run_osmo_ns_dummy.sh
A ns/testenv_sgsn_sns.cfg
A ns/testenv_sns.cfg
A ns/testenv_udp.cfg
6 files changed, 75 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/92/39992/1
diff --git a/_testenv/data/scripts/build_osmo_ns_dummy.sh
b/_testenv/data/scripts/build_osmo_ns_dummy.sh
new file mode 100755
index 0000000..12a6a43
--- /dev/null
+++ b/_testenv/data/scripts/build_osmo_ns_dummy.sh
@@ -0,0 +1,14 @@
+#!/bin/sh -ex
+# Script used by testenv/podman_install:from_source_osmo_ns_dummy() to build
+# osmo-ns-dummy in libosmocore from git when running with "--binary-repo".
This
+# is needed, because osmo-ns-dummy is not packaged.
+MAKE="make -j$1"
+
+$MAKE -C include/osmocom/core all
+$MAKE -C src/core libosmocore.la
+$MAKE -C src/vty libosmovty.la
+$MAKE -C src/isdn libosmoisdn.la
+$MAKE -C src/gsm libosmogsm.la
+$MAKE -C src/gb libosmogb.la
+$MAKE -C src/ctrl libosmoctrl.la
+$MAKE -C utils osmo-ns-dummy
diff --git a/_testenv/testenv/podman_install.py b/_testenv/testenv/podman_install.py
index 27b08b4..66777a6 100644
--- a/_testenv/testenv/podman_install.py
+++ b/_testenv/testenv/podman_install.py
@@ -166,10 +166,33 @@
testenv.cmd.run(["ln", "-s", sccp_demo_user_path,
"/usr/local/bin/sccp_demo_user"])
+def from_source_osmo_ns_dummy():
+ libosmocore_dir = os.path.join(git_dir, "libosmocore")
+ osmo_ns_dummy_path = os.path.join(libosmocore_dir, "utils/osmo-ns-dummy")
+
+ if not os.path.exists(osmo_ns_dummy_path):
+ clone_project("libosmocore")
+ logging.info("Building osmo-ns-dummy")
+ testenv.cmd.run(["autoreconf", "-fi"], cwd=libosmocore_dir)
+
+ configure_cmd = ["./configure"]
+ if testenv.args.binary_repo.endswith(":asan"):
+ configure_cmd += ["--enable-sanitize"]
+ testenv.cmd.run(configure_cmd, cwd=libosmocore_dir)
+
+ testenv.cmd.run(
+ [os.path.join(testenv.data_dir, "scripts/build_osmo_ns_dummy.sh"),
str(jobs)], cwd=libosmocore_dir
+ )
+
+ testenv.cmd.run(["ln", "-s", osmo_ns_dummy_path,
"/usr/local/bin/osmo-ns-dummy"])
+
+
def from_source(cfg, cfg_name, section):
program = cfg[section]["program"].split(" ", 1)[0]
if program == "run_sccp_demo_user.sh":
return from_source_sccp_demo_user()
+ if program == "run_osmo_ns_dummy.sh":
+ return from_source_osmo_ns_dummy()
logging.error(f"Can't install {section}! Fix this by either:")
logging.error(f"* Adding package= to [{section}] in {cfg_name}")
diff --git a/ns/run_osmo_ns_dummy.sh b/ns/run_osmo_ns_dummy.sh
new file mode 100755
index 0000000..5a8cc05
--- /dev/null
+++ b/ns/run_osmo_ns_dummy.sh
@@ -0,0 +1,11 @@
+#!/bin/sh -ex
+
+if [ -n "$OSMO_DEV_MAKE_DIR" ]; then
+ # Using osmo-dev: either with or without --podman
+ exec "$OSMO_DEV_MAKE_DIR"/libosmocore/utils/osmo-ns-dummy "$@"
+fi
+
+# Using binary packages: as osmo-ns-dummy is not packaged it gets built by
+# testenv/podman_install.py:from_source_osmo_ns_dummy() and symlinked to
+# /usr/local/bin.
+exec osmo-ns-dummy "$@"
diff --git a/ns/testenv_sgsn_sns.cfg b/ns/testenv_sgsn_sns.cfg
new file mode 100644
index 0000000..8037d78
--- /dev/null
+++ b/ns/testenv_sgsn_sns.cfg
@@ -0,0 +1,9 @@
+[testsuite]
+program=NS_Tests
+config=NS_Tests.sgsn.sns.cfg
+
+[osmo-ns-dummy]
+program=run_osmo_ns_dummy.sh -p 4240 -c osmo-ns.sgsn.sns.cfg
+make=libosmocore
+copy=osmo-ns.sgsn.sns.cfg
+vty_port=4240
diff --git a/ns/testenv_sns.cfg b/ns/testenv_sns.cfg
new file mode 100644
index 0000000..c19dfba
--- /dev/null
+++ b/ns/testenv_sns.cfg
@@ -0,0 +1,9 @@
+[testsuite]
+program=NS_Tests
+config=NS_Tests.sns.cfg
+
+[osmo-ns-dummy]
+program=run_osmo_ns_dummy.sh -p 4240 -c osmo-ns.sns.cfg
+make=libosmocore
+copy=osmo-ns.sns.cfg
+vty_port=4240
diff --git a/ns/testenv_udp.cfg b/ns/testenv_udp.cfg
new file mode 100644
index 0000000..7d6e82b
--- /dev/null
+++ b/ns/testenv_udp.cfg
@@ -0,0 +1,9 @@
+[testsuite]
+program=NS_Tests
+config=NS_Tests.udp.cfg
+
+[osmo-ns-dummy]
+program=run_osmo_ns_dummy.sh -p 4240 -c osmo-ns.udp.cfg
+make=libosmocore
+copy=osmo-ns.udp.cfg
+vty_port=4240
--
To view, visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39992?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I7b0d81db49dae0a3bb3d4c3b36fd3f8b4b590760
Gerrit-Change-Number: 39992
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>