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

This commit is contained in:
uebayasi 2014-10-29 16:24:32 +00:00
parent 3497989d02
commit c6cb06a0e3
5 changed files with 83 additions and 21 deletions

View File

@ -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. # 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_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_loop tests-usr.bin-tests atf
./usr/tests/usr.bin/config/d_loop2 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_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_postponed_orphan tests-usr.bin-tests atf
./usr/tests/usr.bin/config/d_pseudo_parent tests-usr.bin-tests atf ./usr/tests/usr.bin/config/d_pseudo_parent tests-usr.bin-tests atf

View File

@ -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 SUBDIR= support
@ -14,6 +14,7 @@ FILESDIR= ${TESTSDIR}
FILES= d_deffs_redef FILES= d_deffs_redef
FILES+= d_loop FILES+= d_loop
FILES+= d_loop2 FILES+= d_loop2
FILES+= d_min
FILES+= d_no_pseudo FILES+= d_no_pseudo
FILES+= d_postponed_orphan FILES+= d_postponed_orphan
FILES+= d_pseudo_parent FILES+= d_pseudo_parent

View File

@ -0,0 +1,6 @@
include "arch/regress/conf/std.regress"
maxusers 4
master0 at root
config regress root on ?

View File

@ -1,41 +1,41 @@
=== INCLUDES BEGIN === # === INCLUDES BEGIN ===
%INCLUDES %INCLUDES
=== INCLUDES END === # === INCLUDES END ===
=== OBJS BEGIN === # === OBJS BEGIN ===
%OBJS %OBJS
=== OBJS END === # === OBJS END ===
=== CFILES BEGIN === # === CFILES BEGIN ===
%CFILES %CFILES
=== CFILES END === # === CFILES END ===
=== SFILES BEGIN === # === SFILES BEGIN ===
%SFILES %SFILES
=== SFILES END === # === SFILES END ===
=== LOAD BEGIN === # === LOAD BEGIN ===
%LOAD %LOAD
=== LOAD END === # === LOAD END ===
=== RULES BEGIN === # === RULES BEGIN ===
%RULES %RULES
=== RULES END === # === RULES END ===
=== MAKEOPTIONSAPPEND BEGIN === # === MAKEOPTIONSAPPEND BEGIN ===
%MAKEOPTIONSAPPEND %MAKEOPTIONSAPPEND
=== MAKEOPTIONSAPPEND END === # === MAKEOPTIONSAPPEND END ===

View File

@ -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. # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
# All rights reserved. # All rights reserved.
@ -25,13 +25,20 @@
# POSSIBILITY OF SUCH DAMAGE. # POSSIBILITY OF SUCH DAMAGE.
# #
run_and_check_pass() run_and_check_prep()
{ {
local name="${1}"; shift local name="${1}"; shift
mkdir compile mkdir compile
supportdir="$(atf_get_srcdir)/support" supportdir="$(atf_get_srcdir)/support"
config="$(atf_get_srcdir)/d_${name}" config="$(atf_get_srcdir)/d_${name}"
}
run_and_check_pass()
{
local name="${1}"; shift
run_and_check_prep "${name}"
atf_check -o ignore \ atf_check -o ignore \
config -s "${supportdir}" -b "compile/${name}" "${config}" config -s "${supportdir}" -b "compile/${name}" "${config}"
@ -41,9 +48,7 @@ run_and_check_fail()
{ {
local name="${1}"; shift local name="${1}"; shift
mkdir compile run_and_check_prep "${name}"
supportdir="$(atf_get_srcdir)/support"
config="$(atf_get_srcdir)/d_${name}"
atf_check -o ignore -e ignore -s ne:0 \ atf_check -o ignore -e ignore -s ne:0 \
config -s "${supportdir}" -b "compile/${name}" "${config}" config -s "${supportdir}" -b "compile/${name}" "${config}"
@ -79,6 +84,54 @@ test_case no_pseudo fail "Checks that config catches ommited 'pseudo-device'" \
test_case deffs_redef fail "Checks that config doesn't allow a deffs to use" \ test_case deffs_redef fail "Checks that config doesn't allow a deffs to use" \
"the same name as a previous defflag/defparam" "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_init_test_cases()
{ {
atf_add_test_case shadow_instance atf_add_test_case shadow_instance
@ -88,4 +141,5 @@ atf_init_test_cases()
atf_add_test_case postponed_orphan atf_add_test_case postponed_orphan
atf_add_test_case no_pseudo atf_add_test_case no_pseudo
atf_add_test_case deffs_redef atf_add_test_case deffs_redef
atf_add_test_case min
} }