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 how we handle SConscript calls when using a Repository.
34 if sys.platform == 'win32':
39 test = TestSCons.TestSCons()
49 ['rep2', 'src', 'sub'])
52 workpath_rep1 = test.workpath('rep1')
53 workpath_rep2 = test.workpath('rep2')
56 test.write(['work', 'SConstruct'], """
58 SConscript('src/SConscript')
61 test.write(['rep1', 'src', 'SConscript'], """\
62 def cat(env, source, target):
63 target = str(target[0])
64 source = map(str, source)
65 f = open(target, "wb")
67 f.write(open(src, "rb").read())
69 env = Environment(BUILDERS={'Cat':Builder(action=cat)})
70 env.Cat(target = 'foo', source = ['aaa.in', 'bbb.in', 'ccc.in'])
73 test.write(['rep1', 'src', 'aaa.in'], "rep1/src/aaa.in\n")
74 test.write(['rep1', 'src', 'bbb.in'], "rep1/src/bbb.in\n")
75 test.write(['rep1', 'src', 'ccc.in'], "rep1/src/ccc.in\n")
77 # Make the rep1 non-writable,
78 # so we'll detect if we try to write into it accidentally.
79 test.writable('rep1', 0)
81 test.run(chdir = 'work', arguments = ".")
83 test.fail_test(test.read(['work', 'src', 'foo']) != """\
89 test.up_to_date(chdir = 'work', arguments = ".")
92 test.write(['rep2', 'build', 'SConstruct'], """
94 SConscript('src/SConscript')
97 test.write(['rep2', 'src', 'SConscript'], """\
98 def cat(env, source, target):
99 target = str(target[0])
100 source = map(str, source)
101 f = open(target, "wb")
103 f.write(open(src, "rb").read())
105 env = Environment(BUILDERS={'Cat':Builder(action=cat)})
106 env.Cat(target = 'foo', source = ['aaa.in', 'bbb.in', 'ccc.in'])
107 SConscript('sub/SConscript')
110 test.write(['rep2', 'src', 'sub', 'SConscript'], """\
113 test.write(['rep2', 'src', 'aaa.in'], "rep2/src/aaa.in\n")
114 test.write(['rep2', 'src', 'bbb.in'], "rep2/src/bbb.in\n")
115 test.write(['rep2', 'src', 'ccc.in'], "rep2/src/ccc.in\n")
117 test.run(chdir = 'rep2/build', arguments = ".")
119 test.fail_test(test.read(['rep2', 'build', 'src', 'foo']) != """\