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 deleting targe...
details: https://anonhg.NetBSD.org/src/rev/61a0b85e6c59
branches: trunk
changeset: 956308:61a0b85e6c59
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Oct 25 21:31:00 2020 +0000
description:
make(1): add test for deleting targets using .DELETE_ON_ERROR
diffstat:
usr.bin/make/unit-tests/deptgt-delete_on_error.exp | 50 ++++++++++++++++++++++
usr.bin/make/unit-tests/deptgt-delete_on_error.mk | 45 ++++++++++++++++++-
2 files changed, 91 insertions(+), 4 deletions(-)
diffs (108 lines):
diff -r 9e742d94b748 -r 61a0b85e6c59 usr.bin/make/unit-tests/deptgt-delete_on_error.exp
--- a/usr.bin/make/unit-tests/deptgt-delete_on_error.exp Sun Oct 25 20:34:05 2020 +0000
+++ b/usr.bin/make/unit-tests/deptgt-delete_on_error.exp Sun Oct 25 21:31:00 2020 +0000
@@ -1,1 +1,51 @@
+Compatibility mode
+> deptgt-delete_on_error-regular; false
+*** Error code 1 (continuing)
+make: *** deptgt-delete_on_error-regular removed
+> deptgt-delete_on_error-regular-delete; false
+*** Error code 1 (continuing)
+make: *** deptgt-delete_on_error-regular-delete removed
+> deptgt-delete_on_error-phony; false
+*** Error code 1 (continuing)
+make: *** deptgt-delete_on_error-phony removed
+> deptgt-delete_on_error-phony-delete; false
+*** Error code 1 (continuing)
+make: *** deptgt-delete_on_error-phony-delete removed
+> deptgt-delete_on_error-precious; false
+*** Error code 1 (continuing)
+> deptgt-delete_on_error-precious-delete; false
+*** Error code 1 (continuing)
+
+Stop.
+make: stopped in unit-tests
+
+Parallel mode
+> deptgt-delete_on_error-regular; false
+*** [deptgt-delete_on_error-regular] Error code 1
+make: *** deptgt-delete_on_error-regular removed
+
+make: stopped in unit-tests
+> deptgt-delete_on_error-regular-delete; false
+*** [deptgt-delete_on_error-regular-delete] Error code 1
+make: *** deptgt-delete_on_error-regular-delete removed
+
+make: stopped in unit-tests
+> deptgt-delete_on_error-phony; false
+*** [deptgt-delete_on_error-phony] Error code 1
+
+make: stopped in unit-tests
+> deptgt-delete_on_error-phony-delete; false
+*** [deptgt-delete_on_error-phony-delete] Error code 1
+
+make: stopped in unit-tests
+> deptgt-delete_on_error-precious; false
+*** [deptgt-delete_on_error-precious] Error code 1
+
+make: stopped in unit-tests
+> deptgt-delete_on_error-precious-delete; false
+*** [deptgt-delete_on_error-precious-delete] Error code 1
+
+make: stopped in unit-tests
+*** Error code 1 (ignored)
+*** Error code 1 (ignored)
exit status 0
diff -r 9e742d94b748 -r 61a0b85e6c59 usr.bin/make/unit-tests/deptgt-delete_on_error.mk
--- a/usr.bin/make/unit-tests/deptgt-delete_on_error.mk Sun Oct 25 20:34:05 2020 +0000
+++ b/usr.bin/make/unit-tests/deptgt-delete_on_error.mk Sun Oct 25 21:31:00 2020 +0000
@@ -1,8 +1,45 @@
-# $NetBSD: deptgt-delete_on_error.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+ # $NetBSD: deptgt-delete_on_error.mk,v 1.3 2020/10/25 21:31:00 rillig Exp $
+#
+# Tests for the special target .DELETE_ON_ERROR in dependency declarations,
+# which controls whether the target is deleted if a shell command fails or
+# is interrupted.
+#
+# In compatibility mode, regular and phony targets are deleted, but precious
+# targets are preserved.
#
-# Tests for the special target .DELETE_ON_ERROR in dependency declarations.
+# In parallel mode, regular targets are deleted, while phony and precious
+# targets are preserved.
+#
+# See also:
+# CompatDeleteTarget
+# JobDeleteTarget
-# TODO: Implementation
+THIS= deptgt-delete_on_error
+TARGETS= ${THIS}-regular ${THIS}-regular-delete
+TARGETS+= ${THIS}-phony ${THIS}-phony-delete
+TARGETS+= ${THIS}-precious ${THIS}-precious-delete
all:
- @:;
+ @rm -f ${TARGETS}
+ @echo 'Compatibility mode'
+ @-${.MAKE} -f ${MAKEFILE} -k ${TARGETS}
+ @rm -f ${TARGETS}
+ @echo
+ @echo 'Parallel mode'
+ @-${.MAKE} -f ${MAKEFILE} -k -j1 ${TARGETS}
+ @rm -f ${TARGETS}
+
+${THIS}-regular{,-delete}:
+ > ${.TARGET}; false
+
+${THIS}-phony{,-delete}: .PHONY
+ > ${.TARGET}; false
+
+${THIS}-precious{,-delete}: .PRECIOUS
+ > ${.TARGET}; false
+
+# The special target .DELETE_ON_ERROR is a global setting.
+# It does not apply to single targets.
+# The following line is therefore misleading but does not generate any
+# warning or even an error message.
+.DELETE_ON_ERROR: ${TARGETS:M*-delete}
Home |
Main Index |
Thread Index |
Old Index