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 Add an ifdef test



details:   https://anonhg.NetBSD.org/src/rev/c762631f5634
branches:  trunk
changeset: 969996:c762631f5634
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Mar 08 17:21:52 2020 +0000

description:
Add an ifdef test

diffstat:

 tests/usr.bin/config/Makefile    |   3 +-
 tests/usr.bin/config/d_ifdef     |  52 ++++++++++++++++++++++++++++++++++++++++
 tests/usr.bin/config/t_config.sh |  42 +++++++++++++++++++++++++++++++-
 3 files changed, 95 insertions(+), 2 deletions(-)

diffs (134 lines):

diff -r f64a125c23d2 -r c762631f5634 tests/usr.bin/config/Makefile
--- a/tests/usr.bin/config/Makefile     Sun Mar 08 17:04:45 2020 +0000
+++ b/tests/usr.bin/config/Makefile     Sun Mar 08 17:21:52 2020 +0000
@@ -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 @@
 
 FILESDIR=              ${TESTSDIR}
 FILES=                 d_deffs_redef
+FILES+=                        d_ifdef
 FILES+=                        d_loop
 FILES+=                        d_loop2
 FILES+=                        d_min
diff -r f64a125c23d2 -r c762631f5634 tests/usr.bin/config/d_ifdef
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/config/d_ifdef      Sun Mar 08 17:21:52 2020 +0000
@@ -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 ?
diff -r f64a125c23d2 -r c762631f5634 tests/usr.bin/config/t_config.sh
--- a/tests/usr.bin/config/t_config.sh  Sun Mar 08 17:04:45 2020 +0000
+++ b/tests/usr.bin/config/t_config.sh  Sun Mar 08 17:21:52 2020 +0000
@@ -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 @@
        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_add_test_case no_select
        atf_add_test_case devi
        atf_add_test_case min
+       atf_add_test_case ifdef
 }



Home | Main Index | Thread Index | Old Index