Source-Changes-HG archive

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

[src/trunk]: src config(1): Check minimal config(1) output files



details:   https://anonhg.NetBSD.org/src/rev/e861b2bc3518
branches:  trunk
changeset: 333330:e861b2bc3518
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Wed Oct 29 16:24:32 2014 +0000

description:
config(1): Check minimal config(1) output files

diffstat:

 distrib/sets/lists/tests/mi                                     |   3 +-
 tests/usr.bin/config/Makefile                                   |   3 +-
 tests/usr.bin/config/d_min                                      |   6 +
 tests/usr.bin/config/support/arch/regress/conf/Makefile.regress |  28 ++--
 tests/usr.bin/config/t_config.sh                                |  64 +++++++++-
 5 files changed, 83 insertions(+), 21 deletions(-)

diffs (206 lines):

diff -r e85100b6cdf4 -r e861b2bc3518 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Wed Oct 29 16:22:31 2014 +0000
+++ b/distrib/sets/lists/tests/mi       Wed Oct 29 16:24:32 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.595 2014/10/20 14:55:03 christos Exp $
+# $NetBSD: mi,v 1.596 2014/10/29 16:24:32 uebayasi Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3370,6 +3370,7 @@
 ./usr/tests/usr.bin/config/d_deffs_redef       tests-usr.bin-tests     atf
 ./usr/tests/usr.bin/config/d_loop              tests-usr.bin-tests     atf
 ./usr/tests/usr.bin/config/d_loop2             tests-usr.bin-tests     atf
+./usr/tests/usr.bin/config/d_min               tests-usr.bin-tests     atf
 ./usr/tests/usr.bin/config/d_no_pseudo         tests-usr.bin-tests     atf
 ./usr/tests/usr.bin/config/d_postponed_orphan  tests-usr.bin-tests     atf
 ./usr/tests/usr.bin/config/d_pseudo_parent     tests-usr.bin-tests     atf
diff -r e85100b6cdf4 -r e861b2bc3518 tests/usr.bin/config/Makefile
--- a/tests/usr.bin/config/Makefile     Wed Oct 29 16:22:31 2014 +0000
+++ b/tests/usr.bin/config/Makefile     Wed Oct 29 16:24:32 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2012/03/17 16:33:12 jruoho Exp $
+# $NetBSD: Makefile,v 1.2 2014/10/29 16:24:32 uebayasi Exp $
 
 SUBDIR=                        support
 
@@ -14,6 +14,7 @@
 FILES=                 d_deffs_redef
 FILES+=                        d_loop
 FILES+=                        d_loop2
+FILES+=                        d_min
 FILES+=                        d_no_pseudo
 FILES+=                        d_postponed_orphan
 FILES+=                        d_pseudo_parent
diff -r e85100b6cdf4 -r e861b2bc3518 tests/usr.bin/config/d_min
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/config/d_min        Wed Oct 29 16:24:32 2014 +0000
@@ -0,0 +1,6 @@
+include "arch/regress/conf/std.regress"
+maxusers 4
+
+master0                at root
+
+config regress root on ?
diff -r e85100b6cdf4 -r e861b2bc3518 tests/usr.bin/config/support/arch/regress/conf/Makefile.regress
--- a/tests/usr.bin/config/support/arch/regress/conf/Makefile.regress   Wed Oct 29 16:22:31 2014 +0000
+++ b/tests/usr.bin/config/support/arch/regress/conf/Makefile.regress   Wed Oct 29 16:24:32 2014 +0000
@@ -1,41 +1,41 @@
-=== INCLUDES BEGIN ===
+# === INCLUDES BEGIN ===
 
 %INCLUDES
 
-=== INCLUDES END ===
+# === INCLUDES END ===
 
-=== OBJS BEGIN ===
+# === OBJS BEGIN ===
 
 %OBJS
 
-=== OBJS END ===
+# === OBJS END ===
 
-=== CFILES BEGIN ===
+# === CFILES BEGIN ===
 
 %CFILES
 
