mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
test: hsr: Remove script code already implemented in lib.sh
Some parts (like netns creation and cleanup) of hsr_ping.sh script are already implemented in ../lib.sh common script, so can be replaced by it. Signed-off-by: Lukasz Majewski <lukma@denx.de> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
5055cccfc2
commit
680fda4f67
@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
|
||||||
|
source ../lib.sh
|
||||||
ret=0
|
ret=0
|
||||||
ksft_skip=4
|
ksft_skip=4
|
||||||
ipv6=true
|
ipv6=true
|
||||||
@ -27,19 +28,7 @@ while getopts "$optstring" option;do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
sec=$(date +%s)
|
setup_ns ns1 ns2 ns3
|
||||||
rndh=$(printf %x $sec)-$(mktemp -u XXXXXX)
|
|
||||||
ns1="ns1-$rndh"
|
|
||||||
ns2="ns2-$rndh"
|
|
||||||
ns3="ns3-$rndh"
|
|
||||||
|
|
||||||
cleanup()
|
|
||||||
{
|
|
||||||
local netns
|
|
||||||
for netns in "$ns1" "$ns2" "$ns3" ;do
|
|
||||||
ip netns del $netns
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# $1: IP address
|
# $1: IP address
|
||||||
is_v6()
|
is_v6()
|
||||||
@ -254,21 +243,10 @@ if [ $? -ne 0 ];then
|
|||||||
exit $ksft_skip
|
exit $ksft_skip
|
||||||
fi
|
fi
|
||||||
|
|
||||||
trap cleanup EXIT
|
trap cleanup_all_ns EXIT
|
||||||
|
|
||||||
for i in "$ns1" "$ns2" "$ns3" ;do
|
|
||||||
ip netns add $i || exit $ksft_skip
|
|
||||||
ip -net $i link set lo up
|
|
||||||
done
|
|
||||||
|
|
||||||
setup_hsr_interfaces 0
|
setup_hsr_interfaces 0
|
||||||
do_complete_ping_test
|
do_complete_ping_test
|
||||||
cleanup
|
|
||||||
|
|
||||||
for i in "$ns1" "$ns2" "$ns3" ;do
|
|
||||||
ip netns add $i || exit $ksft_skip
|
|
||||||
ip -net $i link set lo up
|
|
||||||
done
|
|
||||||
|
|
||||||
setup_hsr_interfaces 1
|
setup_hsr_interfaces 1
|
||||||
do_complete_ping_test
|
do_complete_ping_test
|
||||||
|
Loading…
Reference in New Issue
Block a user