]> git.ipfire.org Git - thirdparty/make.git/commitdiff
[SV 63243] tests: Avoid SIGTERM racing with make error messages
authorDmitry Goncharov <dgoncharov@users.sf.net>
Fri, 21 Oct 2022 23:35:09 +0000 (19:35 -0400)
committerPaul Smith <psmith@gnu.org>
Sat, 22 Oct 2022 14:02:41 +0000 (10:02 -0400)
Original patch from Frank Heckenbach <f.heckenbach@fh-soft.de>.

* tests/scripts/features/output-sync: Introduce a sleep to let make
write its error message.  Some systems use different names for
SIGTERM so match with a regex.
* tests/scripts/features/temp_stdin: Ditto.

tests/scripts/features/output-sync
tests/scripts/features/temp_stdin

index 292ef8ff4699cbc1ef4a25c01f56adbfb143520d..b175b82015a90e772aa4ff17c780e607f26115d5 100644 (file)
@@ -352,10 +352,12 @@ use POSIX ();
 # Test that make removes temporary files, even when a signal is received.
 # The general test_driver postprocessing will ensure the temporary file used
 # to synchronize output and the jobserver fifo are both removed.
+# sleep is needed to let make write its "... Terminated" message to the log
+# file.
 run_make_test(q!
 pid:=$(shell echo $$PPID)
-all:; @kill -TERM $(pid)
-!, '-O -j2', "", POSIX::SIGTERM);
+all:; @kill -TERM $(pid) && sleep 16
+!, '-O -j2', '/#MAKE#: \*\*\* \[#MAKEFILE#:3: all] Terminated/', POSIX::SIGTERM);
 }
 
 unlink($fout);
index 32a6873185468a6cac91c6707fa51145b5cb1ae7..b4aa60a8ce0de3b2805d1299cc9abc58ac39ceea 100644 (file)
@@ -62,6 +62,8 @@ use POSIX ();
 # include bye.mk and bye.mk: rule is needed to cause make to keep the temporary
 # file for re-exec. Without re-exec make will remove the file before the signal
 # arrives.
+# sleep is needed to let make write its "... Terminated" message to the log
+# file.
 &utouch(-600, 'bye.mk');
 close(STDIN);
 open(STDIN, "<", 'input.mk') || die "$0: cannot open input.mk for reading: $!";
@@ -69,9 +71,9 @@ run_make_test(q!
 include bye.mk
 pid:=$(shell echo $$PPID)
 all:;
-bye.mk: force; @kill -TERM $(pid)
+bye.mk: force; @kill -TERM $(pid) && sleep 16
 force:
-!, '-f-', "", POSIX::SIGTERM);
+!, '-f-', '/#MAKE#: \*\*\* \[#MAKEFILE#:5: bye.mk] Terminated/', POSIX::SIGTERM);
 }
 unlink($fout);