osmith submitted this change.

View Change

Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve
ttcn3-bts-test: show respawn count at the end

As mentioned in the last commit, we currently must use respawn.sh to be
able to recover from clock skew errors seen in jenkins. Let's display
the respawn count at the end as warning.

Related: OS#6794
Change-Id: I4e5c3dd46ec682bfd79f2328195b0050fe3f186d
---
M common/respawn.sh
M ttcn3-bts-test/jenkins.sh
2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/common/respawn.sh b/common/respawn.sh
index 31a8c06..d9bf641 100755
--- a/common/respawn.sh
+++ b/common/respawn.sh
@@ -7,7 +7,7 @@
i=0
max_i=500
while [ $i -lt $max_i ]; do
- echo "$i: starting: $*"
+ echo "respawn: $i: starting: $*"
$* &
LAST_PID=$!
wait $LAST_PID
diff --git a/ttcn3-bts-test/jenkins.sh b/ttcn3-bts-test/jenkins.sh
index 5d5629d..1d4211f 100755
--- a/ttcn3-bts-test/jenkins.sh
+++ b/ttcn3-bts-test/jenkins.sh
@@ -229,6 +229,27 @@
docker_kill_wait ${BUILD_TAG}-bts
}

+show_respawn_count() {
+ set +x
+ local count=$(grep -P 'respawn: \d+: starting: ' "$VOL_BASE_DIR"/bts/osmo-bts.log | wc -l)
+ # Currently we run generic/bts/oml configurations, which means 3
+ # restarts are expected.
+ local count_exp=3
+
+ if [ "$count" = "$count_exp" ]; then
+ echo "osmo-bts was respawned $count times (as expected)"
+ return
+ fi
+
+ printf '\033[0;31m' # set color to red
+ echo
+ echo "================================================================"
+ echo " WARNING: osmo-bts was respawned $count times (expected: $count_exp)! (OS#6794)"
+ echo "================================================================"
+ echo
+ printf '\033[0m'
+}
+
network_create

mkdir $VOL_BASE_DIR/bts-tester-generic
@@ -272,3 +293,7 @@
start_config_virtphy
start_config_oml
start_config_hopping
+
+# Show respawn count at the very end
+clean_up_common
+show_respawn_count

To view, visit change 40784. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I4e5c3dd46ec682bfd79f2328195b0050fe3f186d
Gerrit-Change-Number: 40784
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>