osmith has submitted this change. (
https://gerrit.osmocom.org/c/osmo-dev/+/15778 )
Change subject: ttcn3: run ttcn3 testsuites from osmo-dev
..
ttcn3: run ttcn3 testsuites from osmo-dev
Build testsuite, SUT and dependencies and run everything with one
command. Example usage:
$ ./ttcn3/ttcn3.sh msc
So far, it works at least with:
hlr, mgw, msc, pcu, pcu-sns, sgsn
Change-Id: I6b4bf2743adeec1a950d5f090a690182b991cf49
---
M .gitignore
M README
A ttcn3/ttcn3.opts
A ttcn3/ttcn3.sh
A ttcn3/wrappers/fake_trx.sh
A ttcn3/wrappers/osmo-bts-trx-respawn.sh
A ttcn3/wrappers/osmo-pcu-respawn.sh
7 files changed, 428 insertions(+), 0 deletions(-)
Approvals:
neels: Looks good to me, approved
osmith: Verified
diff --git a/.gitignore b/.gitignore
index 1cfde3d..6326775 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,3 +14,6 @@
!net/config_2g3g
!net/README
!net/fill_config.py
+ttcn3/3G+2G_ttcn3.deps
+ttcn3/out/
+ttcn3/make/
diff --git a/README b/README
index 9533d89..055f651 100644
--- a/README
+++ b/README
@@ -132,6 +132,26 @@
Find other useful scripts in src/, see src/README.
+=== ttcn3/ttcn3.sh
+
+Clone and build all dependencies, then run a given TTCN-3 testsuite and all
+required components. This is intended to make test-cycles as short as possible,
+without any manual configuration effort and without the need to rebuild the
+entire testsuite, SUT (subject under test, e.g. osmo-mgw) and dependencies from
+scratch for each code change. Instead, ttcn3.sh will make use of osmo-dev's
+generated global makefile and only build what actually changed.
+
+Example usage:
+
+ ./ttcn3/ttcn3.sh mgw
+
+Note that not all testsuites are supported at this point, see the output of
+ttcn3.sh without any argument for more information.
+
+More about the testsuites:
+https://osmocom.org/projects/cellular-infrastructure/wiki/Titan_TTCN3_Testsuites
+
+
=== Troubleshooting
When using sanitize.opts, osmo-trx is not built with the address sanitizer
diff --git a/ttcn3/ttcn3.opts b/ttcn3/ttcn3.opts
new file mode 100644
index 000..8acec2d
--- /dev/null
+++ b/ttcn3/ttcn3.opts
@@ -0,0 +1 @@
+osmo-bts --enable-trx
diff --git a/ttcn3/ttcn3.sh b/ttcn3/ttcn3.sh
new file mode 100755
index 000..4cb4344
--- /dev/null
+++ b/ttcn3/ttcn3.sh
@@ -0,0 +1,369 @@
+#!/bin/sh -e
+PROJECT="$1"
+PROJECT_UPPER="$(echo "$PROJECT" | tr '[:lower:]' '[:upper:]')"
+DIR_OSMODEV="$(readlink -f "$(dirname $0)/..")"
+DIR_MAKE="${DIR_MAKE:-${DIR_OSMODEV}/ttcn3/make}"
+DIR_OUTPUT="${DIR_OUTPUT:-${DIR_OSMODEV}/ttcn3/out}"
+JOBS="${JOBS:-9}"
+
+check_usage() {
+ if [ -z "$PROJECT" ]; then
+ echo "usage: $(basename $0) PROJECT"
+ echo "example: $(basename $0) hlr"
+ echo "known working projects: hlr, mgw, msc, pcu, pcu-sns, sgsn"
+ echo "wip: bts, bts-oml"
+ echo ""
+ echo "notes (see docker-playground.git/ttcn3-*/jenkins.sh):"
+ echo "- bts: classic test suite with BSC for OML and
trxcon+fake_trx"
+ echo "- bts-oml: OML tests (without BSC)"
+ exit 1
+ fi
+}
+
+# Returns the name of the testsuite binary
+get_testsuite_name() {
+ case "$PROJECT" in
+ bts-*) echo "BTS_Tests" ;;
+ mgw) echo "MGCP_Test" ;;
+ pcu-sns) echo "PCU_Tests" ;;
+ *) echo "${PROJECT_UPPER}_Tests" ;;
+ esac
+}
+
+get_testsuite_dir() {
+ local hacks="${DIR_OSMODEV}/src/osmo-ttcn3-hacks"
+
+ case "$PROJECT" in
+ bts-*) echo "$hacks/bts" ;;
+ pcu-sns) echo "$hacks/pcu" ;;
+ *) echo "$hacks/$PROJECT" ;;
+ esac
+}
+
+get_testsuite_config() {
+ case "$PROJECT" in
+ bts-gprs) echo "BTS_Tests_GPRS.cfg" ;;
+ bts-oml) echo "BTS_Tests_OML.cfg" ;;
+ pcu-sns) echo "PCU_Tests_SNS.cfg" ;;
+ *) echo "$(get_testsuite_name).cfg" ;;
+ esac
+}
+
+# Programs that need to be built, launched and killed. To add programs to only
one of the steps, modify the appropriate
+# function below (build_osmo_programs, run_osmo_programs, kill_osmo_programs).
+get_programs() {
+ case "$PROJECT" in
+ bsc) echo "osmo-stp osmo-bsc osmo-bts-omldummy" ;;
+ bts) echo "osmo-bsc osmo-bts-trx fake_trx.py trxcon" ;;
+ msc) echo "osmo-stp osmo-msc" ;;
+ pcu-sns) echo "osmo-pcu" ;;
+ pcu) echo "osmo-pcu osmo-bsc osmo-bts-virtual virtphy" ;;
+ sgsn) echo "osmo-stp osmo-sgsn" ;;
+ *) echo "osmo-$PROJECT" ;;
+ esac
+}
+
+# $1: program name
+get_program_config() {
+ case "$1" in
+ fake_trx.py) ;; # no config
+ osmo-bts-*) echo "osmo-bts.cfg" ;;
+ osmo-pcu)
+ if [ "$PROJECT" = "pcu-sns" ]; then
+ echo "osmo-pcu-sns.cfg"
+