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"""
40 def do_file(outf, inf):
41 for line in open(inf, 'rb').readlines():
42 if line[:10] == '#include <':
43 do_file(outf, line[10:-2])
46 outf = open(sys.argv[1], 'wb')
47 for f in sys.argv[2:]:
52 test.write('SConstruct', """
53 env = Environment(CPPPATH = ['.'],
54 CC = r'%(_python_)s mycc.py',
56 CCCOM = '$CC $TARGET $SOURCES',
58 env.Append(CPPSUFFIXES = ['.x'])
59 env.Object(target = 'test1', source = 'test1.c')
60 env.InstallAs('test1_c', 'test1.c')
61 env.InstallAs('test1_h', 'test1.h')
62 env.InstallAs('test1_x', 'test1.x')
65 test.write('test1.c', """\
71 test.write('test1.h', """\
76 test.write('test1.x', """\
81 test.write('foo.h', "foo.h 1\n")
83 expect = test.wrap_stdout("""\
84 %(_python_)s mycc.py test1.o test1.c
85 Install file: "test1.c" as "test1_c"
86 Install file: "test1.h" as "test1_h"
87 Install file: "test1.x" as "test1_x"
90 test.run(arguments='.', stdout=expect)
92 test.must_match('test1.o', """\
100 test.up_to_date(arguments='.')
102 test.write('foo.h', "foo.h 2\n")
104 expect = test.wrap_stdout("""\
105 %(_python_)s mycc.py test1.o test1.c
108 test.run(arguments='.', stdout=expect)
110 test.must_match('test1.o', """\
118 test.up_to_date(arguments='.')
120 test.write('test1.x', """\
125 expect = test.wrap_stdout("""\
126 %(_python_)s mycc.py test1.o test1.c
127 Install file: "test1.x" as "test1_x"
130 test.run(arguments='.', stdout=expect)
132 test.must_match('test1.o', """\
140 test.up_to_date(arguments='.')
142 test.write('test1.h', """\
147 expect = test.wrap_stdout("""\
148 %(_python_)s mycc.py test1.o test1.c
149 Install file: "test1.h" as "test1_h"
152 test.run(arguments='.', stdout=expect)
154 test.must_match('test1.o', """\
162 test.up_to_date(arguments='.')