Module Name: src
Committed By: rillig
Date: Sun Oct 25 21:31:00 UTC 2020
Modified Files:
src/usr.bin/make/unit-tests: deptgt-delete_on_error.exp
deptgt-delete_on_error.mk
Log Message:
make(1): add test for deleting targets using .DELETE_ON_ERROR
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp
cvs rdiff -u -r1.2 -r1.3 \
src/usr.bin/make/unit-tests/deptgt-delete_on_error.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/deptgt-delete_on_error.exp
diff -u src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp:1.1 src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp:1.2
--- src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp:1.1 Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp Sun Oct 25 21:31:00 2020
@@ -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
Index: src/usr.bin/make/unit-tests/deptgt-delete_on_error.mk
diff -u src/usr.bin/make/unit-tests/deptgt-delete_on_error.mk:1.2 src/usr.bin/make/unit-tests/deptgt-delete_on_error.mk:1.3
--- src/usr.bin/make/unit-tests/deptgt-delete_on_error.mk:1.2 Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/deptgt-delete_on_error.mk Sun Oct 25 21:31:00 2020
@@ -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.
+# 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.
+#
+# 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}