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 source = map(str, source)
99 f = open(target, "wb")
101 f.write(open(src, "rb").read())
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 test.run(arguments = '.',
118 stdout = test.wrap_stdout(read_str = """\
119 co -l %(sub_SConscript)s
123 cat(["aaa.out"], ["aaa.in"])
124 cat(["bbb.out"], ["bbb.in"])
126 cat(["ccc.out"], ["ccc.in"])
127 cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
129 cat(["%(sub_ddd_out)s"], ["%(sub_ddd_in)s"])
130 cat(["%(sub_eee_out)s"], ["%(sub_eee_in)s"])
132 cat(["%(sub_fff_out)s"], ["%(sub_fff_in)s"])
133 cat(["%(sub_all)s"], ["%(sub_ddd_out)s", "%(sub_eee_out)s", "%(sub_fff_out)s"])
136 %(sub_RCS)s/SConscript,v --> %(sub_SConscript)s
137 revision 1.1 (locked)
139 RCS/aaa.in,v --> aaa.in
140 revision 1.1 (locked)
142 RCS/ccc.in,v --> ccc.in
143 revision 1.1 (locked)
145 %(sub_RCS)s/ddd.in,v --> %(sub_ddd_in)s
146 revision 1.1 (locked)
148 %(sub_RCS)s/fff.in,v --> %(sub_fff_in)s
149 revision 1.1 (locked)
153 # Checking things back out of RCS apparently messes with the line
154 # endings, so read the result files in non-binary mode.
156 test.must_match('all',
157 "aaa.in\nchecked-out bbb.in\nccc.in\n",
160 test.must_match(['sub', 'all'],
161 "sub/ddd.in\nchecked-out sub/eee.in\nsub/fff.in\n",
164 test.must_be_writable(test.workpath('sub', 'SConscript'))
165 test.must_be_writable(test.workpath('aaa.in'))
166 test.must_be_writable(test.workpath('ccc.in'))
167 test.must_be_writable(test.workpath('sub', 'ddd.in'))
168 test.must_be_writable(test.workpath('sub', 'fff.in'))
177 # indent-tabs-mode:nil
179 # vim: set expandtab tabstop=4 shiftwidth=4: