summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>1999-12-08 20:13:50 +0000
committerPaul Smith <psmith@gnu.org>1999-12-08 20:13:50 +0000
commit1a35bfb45b3dfbd38c583247a90a21c3b10ccafa (patch)
tree7bf18f5dc4e35fc80b9c28e7e0b82d996065c510 /tests
parent4d5c556f00ae97b16696cc1ff779ac8e45d6fc27 (diff)
downloadgunmake-1a35bfb45b3dfbd38c583247a90a21c3b10ccafa.tar.gz
* Various changes and fixes. See ChangeLog.
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog6
-rw-r--r--tests/scripts/features/double_colon118
-rw-r--r--tests/scripts/options/dash-n2
3 files changed, 99 insertions, 27 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index f021491..26707d4 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,9 @@
+1999-12-01 Paul D. Smith <psmith@gnu.org>
+
+ * scripts/features/double_colon: Add a test for PR/1476: Try
+ double-colon rules as non-goal targets and during parallel builds
+ to make sure they're handled serially.
+
1999-11-17 Paul D. Smith <psmith@gnu.org>
* scripts/functions/if: Add a test for PR/1429: put some text
diff --git a/tests/scripts/features/double_colon b/tests/scripts/features/double_colon
index 096fb33..b94fc57 100644
--- a/tests/scripts/features/double_colon
+++ b/tests/scripts/features/double_colon
@@ -1,43 +1,107 @@
-$description = "The following test creates a makefile to test Double-Colon\n"
- ."Rules. They are rules which are written with '::' instead\n"
- ."of ':' after the target names. This tells make that each \n"
- ."of these rules are independent of the others and each rule's\n"
- ."commands are executed if the target is older than any \n"
- ."dependencies of that rule.";
-
-$details = "The makefile created by this test contains two double-colon \n"
- ."rules for foo; each with their own commands. When make is run,\n"
- ."each command should be executed in the sequence that they are \n"
- ."found. The command is a simple echo statement.";
+# -*-perl-*-
+$description = "Test handling of double-colon rules.";
-open(MAKEFILE,"> $makefile");
+$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.";
# The Contents of the MAKEFILE ...
-print MAKEFILE "foo:: bar.h \n"
- ."\t\@echo Executing rule foo FIRST\n"
- ."foo2: bar.h \n"
- ."foo:: bar2.h \n"
- ."\t\@echo Executing rule foo SECOND\n";
+open(MAKEFILE,"> $makefile");
+
+print MAKEFILE <<'EOF';
+
+all: baz
+
+foo:: f1.h ; @echo foo FIRST
+foo:: f2.h ; @echo foo SECOND
-# END of Contents of MAKEFILE
+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 $@
+
+EOF
close(MAKEFILE);
-&touch("bar.h","bar2.h");
+# 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
+
+&run_make_with_options($makefile, "-j10 all", &get_logfile, 0);
+$answer = "aaa\nbbb\n";
+&compare_output($answer, &get_logfile(1));
+
+# 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
+
+&run_make_with_options($makefile, "-j10 bar", &get_logfile, 0);
+$answer = "aaa\naaa done\nbbb\n";
+&compare_output($answer, &get_logfile(1));
+
+# TEST 4: Each double-colon rule is supposed to be run individually
+
+&touch('f2.h');
+&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.
+
+&run_make_with_options($makefile, "-j10 foo", &get_logfile, 0);
+$answer = "f1.h\nfoo FIRST\n";
+&compare_output($answer, &get_logfile(1));
+
+# TEST 6: Each double-colon rule is supposed to be run individually
+
+&touch('f1.h');
+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));
-&run_make_with_options($makefile,
- "",
- &get_logfile,
- 0);
+# TEST 7: Again, in parallel.
+&run_make_with_options($makefile, "-j10 foo", &get_logfile, 0);
+$answer = "f2.h\nfoo SECOND\n";
+&compare_output($answer, &get_logfile(1));
-$answer = "Executing rule foo FIRST\n"
- ."Executing rule foo SECOND\n";
+# TEST 8: I don't grok why this is different than the above, but it is...
-&compare_output($answer,&get_logfile(1));
+&run_make_with_options($makefile, "-j10 biz", &get_logfile, 0);
+$answer = "aaa\ntwo\nbbb\n";
+&compare_output($answer, &get_logfile(1));
-unlink("bar.h","bar2.h");
+unlink('foo','f1.h','f2.h');
1;
diff --git a/tests/scripts/options/dash-n b/tests/scripts/options/dash-n
index 02d7f07..73e946e 100644
--- a/tests/scripts/options/dash-n
+++ b/tests/scripts/options/dash-n
@@ -58,4 +58,6 @@ $answer = "$make_name: `a' is up to date.\n";
$answer = "$make_name: `a' is up to date.\n";
&compare_output($answer, &get_logfile(1));
+unlink('a', 'b', 'c');
+
1;