* job.c (child_error): Combine file info with error message.

* tests/scripts/...: Update error message matches.
This commit is contained in:
Paul Smith 2016-03-19 17:24:00 -04:00
parent 09202bc880
commit b4682cb479
12 changed files with 51 additions and 52 deletions

7
job.c
View file

@ -506,19 +506,16 @@ child_error (struct child *child,
OUTPUT_SET (&child->output);
message (0, l + strlen (nm),
_("%s: recipe for target '%s' failed"), nm, f->name);
l += strlen (pre) + strlen (post);
if (exit_sig == 0)
error (NILF, l + INTSTR_LENGTH,
_("%s[%s] Error %d%s"), pre, f->name, exit_code, post);
_("%s[%s: %s] Error %d%s"), pre, nm, f->name, exit_code, post);
else
{
const char *s = strsignal (exit_sig);
error (NILF, l + strlen (s) + strlen (dump),
_("%s[%s] %s%s%s"), pre, f->name, s, dump, post);
"%s[%s: %s] %s%s%s", pre, nm, f->name, s, dump, post);
}
OUTPUT_UNSET ();

View file

@ -30,7 +30,7 @@ open(MAKEFILE,"> $makefile");
print MAKEFILE "clean:\n"
."\t-$rm_command cleanit\n"
."\t$rm_command foo\n"
."clean2: \n"
."clean2: \n"
."\t$rm_command cleanit\n"
."\t$rm_command foo\n";
@ -50,8 +50,7 @@ $delete_error_code = $? >> 8;
$answer = "$rm_command cleanit
$cleanit_error
$makefile:2: recipe for target 'clean' failed
$make_name: [clean] Error $delete_error_code (ignored)
$make_name: [$makefile:2: clean] Error $delete_error_code (ignored)
$rm_command foo\n";
&run_make_with_options($makefile,"",&get_logfile);
@ -78,8 +77,7 @@ if (!$vos)
$answer = "$rm_command cleanit
$cleanit_error
$makefile:5: recipe for target 'clean2' failed
$make_name: [clean2] Error $delete_error_code (ignored)
$make_name: [$makefile:5: clean2] Error $delete_error_code (ignored)
$rm_command foo\n";
&run_make_with_options($makefile,"clean2 -i",&get_logfile);

View file

@ -204,11 +204,9 @@ bar: end
#MAKE#[1]: Entering directory '#PWD#/foo'
foo-fail: start
foo-fail: end
Makefile:20: recipe for target 'foo-fail' failed
#MAKE#[1]: *** [foo-fail] Error 1
#MAKE#[1]: *** [Makefile:20: foo-fail] Error 1
#MAKE#[1]: Leaving directory '#PWD#/foo'
#MAKEFILE#:4: recipe for target 'make-foo-fail' failed
#MAKE#: *** [make-foo-fail] Error 2\n",
#MAKE#: *** [#MAKEFILE#:4: make-foo-fail] Error 2\n",
512);
# Test the per-job synchronization.
@ -326,7 +324,7 @@ run_make_test(qq!
all: t1
t1: ; -\@\$(MAKE) -f $m1
!,
"-j -Oline", "#MAKE#[1]: Entering directory '#PWD#'\nd1 stderr\nd1 stdout\n$m1:3: *** d1 failed. Stop.\n#MAKE#[1]: Leaving directory '#PWD#'\n#MAKEFILE#:3: recipe for target 't1' failed\n#MAKE#: [t1] Error 2 (ignored)\n");
"-j -Oline", "#MAKE#[1]: Entering directory '#PWD#'\nd1 stderr\nd1 stdout\n$m1:3: *** d1 failed. Stop.\n#MAKE#[1]: Leaving directory '#PWD#'\n#MAKE#: [#MAKEFILE#:3: t1] Error 2 (ignored)\n");
rmfiles($m1);
@ -343,7 +341,7 @@ foo: $(OBJS) ; echo $(or $(filter %.o,$^),$(error fail))
run_make_test(q!
all:: ; @./foo bar baz
!,
'-O', "#MAKE#: ./foo: Command not found\n#MAKEFILE#:2: recipe for target 'all' failed\n#MAKE#: *** [all] Error 127\n", 512);
'-O', "#MAKE#: ./foo: Command not found\n#MAKE#: *** [#MAKEFILE#:2: all] Error 127\n", 512);
# This tells the test driver that the perl test script executed properly.
1;

View file

@ -99,15 +99,12 @@ ok:
\@$sleep_command 4
\@echo Ok done",
'-rR -j5', "Fail
#MAKEFILE#:6: recipe for target 'fail.1' failed
#MAKE#: *** [fail.1] Error 1
#MAKE#: *** [#MAKEFILE#:6: fail.1] Error 1
#MAKE#: *** Waiting for unfinished jobs....
Fail
#MAKEFILE#:6: recipe for target 'fail.2' failed
#MAKE#: *** [fail.2] Error 1
#MAKE#: *** [#MAKEFILE#:6: fail.2] Error 1
Fail
#MAKEFILE#:6: recipe for target 'fail.3' failed
#MAKE#: *** [fail.3] Error 1
#MAKE#: *** [#MAKEFILE#:6: fail.3] Error 1
Ok done",
512);
@ -214,3 +211,7 @@ rmfiles('file1', 'file2', 'file3', 'file4');
# rmfiles(qw(dependfile output));
1;
### Local Variables:
### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
### End:

View file

@ -110,8 +110,7 @@ $(dir)/foo.bar:
',
"dir=$dir",
"#MAKEFILE#:6: recipe for target '$dir/foo.bar' failed
#MAKE#: *** [$dir/foo.bar] Error 1",
"#MAKE#: *** [#MAKEFILE#:6: $dir/foo.bar] Error 1",
512);
unlink("$dir/foo.bar");
@ -223,3 +222,7 @@ all: foo.x foo-mt.x
# 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:

View file

@ -86,8 +86,7 @@ cat ${VP}foo.c bar.c > foo.b 2>/dev/null || exit 1
$answer = "not creating notarget.c from notarget.d
cat notarget.c > notarget.b 2>/dev/null || exit 1
$makefile:16: recipe for target 'notarget.b' failed
$make_name: *** [notarget.b] Error 1
$make_name: *** [$makefile:16: notarget.b] Error 1
";
&compare_output($answer,&get_logfile(1));
@ -127,3 +126,7 @@ rm inter.c
unlink @touchedfiles unless $keep;
1;
### Local Variables:
### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
### End:

View file

@ -310,4 +310,6 @@ foo bar
hi
foo bar');
run_make_test('x:;@-exit 1', '', "#MAKE#: [#MAKEFILE#:1: x] Error 1 (ignored)\n");
1;

View file

@ -42,7 +42,7 @@ close(MAKEFILE);
"$workdir${pathsep}command.h",
"$workdir${pathsep}commands.c","$workdir${pathsep}display.c",
"$workdir${pathsep}buffer.h",
"$workdir${pathsep}command.c");
"$workdir${pathsep}command.c");
&touch(@files_to_touch);
@ -92,8 +92,7 @@ close(MAKEFILE);
&run_make_with_options($makefile2, "-k", &get_logfile, $error_code);
$answer = "exit 1
$makefile2:9: recipe for target 'foo.o' failed
$make_name: *** [foo.o] Error 1
$make_name: *** [$makefile2:9: foo.o] Error 1
$make_name: Target 'all' not remade because of errors.\n";
&compare_output($answer, &get_logfile(1));

View file

@ -8,7 +8,7 @@ run_make_test('
.DELETE_ON_ERROR:
all: ; false > $@
',
'', "false > all\n#MAKEFILE#:3: recipe for target 'all' failed\n#MAKE#: *** [all] Error 1\n#MAKE#: *** Deleting file 'all'", 512);
'', "false > all\n#MAKE#: *** [#MAKEFILE#:3: all] Error 1\n#MAKE#: *** Deleting file 'all'", 512);
run_make_test('
.DELETE_ON_ERROR:
@ -16,7 +16,7 @@ all: foo.x ;
%.x : %.q ; echo > $@
%.q : ; false > $@
',
'', "false > foo.q\n#MAKEFILE#:5: recipe for target 'foo.q' failed\n#MAKE#: *** [foo.q] Error 1\n#MAKE#: *** Deleting file 'foo.q'", 512);
'', "false > foo.q\n#MAKE#: *** [#MAKEFILE#:5: foo.q] Error 1\n#MAKE#: *** Deleting file 'foo.q'", 512);
# This tells the test driver that the perl test script executed properly.
1;

View file

@ -17,8 +17,7 @@ run_make_test(qq!
.POSIX:
all: ; \@$script
!,
'', "#MAKEFILE#:3: recipe for target 'all' failed
#MAKE#: *** [all] Error $err\n", 512);
'', "#MAKE#: *** [#MAKEFILE#:3: all] Error $err\n", 512);
# User settings must override .POSIX
$flags = '-xc';

View file

@ -97,7 +97,6 @@ run_make_test(qq!
.SHELLFLAGS = $flags
all: ; \@$script
!,
'', "$out#MAKEFILE#:3: recipe for target 'all' failed
#MAKE#: *** [all] Error $err\n", 512);
'', "$out#MAKE#: *** [#MAKEFILE#:3: all] Error $err\n", 512);
1;

View file

@ -39,9 +39,9 @@ all:;@:
# X1 := $(sort $(.TARGETS))
# all: foo
# @echo X1 = $(X1)
# @echo X2 = $(X2)
# @echo LAST = $(sort $(.TARGETS))
# @echo X1 = $(X1)
# @echo X2 = $(X2)
# @echo LAST = $(sort $(.TARGETS))
# X2 := $(sort $(.TARGETS))
@ -64,16 +64,16 @@ define foo
: foo-one\
foo-two
: foo-three
: foo-four
: foo-four
endef
orig: ; : orig-one
: orig-two \
: orig-two \
orig-three \
orig-four \
orig-five \\\\
: orig-six
$(foo)
orig-four \
orig-five \\\\
: orig-six
$(foo)
.RECIPEPREFIX = >
test: ; : test-one
@ -86,19 +86,19 @@ test-three \
.RECIPEPREFIX =
reset: ; : reset-one
: reset-two \
: reset-two \
reset-three \
reset-four \
reset-five \\\\
: reset-six
$(foo)
reset-four \
reset-five \\\\
: reset-six
$(foo)
',
'orig test reset',
': orig-one
: orig-two \
orig-three \
orig-four \
orig-five \\\\
orig-five \\\\
: orig-six
: foo-one foo-two
: foo-three
@ -107,7 +107,7 @@ orig-four \
: test-two \
test-three \
test-four \
test-five \\\\
test-five \\\\
: test-six
: foo-one foo-two
: foo-three
@ -116,7 +116,7 @@ test-four \
: reset-two \
reset-three \
reset-four \
reset-five \\\\
reset-five \\\\
: reset-six
: foo-one foo-two
: foo-three