Paul Smith fdcaaed8d7 * tests/scripts/*: Switch TAB chars to #TAB# markup
Avoid Emacs local variable settings to disable whitespace cleanup,
by creating markup tokens for TAB characters (#TAB#) and space
characters (#SPACE#) (for end-of-line spaces).  Modify all the
tests that use TABs to use the new markup.  This requires changing
some old-fashioned tests to use the modern run_make_test().  Also
remove some of the comments regarding test numbers now that the
framework keeps track.
2025-08-24 14:29:11 -04:00

85 lines
1.7 KiB
Perl

# -*-perl-*-
$description = "Test make -B (always remake) option.\n";
$details = "\
Construct a simple makefile that builds a target.
Invoke make once, so it builds everything. Invoke it again and verify
that nothing is built. Then invoke it with -B and verify that everything
is built again.";
&touch('bar.x');
run_make_test(q!
.SUFFIXES:
.PHONY: all
all: foo
foo: bar.x
#TAB#@echo cp $< $@
#TAB#@echo "" > $@
!,
'', 'cp bar.x foo');
run_make_test(undef, '', "#MAKE#: Nothing to be done for 'all'.");
run_make_test(undef, '-B', 'cp bar.x foo');
# Put the timestamp for foo into the future; it should still be remade.
# There are clock skew errors printed here but they will be cleared by
# the comparison code.
utouch(1000, 'foo');
run_make_test(undef, '', "#MAKE#: Nothing to be done for 'all'.");
run_make_test(undef, '-B', 'cp bar.x foo');
# Clean up
rmfiles('bar.x', 'foo');
# Test -B with the re-exec feature: we don't want to re-exec forever
# Savannah bug # 7566
run_make_test(q!
all: ; @:
$(info MAKE_RESTARTS=$(MAKE_RESTARTS))
include foo.x
foo.x: ; @touch $@
!,
'-B', 'MAKE_RESTARTS=
MAKE_RESTARTS=1');
rmfiles('foo.x');
# Test -B with the re-exec feature: we DO want -B in the "normal" part of the
# makefile.
&touch('blah.x');
run_make_test(q!
all: blah.x ; @echo $@
$(info MAKE_RESTARTS=$(MAKE_RESTARTS))
include foo.x
foo.x: ; @touch $@
blah.x: ; @echo $@
!,
'-B', 'MAKE_RESTARTS=
MAKE_RESTARTS=1
blah.x
all');
rmfiles('foo.x', 'blah.x');
# Test that $? is set properly with -B; all prerequisites will be newer!
utouch(-10, 'x.b');
touch('x.a');
run_make_test(q!
x.a: x.b ; @echo $?
!,
'-B', "x.b\n");
unlink(qw(x.a x.b));
1;