Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make/unit-tests make(1): add test for debug output f...



details:   https://anonhg.NetBSD.org/src/rev/0678dd0b8b45
branches:  trunk
changeset: 946302:0678dd0b8b45
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Nov 22 23:45:20 2020 +0000

description:
make(1): add test for debug output from transformation rules

diffstat:

 distrib/sets/lists/tests/mi                      |   4 +-
 usr.bin/make/unit-tests/Makefile                 |  10 +++-
 usr.bin/make/unit-tests/suff-transform-debug.exp |  55 ++++++++++++++++++++++++
 usr.bin/make/unit-tests/suff-transform-debug.mk  |  12 +++++
 4 files changed, 77 insertions(+), 4 deletions(-)

diffs (147 lines):

diff -r f9b95cc8d01e -r 0678dd0b8b45 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Sun Nov 22 22:58:43 2020 +0000
+++ b/distrib/sets/lists/tests/mi       Sun Nov 22 23:45:20 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.973 2020/11/22 20:36:17 rillig Exp $
+# $NetBSD: mi,v 1.974 2020/11/22 23:45:20 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5293,6 +5293,8 @@
 ./usr/tests/usr.bin/make/unit-tests/suff-rebuild.mk                            tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suff-self.exp                              tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suff-self.mk                               tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/suff-transform-debug.exp                   tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/suff-transform-debug.mk                    tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suff-transform-endless.exp                 tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suff-transform-endless.mk                  tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suff-transform-expand.exp                  tests-usr.bin-tests     compattestfile,atf
diff -r f9b95cc8d01e -r 0678dd0b8b45 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Sun Nov 22 22:58:43 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Sun Nov 22 23:45:20 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.218 2020/11/22 20:36:17 rillig Exp $
+# $NetBSD: Makefile,v 1.219 2020/11/22 23:45:20 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -270,6 +270,7 @@
 TESTS+=                suff-main-several
 TESTS+=                suff-rebuild
 TESTS+=                suff-self
+TESTS+=                suff-transform-debug
 TESTS+=                suff-transform-endless
 TESTS+=                suff-transform-expand
 TESTS+=                suff-transform-select
@@ -446,7 +447,6 @@
        -e '/^bb*--- job-a ---$$/d'
 SED_CMDS.objdir-writable=      -e 's,${RO_OBJDIR},OBJDIR/roobj,g'
 SED_CMDS.opt-debug-graph1=     ${STD_SED_CMDS.dg1}
-SED_CMDS.sh-dots=              -e 's,^.*\.\.\.:.*,<normalized: ...: not found>,'
 SED_CMDS.opt-debug-jobs=       -e 's,([0-9][0-9]*),(<pid>),'
 SED_CMDS.opt-debug-jobs+=      -e 's,pid [0-9][0-9]*,pid <pid>,'
 SED_CMDS.opt-debug-jobs+=      -e 's,Process [0-9][0-9]*,Process <pid>,'
@@ -454,8 +454,10 @@
 SED_CMDS.opt-debug-jobs+=      -e 's,Command: ${.SHELL:T},Command: <shell>,'
 # The "-q" may be there or not, see jobs.c, variable shells.
 SED_CMDS.opt-debug-jobs+=      -e 's,^\(.Command: <shell>\) -q,\1,'
+SED_CMDS.sh-dots=              -e 's,^.*\.\.\.:.*,<normalized: ...: not found>,'
 SED_CMDS.suff-main+=           ${STD_SED_CMDS.dg1}
 SED_CMDS.suff-main-several+=   ${STD_SED_CMDS.dg1}
+SED_CMDS.suff-transform-debug+=        ${STD_SED_CMDS.dg1}
 SED_CMDS.var-op-shell+=        \
        -e 's,^${.SHELL:T}: [ 0-9:]*,,' \
        -e '/command/s,No such.*,not found,'
@@ -474,7 +476,8 @@
 POSTPROC.gnode-submake=        awk '/Input graph/, /^$$/'
 POSTPROC.varname-empty=        ${TOOL_SED} -n -e '/^Var_Set/p' -e '/^out:/p'
 # The directory cache contains the hard-coded '/usr/share/mk'.
-POSTPROC.suff-main-several=    awk '/Directory Cache/,/^$$/ { next } { print }'
+POSTPROC.suff-main-several=    ${STD_POSTPROC.dg1}
+POSTPROC.suff-transform-debug= ${STD_POSTPROC.dg1}
 
 # Some tests reuse other tests, which makes them unnecessarily fragile.
 export-all.rawout: export.mk
@@ -491,6 +494,7 @@
 STD_SED_CMDS.dg1+=     -e 's,^\(\.MAKE\.[A-Z_]* *=\) .*,\1 <details omitted>,'
 STD_SED_CMDS.dg1+=     -e 's,^\(MACHINE[_ARCH]* *=\) .*,\1 <details omitted>,'
 STD_SED_CMDS.dg1+=     -e 's,^\(MAKE *=\) .*,\1 <details omitted>,'
+STD_POSTPROC.dg1=      awk '/Directory Cache/,/^$$/ { next } { print }'
 
 # End of the configuration helpers section.
 
diff -r f9b95cc8d01e -r 0678dd0b8b45 usr.bin/make/unit-tests/suff-transform-debug.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/suff-transform-debug.exp  Sun Nov 22 23:45:20 2020 +0000
@@ -0,0 +1,55 @@
+#*** Input graph:
+# all, made UNMADE, type OP_DEPENDS, flags none
+
+
+#
+#   Files that are only sources:
+#*** Global Variables:
+.ALLTARGETS      =  all
+.CURDIR          = <curdir>
+.INCLUDES        = 
+.LIBS            = 
+.MAKE            = <details omitted>
+.MAKE.DEPENDFILE = <details omitted>
+.MAKE.LEVEL      = <details omitted>
+.MAKE.MAKEFILES  = <details omitted>
+.MAKE.MAKEFILE_PREFERENCE = <details omitted>
+.MAKE.OS         = <details omitted>
+.MAKE.PATH_FILEMON = <details omitted>
+.MAKE.PID        = <details omitted>
+.MAKE.PPID       = <details omitted>
+.MAKEFLAGS       =  -r -k -d g1
+.MAKEOVERRIDES   = 
+.OBJDIR          = <curdir>
+.PATH            = . <curdir>
+.TARGETS         = 
+.newline         = 
+
+MACHINE          = <details omitted>
+MACHINE_ARCH     = <details omitted>
+MAKE             = <details omitted>
+MFLAGS           =   -r -k -d g1
+#*** Command-line Variables:
+.MAKE.LEVEL.ENV  = MAKELEVEL
+
+#*** Suffixes:
+# ".a" (num 1, ref 2)
+#      To: 
+#      From: .cpp 
+#      Search Path: 
+# ".c" (num 2, ref 2)
+#      To: .cpp 
+#      From: 
+#      Search Path: 
+# ".cpp" (num 3, ref 3)
+#      To: .a 
+#      From: .c 
+#      Search Path: 
+#*** Transformations:
+.c.cpp          :
+       : Making ${.TARGET} from impsrc ${.IMPSRC} allsrc ${.ALLSRC}.
+
+.cpp.a          :
+       : Making ${.TARGET} from impsrc ${.IMPSRC} allsrc ${.ALLSRC}.
+
+exit status 0
diff -r f9b95cc8d01e -r 0678dd0b8b45 usr.bin/make/unit-tests/suff-transform-debug.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/suff-transform-debug.mk   Sun Nov 22 23:45:20 2020 +0000
@@ -0,0 +1,12 @@
+# $NetBSD: suff-transform-debug.mk,v 1.1 2020/11/22 23:45:20 rillig Exp $
+#
+# Test how the debug output of transformation rules looks.
+
+.MAKEFLAGS: -dg1
+
+.SUFFIXES: .a .c .cpp
+
+.c.cpp .cpp.a:
+       : Making ${.TARGET} from impsrc ${.IMPSRC} allsrc ${.ALLSRC}.
+
+all:



Home | Main Index | Thread Index | Old Index