Add an ifdef test
This commit is contained in:
parent
58ea2fbbd4
commit
f3812c2b53
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.2 2014/10/29 16:24:32 uebayasi Exp $
|
||||
# $NetBSD: Makefile,v 1.3 2020/03/08 17:21:52 christos Exp $
|
||||
|
||||
SUBDIR= support
|
||||
|
||||
|
@ -12,6 +12,7 @@ TESTS_SH= t_config
|
|||
|
||||
FILESDIR= ${TESTSDIR}
|
||||
FILES= d_deffs_redef
|
||||
FILES+= d_ifdef
|
||||
FILES+= d_loop
|
||||
FILES+= d_loop2
|
||||
FILES+= d_min
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
include "arch/regress/conf/std.regress"
|
||||
maxusers 4
|
||||
|
||||
define TRUE
|
||||
ifdef TRUE
|
||||
options OK1_1
|
||||
elifdef FALSE
|
||||
options BAD1_1
|
||||
elifdef TRUE
|
||||
options BAD1_2
|
||||
else
|
||||
options BAD1_3
|
||||
endif
|
||||
|
||||
ifdef FALSE
|
||||
options BAD2_1
|
||||
elifdef TRUE
|
||||
ifdef FALSE
|
||||
options BAD2_2
|
||||
elifdef TRUE
|
||||
options OK2_1
|
||||
else
|
||||
options BAD2_3
|
||||
endif
|
||||
options OK2_2
|
||||
endif
|
||||
|
||||
ifdef FALSE
|
||||
options BAD3_1
|
||||
elifdef TRUE
|
||||
ifdef FALSE
|
||||
options BAD3_2
|
||||
else
|
||||
options OK3_1
|
||||
ifdef TRUE
|
||||
ifdef FALSE
|
||||
options BAD3_3
|
||||
elifdef TRUE
|
||||
options OK3_2
|
||||
endif
|
||||
options OK3_3
|
||||
elifdef TRUE
|
||||
options BAD3_4
|
||||
else
|
||||
options BAD3_5
|
||||
endif
|
||||
options OK3_4
|
||||
endif
|
||||
options OK3_5
|
||||
endif
|
||||
|
||||
config regress root on ?
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: t_config.sh,v 1.8 2016/08/27 12:08:14 christos Exp $
|
||||
# $NetBSD: t_config.sh,v 1.9 2020/03/08 17:21:52 christos Exp $
|
||||
#
|
||||
# Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
|
@ -260,6 +260,45 @@ min_body() {
|
|||
test_output min
|
||||
}
|
||||
|
||||
# Check ifdef supper
|
||||
test_case ifdef pass "ifdef config"
|
||||
check_ifdef_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_ifdef_makefile()
|
||||
{
|
||||
local f=Makefile
|
||||
local e='-DOK1_1 -DOK2_1 -DOK2_2 -DOK3_1 -DOK3_2 -DOK3_3 -DOK3_4 -DOK3_5 -DMAXUSERS="4"'
|
||||
local r
|
||||
r=$(make -f Makefile -V IDENT)
|
||||
if [ "$r" != "$e" ]; then
|
||||
echo "Expected: '$e'"
|
||||
echo "Result: '$r'"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_ifdef()
|
||||
{
|
||||
check_ifdef_files &&
|
||||
check_ifdef_makefile &&
|
||||
:
|
||||
}
|
||||
ifdef_body() {
|
||||
test_output ifdef
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
atf_add_test_case shadow_instance
|
||||
|
@ -275,4 +314,5 @@ atf_init_test_cases()
|
|||
atf_add_test_case no_select
|
||||
atf_add_test_case devi
|
||||
atf_add_test_case min
|
||||
atf_add_test_case ifdef
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue