]> git.ipfire.org Git - thirdparty/make.git/commitdiff
* tests/scripts/features/double_colon: Update for modern tests.
authorPaul Smith <psmith@gnu.org>
Sun, 23 Jan 2022 20:46:56 +0000 (15:46 -0500)
committerPaul Smith <psmith@gnu.org>
Sun, 6 Feb 2022 23:46:32 +0000 (18:46 -0500)
tests/scripts/features/double_colon

index c4996e730699a8020faba20562b43dc05bf6db8f..a039b0a9a87f0cf451ee47203bae51a5a41ce8c3 100644 (file)
@@ -12,12 +12,9 @@ We test these features:
 Then we do the same thing for parallel builds: double-colon
 targets should always be built serially.";
 
-# The Contents of the MAKEFILE ...
-
-open(MAKEFILE,"> $makefile");
-
-print MAKEFILE <<'EOF';
+# TEST 0: A simple double-colon rule that isn't the goal target.
 
+run_make_test(q!
 all: baz
 
 foo:: f1.h ; @echo foo FIRST
@@ -38,37 +35,23 @@ f1.h f2.h: ; @echo $@
 
 d :: ; @echo ok
 d :: d ; @echo oops
-
-EOF
-
-close(MAKEFILE);
-
-# 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));
+!,
+              "all", "aaa\nbbb\n");
 
 # TEST 1: As above, in parallel
 
 if ($parallel_jobs) {
-  &run_make_with_options($makefile, "-j10 all", &get_logfile, 0);
-  $answer = "aaa\nbbb\n";
-  &compare_output($answer, &get_logfile(1));
+  run_make_test(undef, "-j10 all", "aaa\nbbb\n");
 }
 
 # 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));
+run_make_test(undef, "bar", "aaa\naaa done\nbbb\n");
 
 # TEST 3: As above, in parallel
 
 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));
+  run_make_test(undef, "-j10 bar", "aaa\naaa done\nbbb\n");
 }
 
 # TEST 4: Each double-colon rule is supposed to be run individually
@@ -76,16 +59,12 @@ if ($parallel_jobs) {
 &utouch(-5, '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));
+run_make_test(undef, "foo", "f1.h\nfoo FIRST\n");
 
 # TEST 5: Again, in parallel.
 
 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));
+  run_make_test(undef, "-j10 foo", "f1.h\nfoo FIRST\n");
 }
 
 # TEST 6: Each double-colon rule is supposed to be run individually
@@ -94,32 +73,24 @@ if ($parallel_jobs) {
 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_test(undef, "foo", "f2.h\nfoo SECOND\n");
 
 # TEST 7: Again, in parallel.
 
 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));
+  run_make_test(undef, "-j10 foo", "f2.h\nfoo SECOND\n");
 }
 
 # 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));
+run_make_test(undef, "d", "ok\n$make_name: Circular d <- d dependency dropped.\noops\n");
 
 # TEST 8: I don't grok why this is different than the above, but it is...
 #
 # Hmm... further testing indicates this might be timing-dependent?
 #
 #if ($parallel_jobs) {
-#  &run_make_with_options($makefile, "-j10 biz", &get_logfile, 0);
-#  $answer = "aaa\ntwo\nbbb\n";
-#  &compare_output($answer, &get_logfile(1));
+#  run_make_test(undef, "-j10 biz", "aaa\ntwo\nbbb\n");
 #}
 
 unlink('foo','f1.h','f2.h');
@@ -133,16 +104,17 @@ unlink('foo','f1.h','f2.h');
 &touch('two');
 
 run_make_test('
+.RECIPEPREFIX = >
 .PHONY: all
 all: result
 
 result:: one
-       @echo $^ >>$@
-       @echo $^
+> @echo $^ >>$@
+> @echo $^
 
 result:: two
-       @echo $^ >>$@
-       @echo $^
+> @echo $^ >>$@
+> @echo $^
 
 ',
 '',
@@ -161,23 +133,25 @@ a\ xb :: ; @echo two
 
 # Test 11: SV 44742 : All double-colon rules should be run in parallel build.
 
-run_make_test('result :: 01
-       @echo update
-       @touch $@
+run_make_test('
+.RECIPEPREFIX = >
+result :: 01
+> @echo update
+> @touch $@
 result :: 02
-       @echo update
-       @touch $@
+> @echo update
+> @touch $@
 result :: 03
-       @echo update
-       @touch $@
+> @echo update
+> @touch $@
 result :: 04
-       @echo update
-       @touch $@
+> @echo update
+> @touch $@
 result :: 05
-       @echo update
-       @touch $@
+> @echo update
+> @touch $@
 01 02 03 04 05:
-       @touch 01 02 03 04 05
+> @touch 01 02 03 04 05
 ',
               '-j10 result', "update\nupdate\nupdate\nupdate\nupdate\n");
 
@@ -186,14 +160,10 @@ 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 $*
+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");
 
@@ -237,6 +207,8 @@ all: hello.z
 !,
               '', "#MAKE#: Nothing to be done for 'all'.\n");
 
+unlink('hello.z');
+
 # subtest 3
 # hello.x is explicitly mentioned on an unrelated rule and thus is not an
 # intermediate file.
@@ -256,7 +228,3 @@ unlink('hello.z');
 
 # This tells the test driver that the perl test script executed properly.
 1;
-
-### Local Variables:
-### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
-### End: