Module Name:    src
Committed By:   uebayasi
Date:           Wed Oct 29 16:24:32 UTC 2014

Modified Files:
        src/distrib/sets/lists/tests: mi
        src/tests/usr.bin/config: Makefile t_config.sh
        src/tests/usr.bin/config/support/arch/regress/conf: Makefile.regress
Added Files:
        src/tests/usr.bin/config: d_min

Log Message:
config(1): Check minimal config(1) output files


To generate a diff of this commit:
cvs rdiff -u -r1.595 -r1.596 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/config/Makefile \
    src/tests/usr.bin/config/t_config.sh
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/config/d_min
cvs rdiff -u -r1.1 -r1.2 \
    src/tests/usr.bin/config/support/arch/regress/conf/Makefile.regress

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.595 src/distrib/sets/lists/tests/mi:1.596
--- src/distrib/sets/lists/tests/mi:1.595	Mon Oct 20 14:55:03 2014
+++ src/distrib/sets/lists/tests/mi	Wed Oct 29 16:24:32 2014
@@ -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

Index: src/tests/usr.bin/config/Makefile
diff -u src/tests/usr.bin/config/Makefile:1.1 src/tests/usr.bin/config/Makefile:1.2
--- src/tests/usr.bin/config/Makefile:1.1	Sat Mar 17 16:33:12 2012
+++ src/tests/usr.bin/config/Makefile	Wed Oct 29 16:24:32 2014
@@ -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 @@ FILESDIR=		${TESTSDIR}
 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
Index: src/tests/usr.bin/config/t_config.sh
diff -u src/tests/usr.bin/config/t_config.sh:1.1 src/tests/usr.bin/config/t_config.sh:1.2
--- src/tests/usr.bin/config/t_config.sh:1.1	Sat Mar 17 16:33:12 2012
+++ src/tests/usr.bin/config/t_config.sh	Wed Oct 29 16:24:32 2014
@@ -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 @@ run_and_check_fail()
 {
 	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 no_pseudo fail "Checks that co
 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_init_test_cases()
 	atf_add_test_case postponed_orphan
 	atf_add_test_case no_pseudo
 	atf_add_test_case deffs_redef
+	atf_add_test_case min
 }

Index: src/tests/usr.bin/config/support/arch/regress/conf/Makefile.regress
diff -u src/tests/usr.bin/config/support/arch/regress/conf/Makefile.regress:1.1 src/tests/usr.bin/config/support/arch/regress/conf/Makefile.regress:1.2
--- src/tests/usr.bin/config/support/arch/regress/conf/Makefile.regress:1.1	Sat Mar 17 16:33:12 2012
+++ src/tests/usr.bin/config/support/arch/regress/conf/Makefile.regress	Wed Oct 29 16:24:32 2014
@@ -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 ===

Added files:

Index: src/tests/usr.bin/config/d_min
diff -u /dev/null src/tests/usr.bin/config/d_min:1.1
--- /dev/null	Wed Oct 29 16:24:32 2014
+++ src/tests/usr.bin/config/d_min	Wed Oct 29 16:24:32 2014
@@ -0,0 +1,6 @@
+include "arch/regress/conf/std.regress"
+maxusers 4
+
+master0		at root
+
+config regress root on ?

Reply via email to