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 $DSUFFIXES.
33 python = TestSCons.python
35 test = TestSCons.TestSCons()
37 test.write('mydc.py', r"""
40 def do_file(outf, inf):
41 for line in open(inf, 'rb').readlines():
42 if line[:7] == 'import ':
43 do_file(outf, line[7:-2]+'.d')
46 outf = open(sys.argv[1], 'wb')
47 for f in sys.argv[2:]:
52 test.write('SConstruct', """
53 env = Environment(DPATH = ['.'],
56 DCOM = '$DC $TARGET $SOURCES',
58 env.Append(CPPSUFFIXES = ['.x'])
59 env.Object(target = 'test1', source = 'test1.d')
60 env.InstallAs('test1_d', 'test1.d')
61 env.InstallAs('test2_d', 'test2.d')
62 env.InstallAs('test3_d', 'test3.d')
65 test.write('test1.d', """\
71 test.write('test2.d', """\
76 test.write('test3.d', """\
81 test.write('foo.d', "foo.d 1\n")
83 test.run(arguments='.', stdout=test.wrap_stdout("""\
84 %s mydc.py test1.o test1.d
85 Install file: "test1.d" as "test1_d"
86 Install file: "test2.d" as "test2_d"
87 Install file: "test3.d" as "test3_d"
90 test.must_match('test1.o', """\
98 test.up_to_date(arguments='.')
100 test.write('foo.d', "foo.d 2\n")
102 test.run(arguments='.', stdout=test.wrap_stdout("""\
103 %s mydc.py test1.o test1.d
106 test.must_match('test1.o', """\
114 test.up_to_date(arguments='.')
116 test.write('test3.d', """\
121 test.run(arguments='.', stdout=test.wrap_stdout("""\
122 %s mydc.py test1.o test1.d
123 Install file: "test3.d" as "test3_d"
126 test.must_match('test1.o', """\
134 test.up_to_date(arguments='.')
136 test.write('test2.d', """\
141 test.run(arguments='.', stdout=test.wrap_stdout("""\
142 %s mydc.py test1.o test1.d
143 Install file: "test2.d" as "test2_d"
146 test.must_match('test1.o', """\
154 test.up_to_date(arguments='.')