make/tests/scripts/variables/MAKE_RESTARTS
Paul Smith deff9dacc9 Enhance the output sync mode.
Create a new file, output.c, and collect functions that generate output there.
We introduce a new global context specifying where output should go (to stdout
or to a sync file), and the lowest level output generator chooses where to
write output based on that context.

This allows us to set the context globally, and all operations that write
output (including functions like $(info ...) etc.) will use it.

Removed the "--trace=dir" capability.  It was too confusing.  If you have
directory tracking enabled then output sync will print the enter/leave message
for each synchronized block.  If you don't want that, disable directory
tracking.
2013-09-12 04:07:52 -04:00

62 lines
1.3 KiB
Perl

# -*-perl-*-
$description = "Test the MAKE_RESTARTS variable.";
# Test basic capability
run_make_test('
all: ; @:
$(info MAKE_RESTARTS=$(MAKE_RESTARTS))
include foo.x
foo.x: ; @touch $@
',
'', 'MAKE_RESTARTS=
#MAKEFILE#:4: foo.x: No such file or directory
MAKE_RESTARTS=1');
rmfiles('foo.x');
# Test multiple restarts
run_make_test('
all: ; @:
$(info MAKE_RESTARTS=$(MAKE_RESTARTS))
include foo.x
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');
# Test multiple restarts and make sure the variable is cleaned up
run_make_test('
recurse:
@echo recurse MAKE_RESTARTS=$$MAKE_RESTARTS
@$(MAKE) -f #MAKEFILE# all
all:
@echo all MAKE_RESTARTS=$$MAKE_RESTARTS
$(info MAKE_RESTARTS=$(MAKE_RESTARTS))
include foo.x
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#'
MAKE_RESTARTS=
all MAKE_RESTARTS=
#MAKE#[1]: Leaving directory '#PWD#'");
rmfiles('foo.x', 'bar.x');
1;