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): avoid race condition in tes...
details: https://anonhg.NetBSD.org/src/rev/26d4e01138c9
branches: trunk
changeset: 942614:26d4e01138c9
user: rillig <rillig%NetBSD.org@localhost>
date: Thu Nov 12 21:54:52 2020 +0000
description:
make(1): avoid race condition in test opt-debug-jobs
Thanks sjg for finding this and suggesting the fix.
diffstat:
usr.bin/make/unit-tests/opt-debug-jobs.exp | 2 ++
usr.bin/make/unit-tests/opt-debug-jobs.mk | 9 ++++++++-
2 files changed, 10 insertions(+), 1 deletions(-)
diffs (32 lines):
diff -r 88b0582ed4d0 -r 26d4e01138c9 usr.bin/make/unit-tests/opt-debug-jobs.exp
--- a/usr.bin/make/unit-tests/opt-debug-jobs.exp Thu Nov 12 20:16:20 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-debug-jobs.exp Thu Nov 12 21:54:52 2020 +0000
@@ -10,6 +10,8 @@
echo ": 'single' and \"double\" quotes"
{ : 'single' and "double" quotes
} || exit $?
+{ sleep 1
+} || exit $?
Running all
Command: sh
JobExec(all): pid <pid> added to jobs table
diff -r 88b0582ed4d0 -r 26d4e01138c9 usr.bin/make/unit-tests/opt-debug-jobs.mk
--- a/usr.bin/make/unit-tests/opt-debug-jobs.mk Thu Nov 12 20:16:20 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-debug-jobs.mk Thu Nov 12 21:54:52 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: opt-debug-jobs.mk,v 1.4 2020/10/05 19:27:48 rillig Exp $
+# $NetBSD: opt-debug-jobs.mk,v 1.5 2020/11/12 21:54:52 rillig Exp $
#
# Tests for the -dj command line option, which adds debug logging about
# running jobs in multiple shells.
@@ -24,3 +24,10 @@
# This allows to copy and paste the whole command, without having
# to unescape anything.
: 'single' and "double" quotes
+
+ # Avoid a race condition in the debug output. Without sleeping,
+ # it is not guaranteed that the two lines "exited/stopped" and
+ # "JobFinish" are output earlier than the stdout of the actual shell
+ # commands. The '@' prefix avoids that this final command gets into
+ # another race condition with the "exited/stopped" line.
+ @sleep 1
Home |
Main Index |
Thread Index |
Old Index