Source-Changes-HG archive

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

[src/trunk]: src/tests/usr.bin/config config(1): Briefly test ioconf.c output



details:   https://anonhg.NetBSD.org/src/rev/e8fddb72f2a8
branches:  trunk
changeset: 333376:e8fddb72f2a8
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Fri Oct 31 09:11:42 2014 +0000

description:
config(1): Briefly test ioconf.c output

diffstat:

 tests/usr.bin/config/support/conf/files |   6 ++++++
 tests/usr.bin/config/t_config.sh        |  28 +++++++++++++++++++++++++++-
 2 files changed, 33 insertions(+), 1 deletions(-)

diffs (61 lines):

diff -r 47c033506399 -r e8fddb72f2a8 tests/usr.bin/config/support/conf/files
--- a/tests/usr.bin/config/support/conf/files   Fri Oct 31 08:43:24 2014 +0000
+++ b/tests/usr.bin/config/support/conf/files   Fri Oct 31 09:11:42 2014 +0000
@@ -33,3 +33,9 @@
 
 define c: b
 file   c.c     c
+
+define i {}
+
+device d: i
+attach d at root
+file   d.c     d
diff -r 47c033506399 -r e8fddb72f2a8 tests/usr.bin/config/t_config.sh
--- a/tests/usr.bin/config/t_config.sh  Fri Oct 31 08:43:24 2014 +0000
+++ b/tests/usr.bin/config/t_config.sh  Fri Oct 31 09:11:42 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_config.sh,v 1.4 2014/10/31 07:38:36 uebayasi Exp $
+# $NetBSD: t_config.sh,v 1.5 2014/10/31 09:11:42 uebayasi Exp $
 #
 # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -166,6 +166,31 @@
        test_output no_select
 }
 
+# Device instance
+test_case devi pass "Device instance"
+devi_config_str='
+include "../d_min"
+d0 at root
+'
+check_devi()
+{
+       local f=ioconf.c
+
+       sed -ne '/^struct cfdriver \* const cfdriver_list_initial\[\]/,/^};/p' $f >tmp.cfdriver
+       sed -ne '/^struct cfdata cfdata\[\]/,/^};/p' $f >tmp.cfdata
+
+       grep -q '^CFDRIVER_DECL(d, ' $f &&
+       grep -q '&d_cd,' tmp.cfdriver &&
+       grep -q '^extern struct cfattach d_ca;$' $f &&
+       grep -q '^static const struct cfiattrdata \* const d_attrs\[\]' $f &&
+       grep -q '^static const struct cfiattrdata icf_iattrdata' $f &&
+       grep -q '{ "d",' tmp.cfdata &&
+       :
+}
+devi_body() {
+       test_output devi
+}
+
 # Check minimal kernel config(1) output
 test_case min pass "Minimal config"
 check_min_files()
@@ -217,5 +242,6 @@
        atf_add_test_case no_undefined_opt
        atf_add_test_case select
        atf_add_test_case no_select
+       atf_add_test_case devi
        atf_add_test_case min
 }



Home | Main Index | Thread Index | Old Index