-=== CFILES END ===
+# === CFILES END ===
 
-=== SFILES BEGIN ===
+# === SFILES BEGIN ===
 
 %SFILES
 
-=== SFILES END ===
+# === SFILES END ===
 
-=== LOAD BEGIN ===
+# === LOAD BEGIN ===
 
 %LOAD
 
-=== LOAD END ===
+# === LOAD END ===
 
-=== RULES BEGIN ===
+# === RULES BEGIN ===
 
 %RULES
 
-=== RULES END ===
+# === RULES END ===
 
-=== MAKEOPTIONSAPPEND BEGIN ===
+# === MAKEOPTIONSAPPEND BEGIN ===
 
 %MAKEOPTIONSAPPEND
 
-=== MAKEOPTIONSAPPEND END ===
+# === MAKEOPTIONSAPPEND END ===
diff -r e85100b6cdf4 -r e861b2bc3518 tests/usr.bin/config/t_config.sh
--- a/tests/usr.bin/config/t_config.sh  Wed Oct 29 16:22:31 2014 +0000
+++ b/tests/usr.bin/config/t_config.sh  Wed Oct 29 16:24:32 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_config.sh,v 1.1 2012/03/17 16:33:12 jruoho Exp $
+# $NetBSD: t_config.sh,v 1.2 2014/10/29 16:24:32 uebayasi Exp $
 #
 # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -25,13 +25,20 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-run_and_check_pass()
+run_and_check_prep()
 {
        local name="${1}"; shift
 
        mkdir compile
        supportdir="$(atf_get_srcdir)/support"
        config="$(atf_get_srcdir)/d_${name}"
+}
+
+run_and_check_pass()
+{
+       local name="${1}"; shift
+
+       run_and_check_prep "${name}"
 
        atf_check -o ignore \
            config -s "${supportdir}" -b "compile/${name}" "${config}"
@@ -41,9 +48,7 @@
 {
        local name="${1}"; shift
 
-       mkdir compile
-       supportdir="$(atf_get_srcdir)/support"
-       config="$(atf_get_srcdir)/d_${name}"
+       run_and_check_prep "${name}"
 
        atf_check -o ignore -e ignore -s ne:0 \
            config -s "${supportdir}" -b "compile/${name}" "${config}"
@@ -79,6 +84,54 @@
 test_case deffs_redef fail "Checks that config doesn't allow a deffs to use" \
     "the same name as a previous defflag/defparam"
 
+# Check minimal kernel config(1) output
+check_min_files()
+{
+       test -e Makefile &&
+       test -e config_file.h &&
+       test -e config_time.src &&
+       test -e ioconf.c &&
+       test -e ioconf.h &&
+       test -e locators.h &&
+       test -e swapregress.c &&
+       test -h machine &&
+       test -h regress &&
+       :
+}
+
+check_min_makefile()
+{
+       grep -q '^%' >tmp.template
+
+       grep -q '^MACHINE=regress$' &&
+       grep -q '^PARAM=-DMAXUSERS=4$' &&
+       grep -q '^all: regress$' &&
+       grep -q '^regress:' &&
+       [ ! -s tmp.template ] &&
+       :
+}
+
+test_min()
+{
+       local res=1
+
+       run_and_check_prep min
+
+       config -s "${supportdir}" -b compile/min "${config}" >/dev/null &&
+       cd compile/min &&
+       check_min_files &&
+       check_min_makefile &&
+       cd $OLDPWD &&
+       res=0
+
+       atf_check test $res -eq 0
+}
+
+test_case min pass "Minimal config"
+min_body() {
+       test_min
+}
+
 atf_init_test_cases()
 {
        atf_add_test_case shadow_instance
@@ -88,4 +141,5 @@
        atf_add_test_case postponed_orphan
        atf_add_test_case no_pseudo
        atf_add_test_case deffs_redef
+       atf_add_test_case min
 }



Home | Main Index | Thread Index | Old Index