Module Name:    src
Committed By:   sjg
Date:           Fri Jan 14 19:31:44 UTC 2022

Modified Files:
        src/usr.bin/make/unit-tests: meta-cmd-cmp.exp meta-cmd-cmp.mk

Log Message:
Add unit-test for .MAKE.META.CMP_FILTER


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/meta-cmd-cmp.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/meta-cmd-cmp.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/meta-cmd-cmp.exp
diff -u src/usr.bin/make/unit-tests/meta-cmd-cmp.exp:1.1 src/usr.bin/make/unit-tests/meta-cmd-cmp.exp:1.2
--- src/usr.bin/make/unit-tests/meta-cmd-cmp.exp:1.1	Mon Nov 30 18:32:49 2020
+++ src/usr.bin/make/unit-tests/meta-cmd-cmp.exp	Fri Jan 14 19:31:44 2022
@@ -34,4 +34,17 @@ vs
 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

Index: src/usr.bin/make/unit-tests/meta-cmd-cmp.mk
diff -u src/usr.bin/make/unit-tests/meta-cmd-cmp.mk:1.2 src/usr.bin/make/unit-tests/meta-cmd-cmp.mk:1.3
--- src/usr.bin/make/unit-tests/meta-cmd-cmp.mk:1.2	Sat Dec  5 22:51:34 2020
+++ src/usr.bin/make/unit-tests/meta-cmd-cmp.mk	Fri Jan 14 19:31:44 2022
@@ -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 @@ FLAGS?=
 FLAGS2?=
 
 tests= ${tf}.cmp ${tf}.nocmp ${tf}.cmp2
+filter_tests= ${tf}.filter
 
 ${tf}.cmp:
 	@echo FLAGS=${FLAGS:Uempty} > $@
@@ -35,6 +36,14 @@ ${tf}.cmp2:
 	@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 @@ change2: .PHONY
 	@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

Reply via email to