5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 __revision__
= "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
28 Test that the --tree=all option prints a tree representation of the
29 complete dependencies of a target.
35 test
= TestSCons
.TestSCons()
37 CC
= test
.detect('CC')
38 LINK
= test
.detect('LINK')
39 if LINK
is None: LINK
= CC
41 test
.write('SConstruct', """
42 DefaultEnvironment(tools=[])
43 env = Environment(OBJSUFFIX = '.ooo', PROGSUFFIX = '.xxx')
44 env.Program('Foo', Split('Foo.c Bar.c'))
47 # N.B.: We use upper-case file names (Foo* and Bar*) so that the sorting
48 # order with our upper-case SConstruct file is the same on case-sensitive
49 # (UNIX/Linux) and case-insensitive (Windows) systems.
51 test
.write('Foo.c', r
"""
55 int main(int argc, char *argv[])
63 test
.write('Bar.c', """
68 test
.write('Foo.h', """
75 test
.write('Bar.h', """
97 test
.run(arguments
= "--tree=all Foo.xxx")
98 if test
.stdout().count(tree1
) != 1:
99 sys
.stdout
.write('Did not find expected tree (or found duplicate) in the following output:\n')
100 sys
.stdout
.write(test
.stdout())
134 test
.run(arguments
= "--tree=all .")
135 test
.must_contain_all_lines(test
.stdout(), [tree2
])
160 test
.run(arguments
= "--tree=all,prune .")
161 if test
.stdout().count(tree3
) != 1:
162 sys
.stdout
.write('Did not find expected tree (or found duplicate) in the following output:\n')
163 sys
.stdout
.write(test
.stdout())
166 test
.run(arguments
= "--tree=prune .")
167 if test
.stdout().count(tree3
) != 1:
168 sys
.stdout
.write('Did not find expected tree (or found duplicate) in the following output:\n')
169 sys
.stdout
.write(test
.stdout())
174 R = exists in repository only
198 test
.run(arguments
= '-c Foo.xxx')
200 test
.run(arguments
= "--no-exec --tree=all,status Foo.xxx")
201 if test
.stdout().count(tree4
) != 1:
202 sys
.stdout
.write('Did not find expected tree (or found duplicate) in the following output:\n')
203 sys
.stdout
.write(test
.stdout())
206 test
.run(arguments
= "--no-exec --tree=status Foo.xxx")
207 if test
.stdout().count(tree4
) != 1:
208 sys
.stdout
.write('Did not find expected tree (or found duplicate) in the following output:\n')
209 sys
.stdout
.write(test
.stdout())
212 # Make sure we print the debug stuff even if there's a build failure.
213 test
.write('Bar.h', """
218 THIS SHOULD CAUSE A BUILD FAILURE
221 test
.run(arguments
= "--tree=all Foo.xxx",
224 if test
.stdout().count(tree1
) != 1:
225 sys
.stdout
.write('Did not find expected tree (or found duplicate) in the following output:\n')
226 sys
.stdout
.write(test
.stdout())
233 # indent-tabs-mode:nil
235 # vim: set expandtab tabstop=4 shiftwidth=4: