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 the ability to scan additional filesuffixes added to $CPPSUFFIXES.
33 _python_
= TestSCons
._python
_
35 test
= TestSCons
.TestSCons()
37 test
.write('mycc.py', r
"""
39 def do_file(outf, inf):
40 with open(inf, 'r') as ifp:
41 for line in ifp.readlines():
42 if line[:10] == '#include <':
43 do_file(outf, line[10:-2])
46 with open(sys.argv[1], 'w') as outf:
47 for f in sys.argv[2:]:
52 test
.write('SConstruct', """
53 DefaultEnvironment(tools=[])
54 env = Environment(CPPPATH = ['.'],
55 CC = r'%(_python_)s mycc.py',
57 CCCOM = '$CC $TARGET $SOURCES',
59 env.Append(CPPSUFFIXES = ['.x'])
60 env.Object(target = 'test1', source = 'test1.c')
61 env.InstallAs('test1_c', 'test1.c')
62 env.InstallAs('test1_h', 'test1.h')
63 env.InstallAs('test1_x', 'test1.x')
66 test
.write('test1.c', """\
72 test
.write('test1.h', """\
77 test
.write('test1.x', """\
82 test
.write('foo.h', "foo.h 1\n")
84 expect
= test
.wrap_stdout("""\
85 %(_python_)s mycc.py test1.o test1.c
86 Install file: "test1.c" as "test1_c"
87 Install file: "test1.h" as "test1_h"
88 Install file: "test1.x" as "test1_x"
91 test
.run(arguments
='.', stdout
=expect
)
93 test
.must_match('test1.o', """\
101 test
.up_to_date(arguments
='.')
103 test
.write('foo.h', "foo.h 2\n")
105 expect
= test
.wrap_stdout("""\
106 %(_python_)s mycc.py test1.o test1.c
109 test
.run(arguments
='.', stdout
=expect
)
111 test
.must_match('test1.o', """\
119 test
.up_to_date(arguments
='.')
121 test
.write('test1.x', """\
126 expect
= test
.wrap_stdout("""\
127 %(_python_)s mycc.py test1.o test1.c
128 Install file: "test1.x" as "test1_x"
131 test
.run(arguments
='.', stdout
=expect
)
133 test
.must_match('test1.o', """\
141 test
.up_to_date(arguments
='.')
143 test
.write('test1.h', """\
148 expect
= test
.wrap_stdout("""\
149 %(_python_)s mycc.py test1.o test1.c
150 Install file: "test1.h" as "test1_h"
153 test
.run(arguments
='.', stdout
=expect
)
155 test
.must_match('test1.o', """\
163 test
.up_to_date(arguments
='.')
169 # indent-tabs-mode:nil
171 # vim: set expandtab tabstop=4 shiftwidth=4: