1999-12-08 20:13:50 +00:00
|
|
|
# -*-perl-*-
|
|
|
|
$description = "Test handling of double-colon rules.";
|
1999-09-14 02:03:19 +00:00
|
|
|
|
1999-12-08 20:13:50 +00:00
|
|
|
$details = "\
|
|
|
|
We test these features:
|
|
|
|
|
|
|
|
- Multiple commands for the same (double-colon) target
|
|
|
|
- Different prerequisites for targets: only out-of-date
|
|
|
|
ones are rebuilt.
|
|
|
|
- Double-colon targets that aren't the goal target.
|
|
|
|
|
|
|
|
Then we do the same thing for parallel builds: double-colon
|
|
|
|
targets should always be built serially.";
|
1999-09-14 02:03:19 +00:00
|
|
|
|
|
|
|
# The Contents of the MAKEFILE ...
|
|
|
|
|
1999-12-08 20:13:50 +00:00
|
|
|
open(MAKEFILE,"> $makefile");
|
|
|
|
|
|
|
|
print MAKEFILE <<'EOF';
|
|
|
|
|
|
|
|
all: baz
|
|
|
|
|
|
|
|
foo:: f1.h ; @echo foo FIRST
|
|
|
|
foo:: f2.h ; @echo foo SECOND
|
1999-09-14 02:03:19 +00:00
|
|
|
|
1999-12-08 20:13:50 +00:00
|
|
|
bar:: ; @echo aaa; sleep 1; echo aaa done
|
|
|
|
bar:: ; @echo bbb
|
|
|
|
|
|
|
|
baz:: ; @echo aaa
|
|
|
|
baz:: ; @echo bbb
|
|
|
|
|
|
|
|
biz:: ; @echo aaa
|
|
|
|
biz:: two ; @echo bbb
|
|
|
|
|
|
|
|
two: ; @echo two
|
|
|
|
|
|
|
|
f1.h f2.h: ; @echo $@
|
|
|
|
|
2000-03-27 06:54:37 +00:00
|
|
|
d :: ; @echo ok
|
|
|
|
d :: d ; @echo oops
|
|
|
|
|
1999-12-08 20:13:50 +00:00
|
|
|
EOF
|
1999-09-14 02:03:19 +00:00
|
|
|
|
|
|
|
close(MAKEFILE);
|
|
|
|
|
1999-12-08 20:13:50 +00:00
|
|
|
# TEST 0: A simple double-colon rule that isn't the goal target.
|
|
|
|
|
|
|
|
&run_make_with_options($makefile, "all", &get_logfile, 0);
|
|
|
|
$answer = "aaa\nbbb\n";
|
|
|
|
&compare_output($answer, &get_logfile(1));
|
|
|
|
|
|
|
|
# TEST 1: As above, in parallel
|
|
|
|
|
2000-04-22 02:11:17 +00:00
|
|
|
if ($parallel_jobs) {
|
|
|
|
&run_make_with_options($makefile, "-j10 all", &get_logfile, 0);
|
|
|
|
$answer = "aaa\nbbb\n";
|
|
|
|
&compare_output($answer, &get_logfile(1));
|
|
|
|
}
|
1999-12-08 20:13:50 +00:00
|
|
|
|
|
|
|
# TEST 2: A simple double-colon rule that is the goal target
|
|
|
|
|
|
|
|
&run_make_with_options($makefile, "bar", &get_logfile, 0);
|
|
|
|
$answer = "aaa\naaa done\nbbb\n";
|
|
|
|
&compare_output($answer, &get_logfile(1));
|
|
|
|
|
|
|
|
# TEST 3: As above, in parallel
|
|
|
|
|
2000-04-22 02:11:17 +00:00
|
|
|
if ($parallel_jobs) {
|
|
|
|
&run_make_with_options($makefile, "-j10 bar", &get_logfile, 0);
|
|
|
|
$answer = "aaa\naaa done\nbbb\n";
|
|
|
|
&compare_output($answer, &get_logfile(1));
|
|
|
|
}
|
1999-12-08 20:13:50 +00:00
|
|
|
|
|
|
|
# TEST 4: Each double-colon rule is supposed to be run individually
|
|
|
|
|
2002-09-23 22:16:40 +00:00
|
|
|
&utouch(-5, 'f2.h');
|
1999-12-08 20:13:50 +00:00
|
|
|
&touch('foo');
|
|
|
|
|
|
|
|
&run_make_with_options($makefile, "foo", &get_logfile, 0);
|
|
|
|
$answer = "f1.h\nfoo FIRST\n";
|
|
|
|
&compare_output($answer, &get_logfile(1));
|
|
|
|
|
|
|
|
# TEST 5: Again, in parallel.
|
|
|
|
|
2000-04-22 02:11:17 +00:00
|
|
|
if ($parallel_jobs) {
|
|
|
|
&run_make_with_options($makefile, "-j10 foo", &get_logfile, 0);
|
|
|
|
$answer = "f1.h\nfoo FIRST\n";
|
|
|
|
&compare_output($answer, &get_logfile(1));
|
|
|
|
}
|
1999-12-08 20:13:50 +00:00
|
|
|
|
|
|
|
# TEST 6: Each double-colon rule is supposed to be run individually
|
|
|
|
|
2002-09-23 22:16:40 +00:00
|
|
|
&utouch(-5, 'f1.h');
|
1999-12-08 20:13:50 +00:00
|
|
|
unlink('f2.h');
|
|
|
|
&touch('foo');
|
|
|
|
|
|
|
|
&run_make_with_options($makefile, "foo", &get_logfile, 0);
|
|
|
|
$answer = "f2.h\nfoo SECOND\n";
|
|
|
|
&compare_output($answer, &get_logfile(1));
|
1999-09-14 02:03:19 +00:00
|
|
|
|
1999-12-08 20:13:50 +00:00
|
|
|
# TEST 7: Again, in parallel.
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2000-04-22 02:11:17 +00:00
|
|
|
if ($parallel_jobs) {
|
|
|
|
&run_make_with_options($makefile, "-j10 foo", &get_logfile, 0);
|
|
|
|
$answer = "f2.h\nfoo SECOND\n";
|
|
|
|
&compare_output($answer, &get_logfile(1));
|
|
|
|
}
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2000-03-27 06:54:37 +00:00
|
|
|
# TEST 8: Test circular dependency check; PR/1671
|
|
|
|
|
|
|
|
&run_make_with_options($makefile, "d", &get_logfile, 0);
|
|
|
|
$answer = "ok\n$make_name: Circular d <- d dependency dropped.\noops\n";
|
|
|
|
&compare_output($answer, &get_logfile(1));
|
|
|
|
|
1999-12-08 20:13:50 +00:00
|
|
|
# TEST 8: I don't grok why this is different than the above, but it is...
|
2000-01-27 00:00:27 +00:00
|
|
|
#
|
|
|
|
# Hmm... further testing indicates this might be timing-dependent?
|
|
|
|
#
|
2000-04-22 02:11:17 +00:00
|
|
|
#if ($parallel_jobs) {
|
|
|
|
# &run_make_with_options($makefile, "-j10 biz", &get_logfile, 0);
|
|
|
|
# $answer = "aaa\ntwo\nbbb\n";
|
|
|
|
# &compare_output($answer, &get_logfile(1));
|
|
|
|
#}
|
1999-09-14 02:03:19 +00:00
|
|
|
|
1999-12-08 20:13:50 +00:00
|
|
|
unlink('foo','f1.h','f2.h');
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2005-12-07 11:33:38 +00:00
|
|
|
|
|
|
|
# TEST 9: make sure all rules in s double colon family get executed
|
|
|
|
# (Savannah bug #14334).
|
|
|
|
#
|
|
|
|
|
|
|
|
&touch('one');
|
|
|
|
&touch('two');
|
|
|
|
|
|
|
|
run_make_test('
|
|
|
|
.PHONY: all
|
|
|
|
all: result
|
|
|
|
|
|
|
|
result:: one
|
|
|
|
@echo $^ >>$@
|
|
|
|
@echo $^
|
|
|
|
|
|
|
|
result:: two
|
|
|
|
@echo $^ >>$@
|
|
|
|
@echo $^
|
|
|
|
|
|
|
|
',
|
|
|
|
'',
|
|
|
|
'one
|
|
|
|
two');
|
|
|
|
|
|
|
|
unlink('result','one','two');
|
|
|
|
|
2016-05-21 21:26:00 +00:00
|
|
|
# TEST 10: SV 33399 : check for proper backslash handling
|
2011-11-14 07:31:06 +00:00
|
|
|
|
|
|
|
run_make_test('
|
|
|
|
a\ xb :: ; @echo one
|
|
|
|
a\ xb :: ; @echo two
|
|
|
|
',
|
|
|
|
'', "one\ntwo\n");
|
|
|
|
|
2016-05-21 21:26:00 +00:00
|
|
|
# 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");
|
|
|
|
|
2016-05-31 06:56:51 +00:00
|
|
|
# SV 47995 : Parallel double-colon rules with FORCE
|
|
|
|
|
|
|
|
run_make_test('
|
|
|
|
all:: ; @echo one
|
|
|
|
|
|
|
|
all:: joe ; @echo four
|
|
|
|
|
|
|
|
joe: FORCE ; touch joe-is-forced
|
|
|
|
|
|
|
|
FORCE:
|
|
|
|
',
|
|
|
|
'-j5', "one\ntouch joe-is-forced\nfour\n");
|
|
|
|
|
|
|
|
unlink('joe-is-forced');
|
|
|
|
|
2005-12-07 11:33:38 +00:00
|
|
|
# This tells the test driver that the perl test script executed properly.
|
1999-09-14 02:03:19 +00:00
|
|
|
1;
|
2016-05-21 21:26:00 +00:00
|
|
|
|
|
|
|
### Local Variables:
|
|
|
|
### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
|
|
|
|
### End:
|