summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2016-04-09 19:49:27 -0400
committerPaul Smith <psmith@gnu.org>2016-04-09 20:06:46 -0400
commit87a5f98d248fe63fe6e3e53ee3e1b1b1fa5e49dc (patch)
treee97a49d65b0cf7901eb6b551a7d5085353e6f04a /tests
parent53554e41e8ab9ba4d70787881d0a57b94eda1c63 (diff)
[SV 102] Don't show unnecessary include file errors.
Delay the generation of error messages for included files until we are sure that we can't rebuild that included file. * dep.h (struct dep): Don't reuse "changed"; make a separate field to keep "flags". Get rid of dontcare and use the flag. (struct goaldep): Create a new structure for goal prereqs that tracks an errno value and the floc where the include happened. Rework the structures to ensure they are supersets as expected. In maintainer mode with GCC, use inline to get type checking. * read.c (eval_makefile): Return a struct goaldep for the new makefile. Ensure errno is set properly to denote a failure. (read_all_makefiles): Switch to goaldep and check errno. (eval): Don't show included file errors; instead remember them. * remake.c (update_goal_chain): Set global variables to the current goaldep we're building, and the entire chain. (show_goal_error): Check if the current failure is a consequence of building an included makefile and if so print an error. (complain): Call show_goal_error() on rule failure. * job.c (child_error): Call show_goal_error() on child error. * main.c (main): Switch from struct dep to goaldep. * misc.c (free_dep_chain): Not used; make into a macro. * tests/scripts/features/include: Update and include new tests. * tests/scripts/options/dash-B, tests/scripts/options/dash-W, tests/scripts/options/print-directory, tests/scripts/variables/MAKE_RESTARTS: Update known-good-output.
Diffstat (limited to 'tests')
-rw-r--r--tests/scripts/features/include64
-rw-r--r--tests/scripts/options/dash-B6
-rw-r--r--tests/scripts/options/dash-W7
-rw-r--r--tests/scripts/options/print-directory4
-rw-r--r--tests/scripts/variables/MAKE_RESTARTS9
5 files changed, 79 insertions, 11 deletions
diff --git a/tests/scripts/features/include b/tests/scripts/features/include
index ee014bd8..f78563f9 100644
--- a/tests/scripts/features/include
+++ b/tests/scripts/features/include
@@ -165,6 +165,70 @@ baz: end
#MAKE#: *** No rule to make target 'end', needed by 'baz'. Stop.\n",
512);
+# Test include of make-able file doesn't show an error (Savannah #102)
+run_make_test(q!
+.PHONY: default
+default:; @echo DONE
+
+inc1:; echo > $@
+include inc1
+include inc2
+inc2:; echo > $@
+!,
+ '', "echo > inc2\necho > inc1\nDONE\n");
+
+rmfiles('inc1', 'inc2');
+
+# Test include of non-make-able file does show an error (Savannah #102)
+run_make_test(q!
+.PHONY: default
+default:; @echo DONE
+
+inc1:; echo > $@
+include inc1
+include inc2
+!,
+ '', "#MAKEFILE#:7: inc2: No such file or directory\n#MAKE#: *** No rule to make target 'inc2'. Stop.\n", 512);
+
+rmfiles('inc1');
+
+# Include same file multiple times
+
+run_make_test(q!
+default:; @echo DEFAULT
+include inc1
+inc1:; echo > $@
+include inc1
+!,
+ '', "echo > inc1\nDEFAULT\n");
+
+rmfiles('inc1');
+
+# Included file has a prerequisite that fails to build
+
+run_make_test(q!
+default:; @echo DEFAULT
+include inc1
+inc1: foo; echo > $@
+foo:; exit 1
+!,
+ '', "exit 1\n#MAKEFILE#:3: inc1: No such file or directory\n#MAKE#: *** [#MAKEFILE#:5: foo] Error 1\n", 512);
+
+rmfiles('inc1');
+
+# Included file has a prerequisite we don't know how to build
+
+run_make_test(q!
+default:; @echo DEFAULT
+include inc1
+inc1: foo; echo > $@
+!,
+ '', "#MAKEFILE#:3: inc1: No such file or directory\n#MAKE#: *** No rule to make target 'foo', needed by 'inc1'. Stop.\n", 512);
+
+rmfiles('inc1');
+
+# include a directory
+
if ($all_tests) {
# Test that include of a rebuild-able file doesn't show a warning
# Savannah bug #102
diff --git a/tests/scripts/options/dash-B b/tests/scripts/options/dash-B
index 9c708b77..4c4c4cfb 100644
--- a/tests/scripts/options/dash-B
+++ b/tests/scripts/options/dash-B
@@ -45,7 +45,6 @@ include foo.x
foo.x: ; @touch $@
',
'-B', 'MAKE_RESTARTS=
-#MAKEFILE#:4: foo.x: No such file or directory
MAKE_RESTARTS=1');
rmfiles('foo.x');
@@ -63,7 +62,6 @@ foo.x: ; @touch $@
blah.x: ; @echo $@
',
'-B', 'MAKE_RESTARTS=
-#MAKEFILE#:4: foo.x: No such file or directory
MAKE_RESTARTS=1
blah.x
all');
@@ -83,3 +81,7 @@ x.a: x.b ; @echo $?
unlink(qw(x.a x.b));
1;
+
+### Local Variables:
+### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
+### End:
diff --git a/tests/scripts/options/dash-W b/tests/scripts/options/dash-W
index 20b9f745..857b1cce 100644
--- a/tests/scripts/options/dash-W
+++ b/tests/scripts/options/dash-W
@@ -42,8 +42,7 @@ foo.x: bar.x
bar.x: ; echo >> $@
baz.x: bar.x ; @echo "touch $@"
',
- '', '#MAKEFILE#:3: foo.x: No such file or directory
-echo >> bar.x
+ '', 'echo >> bar.x
touch foo.x
restarts=1
touch baz.x');
@@ -86,3 +85,7 @@ unlink(qw(y x-dir/x));
rmdir('x-dir');
1;
+
+### Local Variables:
+### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
+### End:
diff --git a/tests/scripts/options/print-directory b/tests/scripts/options/print-directory
index a05bbee7..db762b2c 100644
--- a/tests/scripts/options/print-directory
+++ b/tests/scripts/options/print-directory
@@ -18,7 +18,7 @@ include foo
all: ;@:
foo: ; touch foo
!,
- "", "#MAKEFILE#:2: foo: No such file or directory\ntouch foo\n");
+ "", "touch foo\n");
unlink('foo');
# Test makefile rebuild with -w
@@ -27,7 +27,7 @@ include foo
all: ;@:
foo: ; touch foo
!,
- "-w", "#MAKE#: Entering directory '#PWD#'\n#MAKEFILE#:2: foo: No such file or directory\ntouch foo\n#MAKE#: Leaving directory '#PWD#'\n");
+ "-w", "#MAKE#: Entering directory '#PWD#'\ntouch foo\n#MAKE#: Leaving directory '#PWD#'\n");
unlink('foo');
1;
diff --git a/tests/scripts/variables/MAKE_RESTARTS b/tests/scripts/variables/MAKE_RESTARTS
index ef8e368f..01bf55ec 100644
--- a/tests/scripts/variables/MAKE_RESTARTS
+++ b/tests/scripts/variables/MAKE_RESTARTS
@@ -11,7 +11,6 @@ include foo.x
foo.x: ; @touch $@
',
'', 'MAKE_RESTARTS=
-#MAKEFILE#:4: foo.x: No such file or directory
MAKE_RESTARTS=1');
rmfiles('foo.x');
@@ -26,9 +25,7 @@ foo.x: ; @echo "include bar.x" > $@
bar.x: ; @touch $@
',
'', 'MAKE_RESTARTS=
-#MAKEFILE#:4: foo.x: No such file or directory
MAKE_RESTARTS=1
-foo.x:1: bar.x: No such file or directory
MAKE_RESTARTS=2');
rmfiles('foo.x', 'bar.x');
@@ -47,9 +44,7 @@ foo.x: ; @echo "include bar.x" > $@
bar.x: ; @touch $@
',
'', "MAKE_RESTARTS=
-#MAKEFILE#:8: foo.x: No such file or directory
MAKE_RESTARTS=1
-foo.x:1: bar.x: No such file or directory
MAKE_RESTARTS=2
recurse MAKE_RESTARTS=
#MAKE#[1]: Entering directory '#PWD#'
@@ -60,3 +55,7 @@ all MAKE_RESTARTS=
rmfiles('foo.x', 'bar.x');
1;
+
+### Local Variables:
+### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
+### End: