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 if sys.platform == 'win32':
37 test = TestSCons.TestSCons()
39 test.subdir('repository', 'work1')
41 repository = test.workpath('repository')
42 repository_foo_c = test.workpath('repository', 'foo.c')
43 work1_foo = test.workpath('work1', 'foo' + _exe)
44 work1_foo_c = test.workpath('work1', 'foo.c')
46 test.write(['repository', 'SConstruct'], r"""
48 env.Program(target= 'foo', source = Split('aaa.c bbb.c foo.c'))
51 test.write(['repository', 'aaa.c'], r"""
56 printf("repository/aaa.c\n");
60 test.write(['repository', 'bbb.c'], r"""
65 printf("repository/bbb.c\n");
69 test.write(['repository', 'foo.c'], r"""
72 extern void aaa(void);
73 extern void bbb(void);
75 main(int argc, char *argv[])
80 printf("repository/foo.c\n");
85 opts = '-Y ' + repository
87 # Make the entire repository non-writable, so we'll detect
88 # if we try to write into it accidentally.
89 test.writable('repository', 0)
91 test.run(chdir = 'work1', options = opts, arguments = '.')
93 test.run(program = work1_foo, stdout = """repository/aaa.c
98 test.up_to_date(chdir = 'work1', options = opts, arguments = '.')
101 test.write(['work1', 'bbb.c'], r"""
107 printf("work1/bbb.c\n");
111 test.run(chdir = 'work1', options = opts, arguments = '.')
113 test.run(program = work1_foo, stdout = """repository/aaa.c
118 test.up_to_date(chdir = 'work1', options = opts, arguments = '.')
121 test.write(['work1', 'aaa.c'], r"""
127 printf("work1/aaa.c\n");
131 test.write(['work1', 'foo.c'], r"""
134 extern void aaa(void);
135 extern void bbb(void);
137 main(int argc, char *argv[])
142 printf("work1/foo.c\n");
147 test.run(chdir = 'work1', options = opts, arguments = '.')
149 test.run(program = work1_foo, stdout = """work1/aaa.c
154 test.up_to_date(chdir = 'work1', options = opts, arguments = '.')
157 test.unlink(['work1', 'bbb.c'])
158 test.unlink(['work1', 'foo.c'])
160 test.run(chdir = 'work1', options = opts, arguments = '.')
162 test.run(program = work1_foo, stdout = """work1/aaa.c
167 test.up_to_date(chdir = 'work1', options = opts, arguments = '.')
172 test.subdir('r.NEW', 'r.OLD', 'work2')
174 workpath_r_NEW = test.workpath('r.NEW')
175 workpath_r_OLD = test.workpath('r.OLD')
176 work2_foo = test.workpath('work2', 'foo' + _exe)
180 env.Program(target = 'foo', source = 'foo.c')
183 test.write(['r.OLD', 'SConstruct'], SConstruct)
185 test.write(['r.NEW', 'SConstruct'], SConstruct)
187 test.write(['r.OLD', 'foo.c'], r"""
191 main(int argc, char *argv[])
194 printf("r.OLD/foo.c\n");
199 opts = '-Y %s -Y %s' % (workpath_r_NEW, workpath_r_OLD)
201 # Make the repositories non-writable, so we'll detect
202 # if we try to write into them accidentally.
203 test.writable('r.OLD', 0)
204 test.writable('r.NEW', 0)
206 test.run(chdir = 'work2', options = opts, arguments = '.')
208 test.run(program = work2_foo, stdout = "r.OLD/foo.c\n")
210 test.up_to_date(chdir = 'work2', options = opts, arguments = '.')
213 test.writable('r.NEW', 1)
215 test.write(['r.NEW', 'foo.c'], r"""
219 main(int argc, char *argv[])
222 printf("r.NEW/foo.c\n");
227 test.writable('r.NEW', 0)
229 test.run(chdir = 'work2', options = opts, arguments = '.')
231 test.run(program = work2_foo, stdout = "r.NEW/foo.c\n")
233 test.up_to_date(chdir = 'work2', options = opts, arguments = '.')
236 test.write(['work2', 'foo.c'], r"""
240 main(int argc, char *argv[])
243 printf("work2/foo.c\n");
248 test.run(chdir = 'work2', options = opts, arguments = '.')
250 test.run(program = work2_foo, stdout = "work2/foo.c\n")
252 test.up_to_date(chdir = 'work2', options = opts, arguments = '.')
255 test.writable('r.OLD', 1)
256 test.writable('r.NEW', 1)
258 test.write(['r.OLD', 'foo.c'], r"""
262 main(int argc, char *argv[])
265 printf("r.OLD/foo.c 2\n");
270 test.write(['r.NEW', 'foo.c'], r"""
274 main(int argc, char *argv[])
277 printf("r.NEW/foo.c 2\n");
282 test.writable('r.OLD', 0)
283 test.writable('r.NEW', 0)
285 test.up_to_date(chdir = 'work2', options = opts, arguments = '.')
288 test.unlink(['work2', 'foo.c'])
290 test.run(chdir = 'work2', options = opts, arguments = '.')
292 test.run(program = work2_foo, stdout = "r.NEW/foo.c 2\n")
294 test.up_to_date(chdir = 'work2', options = opts, arguments = '.')
297 test.writable('r.NEW', 1)
299 test.unlink(['r.NEW', 'foo.c'])
301 test.writable('r.NEW', 0)
303 test.run(chdir = 'work2', options = opts, arguments = '.')
305 test.run(program = work2_foo, stdout = "r.OLD/foo.c 2\n")
307 test.up_to_date(chdir = 'work2', options = opts, arguments = '.')
316 # indent-tabs-mode:nil
318 # vim: set expandtab tabstop=4 shiftwidth=4: