The point of the pause-on-fail argument is to leave the setup as is after
a test fails to allow a user to debug why it failed. Move the cleanup
after posting the result to the user to make it so.
Random names for the namespaces are not user friendly when trying to
debug a failure. Make them simpler and more direct for the tests. Run
cleanup at the beginning to ensure they are cleaned up if they already
exist.
Remove cleanup_done. There is no harm in doing cleanup twice; just
ignore any errors related to not existing - which is already done.
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
cleanup_ipv4_exception ipv4: cleanup of cached exceptions
cleanup_ipv6_exception ipv6: cleanup of cached exceptions"
cleanup_ipv4_exception ipv4: cleanup of cached exceptions
cleanup_ipv6_exception ipv6: cleanup of cached exceptions"
-NS_A="ns-$(mktemp -u XXXXXX)"
-NS_B="ns-$(mktemp -u XXXXXX)"
-NS_R1="ns-$(mktemp -u XXXXXX)"
-NS_R2="ns-$(mktemp -u XXXXXX)"
+NS_A="ns-A"
+NS_B="ns-B"
+NS_R1="ns-R1"
+NS_R2="ns-R2"
ns_a="ip netns exec ${NS_A}"
ns_b="ip netns exec ${NS_B}"
ns_r1="ip netns exec ${NS_R1}"
ns_a="ip netns exec ${NS_A}"
ns_b="ip netns exec ${NS_B}"
ns_r1="ip netns exec ${NS_R1}"
dummy6_1_addr="fc00:1001::0"
dummy6_mask="64"
dummy6_1_addr="fc00:1001::0"
dummy6_mask="64"
setup() {
[ "$(id -u)" -ne 0 ] && echo " need to run as root" && return $ksft_skip
setup() {
[ "$(id -u)" -ne 0 ] && echo " need to run as root" && return $ksft_skip
for arg do
eval setup_${arg} || { echo " ${arg} not supported"; return 1; }
done
for arg do
eval setup_${arg} || { echo " ${arg} not supported"; return 1; }
done
- [ ${cleanup_done} -eq 1 ] && return
for n in ${NS_A} ${NS_B} ${NS_R1} ${NS_R2}; do
ip netns del ${n} 2> /dev/null
done
for n in ${NS_A} ${NS_B} ${NS_R1} ${NS_R2}; do
ip netns del ${n} 2> /dev/null
done
+# start clean
+cleanup
+
for t in ${tests}; do
[ $desc -eq 0 ] && name="${t}" && desc=1 && continue || desc=0
for t in ${tests}; do
[ $desc -eq 0 ] && name="${t}" && desc=1 && continue || desc=0
if [ $ret -eq 0 ]; then
printf "TEST: %-60s [ OK ]\n" "${t}"
if [ $ret -eq 0 ]; then
printf "TEST: %-60s [ OK ]\n" "${t}"