[ci skip] update generated files
[scons.git] / test / Repository / Install-Local.py
blobfe64feb634903c84e7819b55bde36668904be08e
1 #!/usr/bin/env python
3 # __COPYRIGHT__
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__"
27 import os.path
28 import TestSCons
30 test = TestSCons.TestSCons()
32 test.subdir('repository', 'work', ['work', 'install'])
34 repository_install_file1 = test.workpath('repository', 'install', 'file1')
35 repository_install_file2 = test.workpath('repository', 'install', 'file2')
36 work_install_file1 = test.workpath('work', 'install', 'file1')
37 work_install_file2 = test.workpath('work', 'install', 'file2')
39 opts = "-Y " + test.workpath('repository')
42 test.write(['repository', 'SConstruct'], r"""
43 env = Environment()
44 env.Install('install', 'file1')
45 Local(r'%s')
46 Local(env.Install('install', 'file2'))
47 """ % os.path.join('install', 'file1'))
49 test.write(['repository', 'file1'], "repository/file1\n")
50 test.write(['repository', 'file2'], "repository/file2\n")
52 test.run(chdir = 'repository', options = opts, arguments = 'install')
54 test.must_match(repository_install_file1, "repository/file1\n", mode='r')
55 test.must_match(repository_install_file2, "repository/file2\n", mode='r')
57 test.up_to_date(chdir = 'repository', options = opts, arguments = 'install')
59 # Make the entire repository non-writable, so we'll detect
60 # if we try to write into it accidentally.
61 test.writable('repository', 0)
63 test.run(chdir = 'work', options = opts, arguments = 'install')
65 test.must_match(work_install_file1, "repository/file1\n", mode='r')
66 test.must_match(work_install_file2, "repository/file2\n", mode='r')
68 test.up_to_date(chdir = 'work', options = opts, arguments = 'install')
71 test.write(['work', 'file1'], "work/file1\n")
72 test.write(['work', 'file2'], "work/file2\n")
74 test.run(chdir = 'work', options = opts, arguments = 'install')
76 test.must_match(work_install_file1, "work/file1\n", mode='r')
77 test.must_match(work_install_file2, "work/file2\n", mode='r')
79 test.up_to_date(chdir = 'work', options = opts, arguments = 'install')
82 test.pass_test()
84 # Local Variables:
85 # tab-width:4
86 # indent-tabs-mode:nil
87 # End:
88 # vim: set expandtab tabstop=4 shiftwidth=4: