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__"
30 test = TestSCons.TestSCons()
32 test.subdir('work', 'repository', ['repository', 'src'])
34 work_aaa = test.workpath('work', 'aaa')
35 work_bbb = test.workpath('work', 'bbb')
36 work_ccc = test.workpath('work', 'ccc')
37 work_src_xxx = test.workpath('work', 'src', 'xxx')
38 work_src_yyy = test.workpath('work', 'src', 'yyy')
40 opts = "-Y " + test.workpath('repository')
42 test.write(['repository', 'SConstruct'], """
43 def cat(env, source, target):
44 target = str(target[0])
45 source = map(str, source)
46 print 'cat(%s) > %s' % (source, target)
47 f = open(target, "wb")
49 f.write(open(src, "rb").read())
52 env = Environment(BUILDERS={'Build':Builder(action=cat)})
53 env.Build('aaa.out', 'aaa.in')
54 env.Build('bbb.out', 'bbb.in')
55 env.Build('ccc.out', 'ccc.in')
56 SConscript('src/SConscript', "env")
59 test.write(['repository', 'aaa.in'], "repository/aaa.in\n")
60 test.write(['repository', 'bbb.in'], "repository/bbb.in\n")
61 test.write(['repository', 'ccc.in'], "repository/ccc.in\n")
63 test.write(['repository', 'src', 'SConscript'], """
65 env.Build('xxx.out', 'xxx.in')
66 env.Build('yyy.out', 'yyy.in')
69 test.write(['repository', 'src', 'xxx.in'], "repository/src/xxx.in\n")
70 test.write(['repository', 'src', 'yyy.in'], "repository/src/yyy.in\n")
73 # Make the repository non-writable,
74 # so we'll detect if we try to write into it accidentally.
75 test.writable('repository', 0)
78 test.run(chdir = 'work', options = opts, arguments = 'aaa.out')
80 test.fail_test(test.read(['work', 'aaa.out']) != "repository/aaa.in\n")
81 test.fail_test(os.path.exists(test.workpath('work', 'bbb.out')))
82 test.fail_test(os.path.exists(test.workpath('work', 'ccc.out')))
83 test.fail_test(os.path.exists(test.workpath('work', 'src', 'xxx.out')))
84 test.fail_test(os.path.exists(test.workpath('work', 'src', 'yyy.out')))
86 test.run(chdir = 'work', options = opts, arguments = 'bbb.out src')
88 test.fail_test(test.read(['work', 'bbb.out']) != "repository/bbb.in\n")
89 test.fail_test(os.path.exists(test.workpath('work', 'ccc.out')))
90 test.fail_test(test.read(['work', 'src', 'xxx.out']) != "repository/src/xxx.in\n")
91 test.fail_test(test.read(['work', 'src', 'yyy.out']) != "repository/src/yyy.in\n")
94 test.run(chdir = 'work', options = opts, arguments = '.')
96 test.fail_test(test.read(['work', 'ccc.out']) != "repository/ccc.in\n")
103 # indent-tabs-mode:nil
105 # vim: set expandtab tabstop=4 shiftwidth=4: