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 Add unit-test for .MAKE.META.CMP_FILTER



details:   https://anonhg.NetBSD.org/src/rev/e98ebbfb9511
branches:  trunk
changeset: 359617:e98ebbfb9511
user:      sjg <sjg%NetBSD.org@localhost>
date:      Fri Jan 14 19:31:44 2022 +0000

description:
Add unit-test for .MAKE.META.CMP_FILTER

diffstat:

 usr.bin/make/unit-tests/meta-cmd-cmp.exp |  13 +++++++++++++
 usr.bin/make/unit-tests/meta-cmd-cmp.mk  |  26 ++++++++++++++++++++++++--
 2 files changed, 37 insertions(+), 2 deletions(-)

diffs (81 lines):

diff -r 90e7e55ec5ca -r e98ebbfb9511 usr.bin/make/unit-tests/meta-cmd-cmp.exp
--- a/usr.bin/make/unit-tests/meta-cmd-cmp.exp  Fri Jan 14 19:19:34 2022 +0000
+++ b/usr.bin/make/unit-tests/meta-cmd-cmp.exp  Fri Jan 14 19:31:44 2022 +0000
@@ -34,4 +34,17 @@
 Building .meta-cmd-cmp.cmp2
 This line not compared FLAGS=
 Skipping meta for .END: .SPECIAL
+filter0:
+Building .meta-cmd-cmp.filter
+Skipping meta for .END: .SPECIAL
+filter1:
+.meta-cmd-cmp.filter.meta: 2: a build command has changed
+@echo ccache cc -c foo.c > .meta-cmd-cmp.filter
+vs
+@echo  cc -c foo.c > .meta-cmd-cmp.filter
+Building .meta-cmd-cmp.filter
+Skipping meta for .END: .SPECIAL
+filter2:
+`.meta-cmd-cmp.filter' is up to date.
+Skipping meta for .END: .SPECIAL
 exit status 0
diff -r 90e7e55ec5ca -r e98ebbfb9511 usr.bin/make/unit-tests/meta-cmd-cmp.mk
--- a/usr.bin/make/unit-tests/meta-cmd-cmp.mk   Fri Jan 14 19:19:34 2022 +0000
+++ b/usr.bin/make/unit-tests/meta-cmd-cmp.mk   Fri Jan 14 19:31:44 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: meta-cmd-cmp.mk,v 1.2 2020/12/05 22:51:34 sjg Exp $
+# $NetBSD: meta-cmd-cmp.mk,v 1.3 2022/01/14 19:31:44 sjg Exp $
 #
 # Tests META_MODE command line comparison
 #
@@ -9,7 +9,7 @@
 tf:= .${.PARSEFILE:R}
 
 .if ${.TARGETS:Nall} == ""
-all: prep one two change1 change2 post
+all: prep one two change1 change2 filter0 filter1 filter2 post
 
 CLEANFILES= ${tf}*
 
@@ -22,6 +22,7 @@
 FLAGS2?=
 
 tests= ${tf}.cmp ${tf}.nocmp ${tf}.cmp2
+filter_tests= ${tf}.filter
 
 ${tf}.cmp:
        @echo FLAGS=${FLAGS:Uempty} > $@
@@ -35,6 +36,14 @@
        @echo FLAGS2=${FLAGS2:Uempty} > $@
        @echo This line not compared FLAGS=${FLAGS:Uempty} ${.OODATE:MNOMETA_CMP}
 
+CCACHE= ccache
+.ifdef WITH_CMP_FILTER
+.MAKE.META.CMP_FILTER += Nccache Ndistcc
+.endif
+
+${tf}.filter:
+       @echo ${CCACHE} cc -c foo.c > $@
+
 # these do the same 
 one two: .PHONY
        @echo $@:
@@ -48,5 +57,18 @@
        @echo $@:
        @${.MAKE} -dM -r -C ${.CURDIR} -f ${MAKEFILE} FLAGS2=changed ${tests}
 
+filter0: .PHONY
+       @echo $@:
+       @${.MAKE} -dM -r -C ${.CURDIR} -f ${MAKEFILE} ${filter_tests}
+
+filter1: .PHONY
+       @echo $@:
+       @${.MAKE} -dM -r -C ${.CURDIR} -f ${MAKEFILE} CCACHE= ${filter_tests}
+
+filter2: .PHONY
+       @echo $@:
+       @${.MAKE} -dM -r -C ${.CURDIR} -f ${MAKEFILE} -DWITH_CMP_FILTER \
+               CCACHE=distcc ${filter_tests}
+
 # don't let gcov mess up the results
 .MAKE.META.IGNORE_PATTERNS+= *.gcda



Home | Main Index | Thread Index | Old Index