aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2021-02-03 22:05:43 +0100
committerHarald Welte <laforge@osmocom.org>2021-02-03 22:20:20 +0100
commit4b8931d210bcef4a0cf80d82e1c9138f46abe098 (patch)
tree7659236cd7d28a8d95e9e0ca865ffdcfb8fc885c
parent18564ba9c2bd0061d283c3cf3a9fbd42d6ab2dc1 (diff)
gbproxy-fr: Wait for interface to be _up_ not just its existancelaforge/fr
I've seen at least one instance where -EIFDOWN was returned when the test suite was coming up. This is a race condition, as we first have to move the netdev into the namespace and only then can configure it. "pipework wait" only waits for its existence, not until it is up. We cannot revert the order, as the netdev looses its state when it is moved to a different netns. Change-Id: I1bfb6eb925bca4e4e1901e06eed831152cddbbe2
-rwxr-xr-xttcn3-fr-test/docker-entrypoint.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/ttcn3-fr-test/docker-entrypoint.sh b/ttcn3-fr-test/docker-entrypoint.sh
index 132c73c..1215f6a 100755
--- a/ttcn3-fr-test/docker-entrypoint.sh
+++ b/ttcn3-fr-test/docker-entrypoint.sh
@@ -5,7 +5,21 @@ SUBDIR=$1
SUITE=$2
if [[ -n ${WAIT_FOR_NETDEV:-} ]]; then
+ echo Waiting for ${WAIT_FOR_NETDEV} to appear
+ # this unfortunately only waits until the device exists
/usr/bin/pipework --wait -i ${WAIT_FOR_NETDEV}
+ # here we have to wait until it is up
+ while true; do
+ if [ ! -f /sys/class/net/${WAIT_FOR_NETDEV}/operstate ]; then
+ exit 23
+ fi
+ OPSTATE=`cat /sys/class/net/${WAIT_FOR_NETDEV}/operstate`
+ if [ "$OPSTATE" == "up" ]; then
+ break
+ fi
+ echo Waiting for ${WAIT_FOR_NETDEV} to become operational
+ sleep 1
+ done
fi
cd /data && /osmo-ttcn3-hacks/start-testsuite.sh /osmo-ttcn3-hacks/$SUBDIR/$SUITE; \