aboutsummaryrefslogtreecommitdiffstats
path: root/ttcn3-bsc-test
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2021-02-19 15:14:42 +0100
committerOliver Smith <osmith@sysmocom.de>2021-02-26 09:32:06 +0100
commit12b961942af0c6761573d0632ca0e16339fb33c3 (patch)
tree10d288c549c0b2edead03086ed14ad3fb7617b62 /ttcn3-bsc-test
parentc63a131a600f1e93383e6e0b3904992b64f8c4e0 (diff)
jenkins-common.sh: add common clean up trap
Add set_clean_up_trap() in jenkins-common.sh and run it at the beginning of the jenkins.sh files. Move the common clean up code from the end of every jenkins.sh file into clean_up_common(), which gets called by the trap. Add a custom clean_up() function to those jenkins.sh files that need additional clean up. Replace explicit container stop commands (for containers attached to the docker network) with one call to network_clean() in clean_up_common(). It kills all containers attached to the docker network. The motivation for this change is the upcoming optional build of initrd and kernel during ttcn3-ggsn-test/jenkins.sh. After building these, a short smoke test will be performed to make sure we can boot the kernel and initrd, before continuing to run the entire testsuite against it. If building or the smoke test fails, we must do a proper clean up of the network and fix permissions. Related: OS#3208 Change-Id: I807c6221d22fec31db23e2516e477a3eb43347fb
Diffstat (limited to 'ttcn3-bsc-test')
-rwxr-xr-xttcn3-bsc-test/jenkins-sccplite.sh11
-rwxr-xr-xttcn3-bsc-test/jenkins.sh12
2 files changed, 4 insertions, 19 deletions
diff --git a/ttcn3-bsc-test/jenkins-sccplite.sh b/ttcn3-bsc-test/jenkins-sccplite.sh
index c040a0a..9bb49fb 100755
--- a/ttcn3-bsc-test/jenkins-sccplite.sh
+++ b/ttcn3-bsc-test/jenkins-sccplite.sh
@@ -7,6 +7,8 @@ docker_images_require \
"osmo-bts-$IMAGE_SUFFIX" \
"ttcn3-bsc-test"
+set_clean_up_trap
+
#Make sure NET_NAME doesn't clash with the AoIP BSC test
NET_NAME=ttcn3-bsc_sccplite-test
@@ -48,12 +50,3 @@ docker run --rm \
--name ${BUILD_TAG}-ttcn3-bsc-test \
$DOCKER_ARGS \
$REPO_USER/ttcn3-bsc-test
-
-echo Stopping containers
-for i in `seq 0 2`; do
- docker container kill ${BUILD_TAG}-bts$i
-done
-docker container kill ${BUILD_TAG}-bsc
-
-network_remove
-collect_logs
diff --git a/ttcn3-bsc-test/jenkins.sh b/ttcn3-bsc-test/jenkins.sh
index a807c49..460ab38 100755
--- a/ttcn3-bsc-test/jenkins.sh
+++ b/ttcn3-bsc-test/jenkins.sh
@@ -8,6 +8,8 @@ docker_images_require \
"osmo-bts-$IMAGE_SUFFIX" \
"ttcn3-bsc-test"
+set_clean_up_trap
+
mkdir $VOL_BASE_DIR/bsc-tester
cp BSC_Tests.cfg $VOL_BASE_DIR/bsc-tester/
@@ -62,13 +64,3 @@ docker run --rm \
--name ${BUILD_TAG}-ttcn3-bsc-test \
$DOCKER_ARGS \
$REPO_USER/ttcn3-bsc-test
-
-echo Stopping containers
-for i in `seq 0 2`; do
- docker container kill ${BUILD_TAG}-bts$i
-done
-docker container kill ${BUILD_TAG}-bsc
-docker container kill ${BUILD_TAG}-stp
-
-network_remove
-collect_logs