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 some tests for meta mode
details: https://anonhg.NetBSD.org/src/rev/06ce57aaafae
branches: trunk
changeset: 957500:06ce57aaafae
user: sjg <sjg%NetBSD.org@localhost>
date: Mon Nov 30 18:32:49 2020 +0000
description:
Add some tests for meta mode
diffstat:
usr.bin/make/unit-tests/Makefile | 3 +-
usr.bin/make/unit-tests/meta-cmd-cmp.exp | 37 ++++++++++++++++++++++++
usr.bin/make/unit-tests/meta-cmd-cmp.mk | 49 ++++++++++++++++++++++++++++++++
3 files changed, 88 insertions(+), 1 deletions(-)
diffs (111 lines):
diff -r 1cb1cea081f4 -r 06ce57aaafae usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile Mon Nov 30 18:20:20 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile Mon Nov 30 18:32:49 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.229 2020/11/29 18:49:36 rillig Exp $
+# $NetBSD: Makefile,v 1.230 2020/11/30 18:32:49 sjg Exp $
#
# Unit tests for make(1)
#
@@ -188,6 +188,7 @@
TESTS+= job-output-long-lines
TESTS+= lint
TESTS+= make-exported
+TESTS+= meta-cmd-cmp
TESTS+= moderrs
TESTS+= modmatch
TESTS+= modmisc
diff -r 1cb1cea081f4 -r 06ce57aaafae usr.bin/make/unit-tests/meta-cmd-cmp.exp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/meta-cmd-cmp.exp Mon Nov 30 18:32:49 2020 +0000
@@ -0,0 +1,37 @@
+one:
+Building .meta-cmd-cmp.cmp
+Building .meta-cmd-cmp.nocmp
+Building .meta-cmd-cmp.cmp2
+This line not compared FLAGS=
+Skipping meta for .END: .SPECIAL
+two:
+`.meta-cmd-cmp.cmp' is up to date.
+`.meta-cmd-cmp.nocmp' is up to date.
+.meta-cmd-cmp.cmp2.meta: 3: cannot compare command using .OODATE
+`.meta-cmd-cmp.cmp2' is up to date.
+Skipping meta for .END: .SPECIAL
+change1:
+.meta-cmd-cmp.cmp.meta: 2: a build command has changed
+@echo FLAGS= > .meta-cmd-cmp.cmp
+vs
+@echo FLAGS=changed > .meta-cmd-cmp.cmp
+Building .meta-cmd-cmp.cmp
+`.meta-cmd-cmp.nocmp' is up to date.
+.meta-cmd-cmp.cmp2.meta: 3: cannot compare command using .OODATE
+`.meta-cmd-cmp.cmp2' is up to date.
+Skipping meta for .END: .SPECIAL
+change2:
+.meta-cmd-cmp.cmp.meta: 2: a build command has changed
+@echo FLAGS=changed > .meta-cmd-cmp.cmp
+vs
+@echo FLAGS= > .meta-cmd-cmp.cmp
+Building .meta-cmd-cmp.cmp
+`.meta-cmd-cmp.nocmp' is up to date.
+.meta-cmd-cmp.cmp2.meta: 2: a build command has changed
+@echo FLAGS2= > .meta-cmd-cmp.cmp2
+vs
+@echo FLAGS2=changed > .meta-cmd-cmp.cmp2
+Building .meta-cmd-cmp.cmp2
+This line not compared FLAGS=
+Skipping meta for .END: .SPECIAL
+exit status 0
diff -r 1cb1cea081f4 -r 06ce57aaafae usr.bin/make/unit-tests/meta-cmd-cmp.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/meta-cmd-cmp.mk Mon Nov 30 18:32:49 2020 +0000
@@ -0,0 +1,49 @@
+# $NetBSD: meta-cmd-cmp.mk,v 1.1 2020/11/30 18:32:49 sjg Exp $
+#
+# Tests META_MODE command line comparison
+#
+
+.MAIN: all
+
+.MAKE.MODE= meta verbose silent=yes curdirok=yes
+tf:= .${.PARSEFILE:R}
+
+.if ${.TARGETS:Nall} == ""
+all: prep one two change1 change2 post
+
+CLEANFILES= ${tf}*
+
+prep post: .PHONY
+ @rm -f ${CLEANFILES}
+
+.endif
+
+FLAGS?=
+FLAGS2?=
+
+tests= ${tf}.cmp ${tf}.nocmp ${tf}.cmp2
+
+${tf}.cmp:
+ @echo FLAGS=${FLAGS:Uempty} > $@
+
+${tf}.nocmp: .NOMETA_CMP
+ @echo FLAGS=${FLAGS:Uempty} > $@
+
+# a line containing ${.OODATE} will not be compared
+# this allows the trick below
+${tf}.cmp2:
+ @echo FLAGS2=${FLAGS2:Uempty} > $@
+ @echo This line not compared FLAGS=${FLAGS:Uempty} ${.OODATE:MNOMETA_CMP}
+
+# these do the same
+one two: .PHONY
+ @echo $@:
+ @${.MAKE} -dM -r -C ${.CURDIR} -f ${MAKEFILE} ${tests}
+
+change1: .PHONY
+ @echo $@:
+ @${.MAKE} -dM -r -C ${.CURDIR} -f ${MAKEFILE} FLAGS=changed ${tests}
+
+change2: .PHONY
+ @echo $@:
+ @${.MAKE} -dM -r -C ${.CURDIR} -f ${MAKEFILE} FLAGS2=changed ${tests}
Home |
Main Index |
Thread Index |
Old Index