Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/net/if Add ATF test for a description.



details:   https://anonhg.NetBSD.org/src/rev/f086cfd6c80e
branches:  trunk
changeset: 461743:f086cfd6c80e
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Thu Jul 04 02:46:40 2019 +0000

description:
Add ATF test for a description.

>From t-kusaba@IIJ

diffstat:

 tests/net/if/t_ifconfig.sh |  37 ++++++++++++++++++++++++++++++++++++-
 1 files changed, 36 insertions(+), 1 deletions(-)

diffs (56 lines):

diff -r 0320786b7131 -r f086cfd6c80e tests/net/if/t_ifconfig.sh
--- a/tests/net/if/t_ifconfig.sh        Thu Jul 04 02:45:45 2019 +0000
+++ b/tests/net/if/t_ifconfig.sh        Thu Jul 04 02:46:40 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_ifconfig.sh,v 1.19 2019/05/13 17:55:08 bad Exp $
+# $NetBSD: t_ifconfig.sh,v 1.20 2019/07/04 02:46:40 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -478,6 +478,40 @@
        cleanup
 }
 
+atf_test_case ifconfig_description cleanup
+ifconfig_description_head()
+{
+       atf_set "descr" "tests of setting and unsetting interface description"
+       atf_set "require.progs" "rump_server"
+}
+
+ifconfig_description_body()
+{
+
+       rump_server_start $RUMP_SERVER1
+
+       export RUMP_SERVER=$RUMP_SERVER1
+       for descr in description descr; do
+               atf_check -s exit:0 rump.ifconfig lo0 $descr DESCRIPTION-TEST
+               atf_check -s exit:0 -o match:"DESCRIPTION-TEST" rump.ifconfig lo0
+               atf_check -s exit:0 rump.ifconfig lo0 $descr DESCRIPTION-TEST-MODIFIED
+               atf_check -s exit:0 -o match:"DESCRIPTION-TEST-MODIFIED" rump.ifconfig lo0
+               atf_check -s exit:0 rump.ifconfig lo0 -$descr
+               atf_check -s exit:0 -o not-match:'DESCRIPTION-TEST-MODIFIED' rump.ifconfig lo0
+
+               atf_check -s exit:0 rump.ifconfig lo0 $descr `printf "%063d" 0` 
+               atf_check -s not-exit:0 -e match:"description too long" rump.ifconfig lo0 $descr `printf "%064d" 0`
+               atf_check -s exit:0 rump.ifconfig lo0 $descr ""
+       done
+}
+
+ifconfig_description_cleanup()
+{
+
+       $DEBUG && dump
+       cleanup
+}
+
 atf_init_test_cases()
 {
 
@@ -487,4 +521,5 @@
        atf_add_test_case ifconfig_up_down_ipv4
        atf_add_test_case ifconfig_up_down_ipv6
        atf_add_test_case ifconfig_number
+       atf_add_test_case ifconfig_description
 }



Home | Main Index | Thread Index | Old Index