~ubuntu-branches/debian/sid/make-doc-non-dfsg/sid

« back to all changes in this revision

Viewing changes to tests/scripts/options/dash-B

  • Committer: Package Import Robot
  • Author(s): Manoj Srivastava
  • Date: 2014-05-04 18:48:47 UTC
  • mfrom: (4.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20140504184847-50zxi1b08m22ehle
Tags: 4.0-2
Move to usntable, since the make binary package has been uploaded
there. No changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#                                                                    -*-perl-*-
 
2
 
 
3
$description = "Test make -B (always remake) option.\n";
 
4
 
 
5
$details = "\
 
6
Construct a simple makefile that builds a target.
 
7
Invoke make once, so it builds everything.  Invoke it again and verify
 
8
that nothing is built.  Then invoke it with -B and verify that everything
 
9
is built again.";
 
10
 
 
11
&touch('bar.x');
 
12
 
 
13
run_make_test('
 
14
.SUFFIXES:
 
15
 
 
16
.PHONY: all
 
17
all: foo
 
18
 
 
19
foo: bar.x
 
20
        @echo cp $< $@
 
21
        @echo "" > $@
 
22
',
 
23
              '', 'cp bar.x foo');
 
24
 
 
25
run_make_test(undef, '', "#MAKE#: Nothing to be done for 'all'.");
 
26
run_make_test(undef, '-B', 'cp bar.x foo');
 
27
 
 
28
# Put the timestamp for foo into the future; it should still be remade.
 
29
 
 
30
utouch(1000, 'foo');
 
31
run_make_test(undef, '', "#MAKE#: Nothing to be done for 'all'.");
 
32
run_make_test(undef, '-B', 'cp bar.x foo');
 
33
 
 
34
# Clean up
 
35
 
 
36
rmfiles('bar.x', 'foo');
 
37
 
 
38
# Test -B with the re-exec feature: we don't want to re-exec forever
 
39
# Savannah bug # 7566
 
40
 
 
41
run_make_test('
 
42
all: ; @:
 
43
$(info MAKE_RESTARTS=$(MAKE_RESTARTS))
 
44
include foo.x
 
45
foo.x: ; @touch $@
 
46
',
 
47
              '-B', 'MAKE_RESTARTS=
 
48
#MAKEFILE#:4: foo.x: No such file or directory
 
49
MAKE_RESTARTS=1');
 
50
 
 
51
rmfiles('foo.x');
 
52
 
 
53
# Test -B with the re-exec feature: we DO want -B in the "normal" part of the
 
54
# makefile.
 
55
 
 
56
&touch('blah.x');
 
57
 
 
58
run_make_test('
 
59
all: blah.x ; @echo $@
 
60
$(info MAKE_RESTARTS=$(MAKE_RESTARTS))
 
61
include foo.x
 
62
foo.x: ; @touch $@
 
63
blah.x: ; @echo $@
 
64
',
 
65
              '-B', 'MAKE_RESTARTS=
 
66
#MAKEFILE#:4: foo.x: No such file or directory
 
67
MAKE_RESTARTS=1
 
68
blah.x
 
69
all');
 
70
 
 
71
rmfiles('foo.x', 'blah.x');
 
72
 
 
73
# Test that $? is set properly with -B; all prerequisites will be newer!
 
74
 
 
75
utouch(-10, 'x.b');
 
76
touch('x.a');
 
77
 
 
78
run_make_test(q!
 
79
x.a: x.b ; @echo $?
 
80
!,
 
81
              '-B', "x.b\n");
 
82
 
 
83
unlink(qw(x.a x.b));
 
84
 
 
85
1;