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__"
28 Test transparent RCS checkouts from an RCS subdirectory.
35 test = TestSCons.TestSCons()
37 rcs = test.where_is('rcs')
39 test.skip_test("Could not find 'rcs'; skipping test(s).\n")
41 ci = test.where_is('ci')
43 test.skip_test("Could not find 'ci'; skipping test(s).\n")
47 sub_RCS = os.path.join('sub', 'RCS')
48 sub_SConscript = os.path.join('sub', 'SConscript')
49 sub_all = os.path.join('sub', 'all')
50 sub_ddd_in = os.path.join('sub', 'ddd.in')
51 sub_ddd_out = os.path.join('sub', 'ddd.out')
52 sub_eee_in = os.path.join('sub', 'eee.in')
53 sub_eee_out = os.path.join('sub', 'eee.out')
54 sub_fff_in = os.path.join('sub', 'fff.in')
55 sub_fff_out = os.path.join('sub', 'fff.out')
57 test.subdir('RCS', 'sub', ['sub', 'RCS'])
59 for f in ['aaa.in', 'bbb.in', 'ccc.in']:
60 test.write(f, "%s\n" % f)
61 args = "-f -t%s %s" % (f, f)
62 test.run(program = ci, arguments = args, stderr = None)
64 for f in ['ddd.in', 'eee.in', 'fff.in']:
65 test.write(['sub', f], "sub/%s\n" % f)
66 args = "-f -tsub/%s sub/%s" % (f, f)
67 test.run(program = ci, arguments = args, stderr = None)
69 test.write(['sub', 'SConscript'], """\
71 env.Cat('ddd.out', 'ddd.in')
72 env.Cat('eee.out', 'eee.in')
73 env.Cat('fff.out', 'fff.in')
74 env.Cat('all', ['ddd.out', 'eee.out', 'fff.out'])
76 args = "-f -tsub/SConscript sub/SConscript"
77 test.run(program = ci, arguments = args, stderr = None)
79 test.no_result(os.path.exists(test.workpath('aaa.in')))
80 test.no_result(os.path.exists(test.workpath('bbb.in')))
81 test.no_result(os.path.exists(test.workpath('ccc.in')))
83 test.no_result(os.path.exists(test.workpath('sub', 'SConscript')))
85 test.no_result(os.path.exists(test.workpath('sub', 'aaa.in')))
86 test.no_result(os.path.exists(test.workpath('sub', 'bbb.in')))
87 test.no_result(os.path.exists(test.workpath('sub', 'ccc.in')))
89 test.write('SConstruct', """
91 for key in ['LOGNAME', 'USERNAME', 'USER']:
92 logname = os.environ.get(key)
94 ENV = {'PATH' : os.environ['PATH'],
96 def cat(env, source, target):
97 target = str(target[0])
98 f = open(target, "wb")
100 f.write(open(str(src), "rb").read())
102 SetOption('diskcheck', None)
103 DefaultEnvironment()['ENV'] = ENV
104 DefaultEnvironment()['RCS_COFLAGS'] = '-l'
105 env = Environment(ENV=ENV, BUILDERS={'Cat':Builder(action=cat)})
106 env.Cat('aaa.out', 'aaa.in')
107 env.Cat('bbb.out', 'bbb.in')
108 env.Cat('ccc.out', 'ccc.in')
109 env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out'])
110 SConscript('sub/SConscript', "env")
113 test.write('bbb.in', "checked-out bbb.in\n")
115 test.write(['sub', 'eee.in'], "checked-out sub/eee.in\n")
117 sub_SConscript = os.path.join('sub', 'SConscript')
118 SConstruct_file_line = test.python_file_line(test.workpath('SConstruct'), 22)[:-1]
122 scons: warning: Ignoring missing SConscript '%(sub_SConscript)s'
123 %(SConstruct_file_line)s
124 scons: *** [aaa.out] Source `aaa.in' not found, needed by target `aaa.out'.
127 test.run(status=2, stderr=expect)
129 test.run(arguments = '--diskcheck=match,sccs', status=2, stderr=expect)
131 test.run(arguments = '--diskcheck=rcs',
132 stdout = test.wrap_stdout(read_str = """\
133 co -l %(sub_SConscript)s
137 cat(["aaa.out"], ["aaa.in"])
138 cat(["bbb.out"], ["bbb.in"])
140 cat(["ccc.out"], ["ccc.in"])
141 cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
143 cat(["%(sub_ddd_out)s"], ["%(sub_ddd_in)s"])
144 cat(["%(sub_eee_out)s"], ["%(sub_eee_in)s"])
146 cat(["%(sub_fff_out)s"], ["%(sub_fff_in)s"])
147 cat(["%(sub_all)s"], ["%(sub_ddd_out)s", "%(sub_eee_out)s", "%(sub_fff_out)s"])
150 %(sub_RCS)s/SConscript,v --> %(sub_SConscript)s
151 revision 1.1 (locked)
153 RCS/aaa.in,v --> aaa.in
154 revision 1.1 (locked)
156 RCS/ccc.in,v --> ccc.in
157 revision 1.1 (locked)
159 %(sub_RCS)s/ddd.in,v --> %(sub_ddd_in)s
160 revision 1.1 (locked)
162 %(sub_RCS)s/fff.in,v --> %(sub_fff_in)s
163 revision 1.1 (locked)
167 # Checking things back out of RCS apparently messes with the line
168 # endings, so read the result files in non-binary mode.
170 test.must_match('all',
171 "aaa.in\nchecked-out bbb.in\nccc.in\n",
174 test.must_match(['sub', 'all'],
175 "sub/ddd.in\nchecked-out sub/eee.in\nsub/fff.in\n",
178 test.must_be_writable(test.workpath('sub', 'SConscript'))
179 test.must_be_writable(test.workpath('aaa.in'))
180 test.must_be_writable(test.workpath('ccc.in'))
181 test.must_be_writable(test.workpath('sub', 'ddd.in'))
182 test.must_be_writable(test.workpath('sub', 'fff.in'))
191 # indent-tabs-mode:nil
193 # vim: set expandtab tabstop=4 shiftwidth=4: