From 7f01830927969a8386050617385e59070fe9f34b Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Sun, 28 Apr 2013 01:19:19 -0400 Subject: Add support for per-job output sync. A new flag to the -O/--output-sync, "job", selects a per-job (that is, per line of a recipe) output synchronization. To support this move the close of the temp file out of the sync_output() function and don't do it until we free the child, since we may call sync_output() multiple times in a given recipe. When we set up for a new temp file, if we're in per-job mode we truncate the file and seek to the beginning to re-use it for every job. --- tests/scripts/features/output-sync | 111 ++++++++++++++++++++++++++++++++----- 1 file changed, 96 insertions(+), 15 deletions(-) (limited to 'tests/scripts/features') diff --git a/tests/scripts/features/output-sync b/tests/scripts/features/output-sync index dce2ac4..babc08f 100644 --- a/tests/scripts/features/output-sync +++ b/tests/scripts/features/output-sync @@ -15,6 +15,18 @@ else { $sleep_command = "sleep"; } +# The following subdirectories with Makefiles are used in several +# of the following tests. The model is: +# foo/Makefile - has a "foo" target that waits for the bar target +# bar/Makefile - has a "bar" target that runs immediately +# - has a "baz" target that waits for the foo target +# +# So, you start the two sub-makes in parallel and first the "bar" target is +# built, followed by "foo", followed by "baz". The trick is that first each +# target prints a "start" statement, then waits (if appropriate), then prints +# an end statement. Thus we can tell if the -O flag is working, since +# otherwise these statements would be mixed together. + @syncfiles = (); sub output_sync_clean { @@ -36,19 +48,21 @@ sub output_sync_set { return "date > ../mksync.$_[0]"; } -@syncfiles = qw(mksync.foo mksync.bar); +@syncfiles = qw(mksync.foo mksync.foo_start mksync.bar mksync.bar_start); -# The following subdirectories with Makefiles are used in several -# of the following tests. output_sync_clean(); mkdir('foo', 0777); mkdir('bar', 0777); $set_foo = output_sync_set('foo'); $set_bar = output_sync_set('bar'); +$set_foo_start = output_sync_set('foo_start'); +$set_bar_start = output_sync_set('bar_start'); $wait_foo = output_sync_wait('foo'); $wait_bar = output_sync_wait('bar'); +$wait_foo_start = output_sync_set('foo_start'); +$wait_bar_start = output_sync_set('bar_start'); open(MAKEFILE,"> foo/Makefile"); print MAKEFILE < bar/Makefile"); print MAKEFILE <