Module Name:    src
Committed By:   rillig
Date:           Tue Jan 11 19:47:34 UTC 2022

Modified Files:
        src/usr.bin/make/unit-tests: Makefile opt-debug-file.exp
            opt-debug-file.mk

Log Message:
tests/make: clean up after test for option '-dF'

When the file for the debug log cannot be opened, make exits
immediately.  This doesn't give the test a chance to clean up the
temporary log file.

Instead of trying to treat a regular file as a directory and create a
file in it, assume that the directory /nonexistent-$uuid is actually
nonexistent.  This leads to the same kind of error message, independent
of strerror(3).


To generate a diff of this commit:
cvs rdiff -u -r1.294 -r1.295 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/opt-debug-file.exp
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/opt-debug-file.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/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.294 src/usr.bin/make/unit-tests/Makefile:1.295
--- src/usr.bin/make/unit-tests/Makefile:1.294	Sun Jan  9 20:53:53 2022
+++ src/usr.bin/make/unit-tests/Makefile	Tue Jan 11 19:47:34 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.294 2022/01/09 20:53:53 rillig Exp $
+# $NetBSD: Makefile,v 1.295 2022/01/11 19:47:34 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -626,7 +626,6 @@ all: ${OUTFILES}
 CLEANFILES=		*.rawout *.out *.status *.tmp *.core *.tmp
 CLEANFILES+=		obj*.[och] lib*.a	# posix1.mk
 CLEANFILES+=		issue* .[ab]*		# suffixes.mk
-CLEANFILES+=		opt-debug-file.debuglog	# test exits before cleaning
 CLEANDIRS=		dir dummy		# posix1.mk
 
 clean:

Index: src/usr.bin/make/unit-tests/opt-debug-file.exp
diff -u src/usr.bin/make/unit-tests/opt-debug-file.exp:1.4 src/usr.bin/make/unit-tests/opt-debug-file.exp:1.5
--- src/usr.bin/make/unit-tests/opt-debug-file.exp:1.4	Sun Jan  9 15:05:21 2022
+++ src/usr.bin/make/unit-tests/opt-debug-file.exp	Tue Jan 11 19:47:34 2022
@@ -8,5 +8,5 @@ make: Missing delimiter for modifier ':S
 make: Missing delimiter for modifier ':S'
 CondParser_Eval: ${:!cat opt-debug-file.debuglog!:Mdelimiter:[#]} != 1
 lhs = 1.000000, rhs = 1.000000, op = !=
-Cannot open debug file "opt-debug-file.debuglog/file"
+Cannot open debug file "/nonexistent-6f21c672-a22d-4ef7/opt-debug-file.debuglog"
 exit status 2

Index: src/usr.bin/make/unit-tests/opt-debug-file.mk
diff -u src/usr.bin/make/unit-tests/opt-debug-file.mk:1.7 src/usr.bin/make/unit-tests/opt-debug-file.mk:1.8
--- src/usr.bin/make/unit-tests/opt-debug-file.mk:1.7	Sun Jan  9 15:05:21 2022
+++ src/usr.bin/make/unit-tests/opt-debug-file.mk	Tue Jan 11 19:47:34 2022
@@ -1,4 +1,4 @@
-# $NetBSD: opt-debug-file.mk,v 1.7 2022/01/09 15:05:21 rillig Exp $
+# $NetBSD: opt-debug-file.mk,v 1.8 2022/01/11 19:47:34 rillig Exp $
 #
 # Tests for the -dF command line option, which redirects the debug log
 # to a file instead of writing it to stderr.
@@ -67,6 +67,5 @@ DEBUG_OUTPUT:=	${:!cat opt-debug-file.de
 # If the debug log file cannot be opened, make prints an error message and
 # exits immediately since the debug log file is usually selected from the
 # command line.
-.MAKEFLAGS: -dFopt-debug-file.debuglog/file
-
-all:
+_:=	${:!rm opt-debug-file.debuglog!}
+.MAKEFLAGS: -dF/nonexistent-6f21c672-a22d-4ef7/opt-debug-file.debuglog

Reply via email to