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 if sys.platform == 'win32':
40 test = TestSCons.TestSCons()
43 test.subdir('repository', 'work1', 'work2', 'work3')
46 workpath_repository = test.workpath('repository')
47 repository_aaa_obj = test.workpath('repository', 'aaa' + _obj)
48 repository_bbb_obj = test.workpath('repository', 'bbb' + _obj)
49 repository_foo_obj = test.workpath('repository', 'foo' + _obj)
50 repository_foo = test.workpath('repository', 'foo' + _exe)
51 work1_foo = test.workpath('work1', 'foo' + _exe)
52 work2_aaa_obj = test.workpath('work2', 'aaa' + _obj)
53 work2_foo_obj = test.workpath('work2', 'foo' + _obj)
54 work2_foo = test.workpath('work2', 'foo' + _exe)
55 work3_aaa_obj = test.workpath('work3', 'aaa' + _obj)
56 work3_bbb_obj = test.workpath('work3', 'bbb' + _obj)
57 work3_foo = test.workpath('work3', 'foo' + _exe)
59 opts = '-Y ' + workpath_repository
62 test.write(['repository', 'SConstruct'], """
63 env = Environment(LIBS = ['xxx'], LIBPATH = '.')
64 env.Library(target = 'xxx', source = ['aaa.c', 'bbb.c'])
65 env.Program(target = 'foo', source = 'foo.c')
68 test.write(['repository', 'aaa.c'], r"""
74 printf("repository/aaa.c\n");
78 test.write(['repository', 'bbb.c'], r"""
84 printf("repository/bbb.c\n");
88 test.write(['repository', 'foo.c'], r"""
91 extern void aaa(void);
92 extern void bbb(void);
94 main(int argc, char *argv[])
99 printf("repository/foo.c\n");
104 # Make the repository non-writable,
105 # so we'll detect if we try to write into it accidentally.
106 test.writable('repository', 0)
109 test.run(chdir = 'work1', options = opts, arguments = ".",
110 stderr=TestSCons.noisy_ar,
111 match=TestSCons.match_re_dotall)
113 test.run(program = work1_foo, stdout =
119 test.fail_test(os.path.exists(repository_aaa_obj))
120 test.fail_test(os.path.exists(repository_bbb_obj))
121 test.fail_test(os.path.exists(repository_foo_obj))
122 test.fail_test(os.path.exists(repository_foo))
124 test.up_to_date(chdir = 'work1', options = opts, arguments = ".")
126 test.write(['work1', 'bbb.c'], r"""
132 printf("work1/bbb.c\n");
136 test.run(chdir = 'work1', options = opts, arguments = ".",
137 stderr=TestSCons.noisy_ar,
138 match=TestSCons.match_re_dotall)
140 test.run(program = work1_foo, stdout =
146 test.fail_test(os.path.exists(repository_aaa_obj))
147 test.fail_test(os.path.exists(repository_bbb_obj))
148 test.fail_test(os.path.exists(repository_foo_obj))
149 test.fail_test(os.path.exists(repository_foo))
151 test.up_to_date(chdir = 'work1', options = opts, arguments = ".")
154 test.writable('repository', 1)
156 test.run(chdir = 'repository', options = opts, arguments = ".",
157 stderr=TestSCons.noisy_ar,
158 match=TestSCons.match_re_dotall)
160 test.run(program = repository_foo, stdout =
166 test.fail_test(not os.path.exists(repository_aaa_obj))
167 test.fail_test(not os.path.exists(repository_bbb_obj))
168 test.fail_test(not os.path.exists(repository_foo_obj))
170 test.up_to_date(chdir = 'repository', options = opts, arguments = ".")
173 test.writable('repository', 0)
176 test.up_to_date(chdir = 'work2', options = opts, arguments = ".")
178 test.write(['work2', 'bbb.c'], r"""
184 printf("work2/bbb.c\n");
188 test.run(chdir = 'work2', options = opts, arguments = ".",
189 stderr=TestSCons.noisy_ar,
190 match=TestSCons.match_re_dotall)
192 test.run(program = work2_foo, stdout =
198 test.fail_test(os.path.exists(work2_aaa_obj))
199 test.fail_test(os.path.exists(work2_foo_obj))
201 test.up_to_date(chdir = 'work2', options = opts, arguments = ".")
204 test.up_to_date(chdir = 'work3', options = opts, arguments = ".")
206 test.write(['work3', 'foo.c'], r"""
209 extern void aaa(void);
210 extern void bbb(void);
212 main(int argc, char *argv[])
217 printf("work3/foo.c\n");
222 test.run(chdir = 'work3', options = opts, arguments = ".")
224 test.run(program = work3_foo, stdout =
230 test.fail_test(os.path.exists(work3_aaa_obj))
231 test.fail_test(os.path.exists(work3_bbb_obj))
233 test.up_to_date(chdir = 'work3', options = opts, arguments = ".")