Adjust for new ifconfig output

And use -o match to provide informative error messages.
This commit is contained in:
ozaki-r 2016-09-16 00:14:33 +00:00
parent 93353c360b
commit 2393c05ab0

View File

@ -1,4 +1,4 @@
# $NetBSD: t_dad.sh,v 1.5 2016/08/10 23:07:57 kre Exp $
# $NetBSD: t_dad.sh,v 1.6 2016/09/16 00:14:33 ozaki-r Exp $
#
# Copyright (c) 2015 The NetBSD Foundation, Inc.
# All rights reserved.
@ -180,7 +180,8 @@ dad_duplicated_body()
export RUMP_SERVER=$SOCKLOCAL
# The primary address isn't marked as duplicated
atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip1 |grep -q duplicated"
atf_check -s exit:0 -o not-match:'DUPLICATED' \
-x "rump.ifconfig shmif0 |grep $localip1"
#
# Add a new address duplicated with the peer server
@ -189,12 +190,14 @@ dad_duplicated_body()
atf_check -s exit:0 sleep 1
# The new address is marked as duplicated
atf_check -s exit:0 -x "rump.ifconfig shmif0 |grep $peerip |grep -q duplicated"
atf_check -s exit:0 -o match:'DUPLICATED' \
-x "rump.ifconfig shmif0 |grep $peerip"
# A unique address isn't marked as duplicated
atf_check -s exit:0 rump.ifconfig shmif0 inet6 $localip2
atf_check -s exit:0 sleep 1
atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip2 |grep -q duplicated"
atf_check -s exit:0 -o not-match:'DUPLICATED' \
-x "rump.ifconfig shmif0 |grep $localip2"
}
cleanup()