VirtualBox

source: kBuild/vendor/gnumake/3.82-cvs/tests/scripts/features/include

Last change on this file was 2581, checked in by bird, 12 years ago

Sync'ed svn:eol-style with trunk.

  • Property svn:eol-style set to LF
File size: 3.6 KB
Line 
1# -*-mode: perl; rm-trailing-spaces: nil-*-
2
3$description = "Test various forms of the GNU make `include' command.";
4
5$details = "\
6Test include, -include, sinclude and various regressions involving them.
7Test extra whitespace at the end of the include, multiple -includes and
8sincludes (should not give an error) and make sure that errors are reported
9for targets that were also -included.";
10
11$makefile2 = &get_tmpfile;
12
13open(MAKEFILE,"> $makefile");
14
15# The contents of the Makefile ...
16
17print MAKEFILE <<EOF;
18\#Extra space at the end of the following file name
19include $makefile2
20all: ; \@echo There should be no errors for this makefile.
21
22-include nonexistent.mk
23-include nonexistent.mk
24sinclude nonexistent.mk
25sinclude nonexistent-2.mk
26-include makeit.mk
27sinclude makeit.mk
28
29error: makeit.mk
30EOF
31
32close(MAKEFILE);
33
34
35open(MAKEFILE,"> $makefile2");
36
37print MAKEFILE "ANOTHER: ; \@echo This is another included makefile\n";
38
39close(MAKEFILE);
40
41# Create the answer to what should be produced by this Makefile
42&run_make_with_options($makefile, "all", &get_logfile);
43$answer = "There should be no errors for this makefile.\n";
44&compare_output($answer, &get_logfile(1));
45
46&run_make_with_options($makefile, "ANOTHER", &get_logfile);
47$answer = "This is another included makefile\n";
48&compare_output($answer, &get_logfile(1));
49
50$makefile = undef;
51
52# Try to build the "error" target; this will fail since we don't know
53# how to create makeit.mk, but we should also get a message (even though
54# the -include suppressed it during the makefile read phase, we should
55# see one during the makefile run phase).
56
57run_make_test
58 ('
59-include foo.mk
60error: foo.mk ; @echo $@
61',
62 '',
63 "#MAKE#: *** No rule to make target `foo.mk', needed by `error'. Stop.\n",
64 512
65 );
66
67# Make sure that target-specific variables don't impact things. This could
68# happen because a file record is created when a target-specific variable is
69# set.
70
71run_make_test
72 ('
73bar.mk: foo := baz
74-include bar.mk
75hello: ; @echo hello
76',
77 '',
78 "hello\n"
79 );
80
81
82# Test inheritance of dontcare flag when rebuilding makefiles.
83#
84run_make_test('
85.PHONY: all
86all: ; @:
87
88-include foo
89
90foo: bar; @:
91', '', '');
92
93
94# Make sure that we don't die when the command fails but we dontcare.
95# (Savannah bug #13216).
96#
97run_make_test('
98.PHONY: all
99all:; @:
100
101-include foo
102
103foo: bar; @:
104
105bar:; @exit 1
106', '', '');
107
108# Check include, sinclude, -include with no filenames.
109# (Savannah bug #1761).
110
111run_make_test('
112.PHONY: all
113all:; @:
114include
115-include
116sinclude', '', '');
117
118
119# Test that the diagnostics is issued even if the target has been
120# tried before with the dontcare flag (direct dependency case).
121#
122run_make_test('
123-include foo
124
125all: bar
126
127foo: baz
128bar: baz
129',
130'',
131"#MAKE#: *** No rule to make target `baz', needed by `bar'. Stop.\n",
132512);
133
134# Test that the diagnostics is issued even if the target has been
135# tried before with the dontcare flag (indirect dependency case).
136#
137run_make_test('
138-include foo
139
140all: bar
141
142foo: baz
143bar: baz
144baz: end
145',
146'',
147"#MAKE#: *** No rule to make target `end', needed by `baz'. Stop.\n",
148512);
149
150# Test that the diagnostics is issued even if the target has been
151# tried before with the dontcare flag (include/-include case).
152#
153run_make_test('
154include bar
155-include foo
156
157all:
158
159foo: baz
160bar: baz
161baz: end
162',
163'',
164"#MAKEFILE#:2: bar: No such file or directory
165#MAKE#: *** No rule to make target `end', needed by `baz'. Stop.\n",
166512);
167
168if ($all_tests) {
169 # Test that include of a rebuild-able file doesn't show a warning
170 # Savannah bug #102
171 run_make_test(q!
172include foo
173foo: ; @echo foo = bar > $@
174!,
175 '', "#MAKE#: `foo' is up to date.\n");
176 rmfiles('foo');
177}
178
1791;
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette