5 # Copyright The SCons Foundation
7 # Permission is hereby granted, free of charge, to any person obtaining
8 # a copy of this software and associated documentation files (the
9 # "Software"), to deal in the Software without restriction, including
10 # without limitation the rights to use, copy, modify, merge, publish,
11 # distribute, sublicense, and/or sell copies of the Software, and to
12 # permit persons to whom the Software is furnished to do so, subject to
13 # the following conditions:
15 # The above copyright notice and this permission notice shall be included
16 # in all copies or substantial portions of the Software.
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
19 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 _python_
= TestSCons
._python
_
30 test
= TestSCons
.TestSCons()
32 test
.subdir('sub1', 'sub2')
34 test
.write('build.py', r
"""
36 with open(sys.argv[1], 'wb') as ofp, open(sys.argv[2], 'rb') as ifp:
40 test
.write('SConstruct', """
41 DefaultEnvironment(tools=[])
43 B = Builder(action=r'%(_python_)s build.py $TARGET $SOURCES')
44 env = Environment(tools=[])
45 env['BUILDERS']['B'] = B
46 env.B(target = 'sub1/foo.out', source = 'sub1/foo.in')
48 SConscript('sub1/SConscript')
49 SConscript('sub2/SConscript')
52 test
.write(['sub1', 'SConscript'], """
54 env.B(target = 'foo.out', source = 'foo.in')
58 test
.write(['sub1', 'foo.in'], "sub1/foo.in")
60 test
.write(['sub2', 'SConscript'], """
62 env.Alias('bar', env.B(target = 'bar.out', source = 'bar.in'))
67 test
.write(['sub2', 'bar.in'], "sub2/bar.in")
69 test
.run(arguments
= '-D', chdir
= 'sub1')
71 test
.must_match(['sub1', 'foo.out'], "sub1/foo.in")
72 test
.must_match(['sub2', 'bar.out'], "sub2/bar.in")
74 test
.unlink(['sub1', 'foo.out'])
75 test
.unlink(['sub2', 'bar.out'])
77 test
.run(arguments
= '-D bar', chdir
= 'sub1')
79 test
.must_not_exist(test
.workpath('sub1', 'foo.out'))
80 test
.must_exist(test
.workpath('sub2', 'bar.out'))
87 # indent-tabs-mode:nil
89 # vim: set expandtab tabstop=4 shiftwidth=4: