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 tests/make: clean up after test for ...



details:   https://anonhg.NetBSD.org/src/rev/3b5ce8ad9865
branches:  trunk
changeset: 359589:3b5ce8ad9865
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Jan 11 19:47:34 2022 +0000

description:
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).

diffstat:

 usr.bin/make/unit-tests/Makefile           |  3 +--
 usr.bin/make/unit-tests/opt-debug-file.exp |  2 +-
 usr.bin/make/unit-tests/opt-debug-file.mk  |  7 +++----
 3 files changed, 5 insertions(+), 7 deletions(-)

diffs (45 lines):

diff -r de69f67326c6 -r 3b5ce8ad9865 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Tue Jan 11 19:27:13 2022 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Tue Jan 11 19:47:34 2022 +0000
@@ -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 @@
 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:
diff -r de69f67326c6 -r 3b5ce8ad9865 usr.bin/make/unit-tests/opt-debug-file.exp
--- a/usr.bin/make/unit-tests/opt-debug-file.exp        Tue Jan 11 19:27:13 2022 +0000
+++ b/usr.bin/make/unit-tests/opt-debug-file.exp        Tue Jan 11 19:47:34 2022 +0000
@@ -8,5 +8,5 @@
 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
diff -r de69f67326c6 -r 3b5ce8ad9865 usr.bin/make/unit-tests/opt-debug-file.mk
--- a/usr.bin/make/unit-tests/opt-debug-file.mk Tue Jan 11 19:27:13 2022 +0000
+++ b/usr.bin/make/unit-tests/opt-debug-file.mk Tue Jan 11 19:47:34 2022 +0000
@@ -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 @@
 # 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



Home | Main Index | Thread Index | Old Index