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__"
31 test
= TestSCons
.TestSCons()
33 test
.subdir('repository', ['repository', 'subdir'], 'work')
35 work_aaa_out
= test
.workpath('work', 'aaa.out')
36 work_bbb_out
= test
.workpath('work', 'bbb.out')
37 work_ccc_out
= test
.workpath('work', 'ccc.out')
38 work_subdir_ddd_out
= test
.workpath('work', 'subdir', 'ddd.out')
39 work_subdir_eee_out
= test
.workpath('work', 'subdir', 'eee.out')
40 work_subdir_fff_out
= test
.workpath('work', 'subdir', 'fff.out')
42 opts
= "-Y " + test
.workpath('repository')
45 test
.write(['repository', 'SConstruct'], r
"""
46 def copy(env, source, target):
47 source = str(source[0])
48 target = str(target[0])
49 print('copy() < %s > %s' % (source, target))
50 with open(target, "w") as ofp, open(source, "r") as ifp:
53 Build = Builder(action=copy)
54 env = Environment(BUILDERS={'Build':Build})
55 env.Build('aaa.out', 'aaa.in')
56 env.Build('bbb.out', 'bbb.in')
57 env.Build('ccc.out', 'ccc.in')
59 SConscript('subdir/SConscript', "env")
62 test
.write(['repository', 'subdir', 'SConscript'], r
"""
65 env.Build('ddd.out', 'ddd.in')
66 env.Build('eee.out', 'eee.in')
67 env.Build('fff.out', 'fff.in')
70 test
.write(['repository', 'aaa.in'], "repository/aaa.in\n")
71 test
.write(['repository', 'bbb.in'], "repository/bbb.in\n")
72 test
.write(['repository', 'ccc.in'], "repository/ccc.in\n")
73 test
.write(['repository', 'subdir', 'ddd.in'], "repository/subdir/ddd.in\n")
74 test
.write(['repository', 'subdir', 'eee.in'], "repository/subdir/eee.in\n")
75 test
.write(['repository', 'subdir', 'fff.in'], "repository/subdir/fff.in\n")
77 # Make the entire repository non-writable, so we'll detect
78 # if we try to write into it accidentally.
79 test
.writable('repository', 0)
81 test
.run(chdir
= 'work', options
= opts
, arguments
= '')
83 test
.fail_test(os
.path
.exists(work_aaa_out
))
84 test
.must_match(work_bbb_out
, "repository/bbb.in\n", mode
='r')
85 test
.fail_test(os
.path
.exists(work_ccc_out
))
86 test
.fail_test(os
.path
.exists(work_subdir_ddd_out
))
87 test
.must_match(work_subdir_eee_out
, "repository/subdir/eee.in\n", mode
='r')
88 test
.fail_test(os
.path
.exists(work_subdir_fff_out
))
91 test
.run(chdir
= 'work', options
= opts
, arguments
= '.')
93 test
.must_match(work_aaa_out
, "repository/aaa.in\n", mode
='r')
94 test
.must_match(work_ccc_out
, "repository/ccc.in\n", mode
='r')
95 test
.must_match(work_subdir_ddd_out
, "repository/subdir/ddd.in\n", mode
='r')
96 test
.must_match(work_subdir_fff_out
, "repository/subdir/fff.in\n", mode
='r')
98 test
.up_to_date(chdir
= 'work', options
= opts
, arguments
= '.')
105 # indent-tabs-mode:nil
107 # vim: set expandtab tabstop=4 shiftwidth=4: