mirror of
https://git.savannah.gnu.org/git/make.git
synced 2025-01-30 02:40:26 +00:00
[SV 44742] Fix double-colon rules plus parallel builds.
* remake.c (update_file): Don't update double-colon target status if we're still building targets. (ftime_t): Don't propagate timestamps for double-colon targets that we've not examined yet. * tests/scripts/features/double_colon: Add parallel build tests. Copyright-paperwork-exempt: yes
This commit is contained in:
parent
e2ebea35f1
commit
9bb994e831
2 changed files with 54 additions and 11 deletions
20
remake.c
20
remake.c
|
@ -320,7 +320,7 @@ update_file (struct file *file, unsigned int depth)
|
||||||
&& !f->dontcare && f->no_diag))
|
&& !f->dontcare && f->no_diag))
|
||||||
{
|
{
|
||||||
DBF (DB_VERBOSE, _("Pruning file '%s'.\n"));
|
DBF (DB_VERBOSE, _("Pruning file '%s'.\n"));
|
||||||
return f->command_state == cs_finished ? f->update_status : 0;
|
return f->command_state == cs_finished ? f->update_status : us_success;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,12 +344,9 @@ update_file (struct file *file, unsigned int depth)
|
||||||
|
|
||||||
if (f->command_state == cs_running
|
if (f->command_state == cs_running
|
||||||
|| f->command_state == cs_deps_running)
|
|| f->command_state == cs_deps_running)
|
||||||
{
|
/* Don't run other :: rules for this target until
|
||||||
/* Don't run the other :: rules for this
|
this rule is finished. */
|
||||||
file until this rule is finished. */
|
return us_success;
|
||||||
status = us_success;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (new > status)
|
if (new > status)
|
||||||
status = new;
|
status = new;
|
||||||
|
@ -1274,6 +1271,7 @@ FILE_TIMESTAMP
|
||||||
f_mtime (struct file *file, int search)
|
f_mtime (struct file *file, int search)
|
||||||
{
|
{
|
||||||
FILE_TIMESTAMP mtime;
|
FILE_TIMESTAMP mtime;
|
||||||
|
int propagate_timestamp;
|
||||||
|
|
||||||
/* File's mtime is not known; must get it from the system. */
|
/* File's mtime is not known; must get it from the system. */
|
||||||
|
|
||||||
|
@ -1450,10 +1448,13 @@ f_mtime (struct file *file, int search)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store the mtime into all the entries for this file. */
|
/* Store the mtime into all the entries for this file for which it is safe
|
||||||
|
to do so: avoid propagating timestamps to double-colon rules that haven't
|
||||||
|
been examined so they're run or not based on the pre-update timestamp. */
|
||||||
if (file->double_colon)
|
if (file->double_colon)
|
||||||
file = file->double_colon;
|
file = file->double_colon;
|
||||||
|
|
||||||
|
propagate_timestamp = file->updated;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
/* If this file is not implicit but it is intermediate then it was
|
/* If this file is not implicit but it is intermediate then it was
|
||||||
|
@ -1465,7 +1466,8 @@ f_mtime (struct file *file, int search)
|
||||||
&& !file->tried_implicit && file->intermediate)
|
&& !file->tried_implicit && file->intermediate)
|
||||||
file->intermediate = 0;
|
file->intermediate = 0;
|
||||||
|
|
||||||
file->last_mtime = mtime;
|
if (file->updated == propagate_timestamp)
|
||||||
|
file->last_mtime = mtime;
|
||||||
file = file->prev;
|
file = file->prev;
|
||||||
}
|
}
|
||||||
while (file != 0);
|
while (file != 0);
|
||||||
|
|
|
@ -151,8 +151,7 @@ two');
|
||||||
|
|
||||||
unlink('result','one','two');
|
unlink('result','one','two');
|
||||||
|
|
||||||
# TEST 10: check for proper backslash handling
|
# TEST 10: SV 33399 : check for proper backslash handling
|
||||||
# Savannah bug #33399
|
|
||||||
|
|
||||||
run_make_test('
|
run_make_test('
|
||||||
a\ xb :: ; @echo one
|
a\ xb :: ; @echo one
|
||||||
|
@ -160,5 +159,47 @@ a\ xb :: ; @echo two
|
||||||
',
|
',
|
||||||
'', "one\ntwo\n");
|
'', "one\ntwo\n");
|
||||||
|
|
||||||
|
# Test 11: SV 44742 : All double-colon rules should be run in parallel build.
|
||||||
|
|
||||||
|
run_make_test('result :: 01
|
||||||
|
@echo update
|
||||||
|
@touch $@
|
||||||
|
result :: 02
|
||||||
|
@echo update
|
||||||
|
@touch $@
|
||||||
|
result :: 03
|
||||||
|
@echo update
|
||||||
|
@touch $@
|
||||||
|
result :: 04
|
||||||
|
@echo update
|
||||||
|
@touch $@
|
||||||
|
result :: 05
|
||||||
|
@echo update
|
||||||
|
@touch $@
|
||||||
|
01 02 03 04 05:
|
||||||
|
@touch 01 02 03 04 05
|
||||||
|
',
|
||||||
|
'-j10 result', "update\nupdate\nupdate\nupdate\nupdate\n");
|
||||||
|
|
||||||
|
unlink('result', '01', '02', '03', '04', '05');
|
||||||
|
|
||||||
|
# Test 12: SV 44742 : Double-colon rules with parallelism
|
||||||
|
|
||||||
|
run_make_test('
|
||||||
|
root: all
|
||||||
|
echo root
|
||||||
|
all::
|
||||||
|
echo all_one
|
||||||
|
all:: 3
|
||||||
|
echo all_two
|
||||||
|
%:
|
||||||
|
sleep $*
|
||||||
|
',
|
||||||
|
'-rs -j2 1 2 root', "all_one\nall_two\nroot\n");
|
||||||
|
|
||||||
# This tells the test driver that the perl test script executed properly.
|
# This tells the test driver that the perl test script executed properly.
|
||||||
1;
|
1;
|
||||||
|
|
||||||
|
### Local Variables:
|
||||||
|
### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
|
||||||
|
### End:
|
||||||
|
|
Loading…
Reference in a new issue