criu/test/zdtm/static/macvlan.hook
Tycho Andersen 043a9c9020 test: use .pid.inprogress file for macvlan test
Note, this depends on Pavel's patch here:
https://lists.openvz.org/pipermail/criu/2016-October/032499.html which is
not yet applied.

travis-ci: success for test: use .pid.inprogress file for macvlan test (rev2)
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-11-03 18:15:03 +03:00

33 lines
695 B
Bash
Executable file

#!/bin/bash
[ "$1" == "--clean" -o "$1" == "--pre-restore" -o "$1" == "--post-start" ] || exit 0
if [ "$1" == "--post-start" ]; then
set -e
i=0
PIDF="zdtm/static/macvlan.pid.inprogress"
while [ ! -f "$PIDF" ]; do
i=$(($i+1))
if [ "$i" -eq "10" ]; then
echo "failed to create macvlan test"
exit 1
fi
sleep 1
done
TPID=$(cat $PIDF)
ip link add zdtmbr0 type bridge
ip addr add 10.0.55.55/32 dev zdtmbr0
ip link set zdtmbr0 up
ip link add zdtmmvlan0 link zdtmbr0 type macvlan mode bridge
ip addr add 10.0.55.56/32 dev zdtmmvlan0
ip link set zdtmmvlan0 netns $TPID
else
ip link del zdtmmvlan0 || true
[ "$1" == "--clean" ] || exit 0
ip link del zdtmbr0 || true
fi