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 checkouts from SCCS files in an SCCS subdirectory.
36 test = TestSCons.TestSCons()
38 sccs = test.where_is('sccs')
40 test.skip_test("Could not find 'sccs'; skipping test(s).\n")
44 test.subdir('SCCS', 'sub', ['sub', 'SCCS'])
46 for f in ['aaa.in', 'bbb.in', 'ccc.in']:
47 test.write(f, "%%F%% %s\n" % f)
48 args = "create %s" % f
49 test.run(program = sccs, arguments = args, stderr = None)
53 test.write(['sub', 'SConscript'], """\
56 env.Cat('ddd.out', 'ddd.in')
57 env.Cat('eee.out', 'eee.in')
58 env.Cat('fff.out', 'fff.in')
59 env.Cat('all', ['ddd.out', 'eee.out', 'fff.out'])
61 args = "create SConscript"
62 test.run(chdir = 'sub', program = sccs, arguments = args, stderr = None)
63 test.unlink(['sub', 'SConscript'])
64 test.unlink(['sub', ',SConscript'])
66 for f in ['ddd.in', 'eee.in', 'fff.in']:
67 test.write(['sub', f], "%%F%% sub/%s\n" % f)
68 args = "create %s" % f
69 test.run(chdir = 'sub', program = sccs, arguments = args, stderr = None)
70 test.unlink(['sub', f])
71 test.unlink(['sub', ','+f])
73 test.write(['SConstruct'], """
74 DefaultEnvironment()['SCCSCOM'] = 'cd ${TARGET.dir} && $SCCS get ${TARGET.file}'
75 def cat(env, source, target):
76 target = str(target[0])
77 source = map(str, source)
78 f = open(target, "wb")
80 f.write(open(src, "rb").read())
82 SetOption('diskcheck', ['match', 'rcs'])
83 env = Environment(BUILDERS={'Cat':Builder(action=cat)},
85 env.Cat('aaa.out', 'aaa.in')
86 env.Cat('bbb.out', 'bbb.in')
87 env.Cat('ccc.out', 'ccc.in')
88 env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out'])
89 SConscript('sub/SConscript', "env")
92 test.write(['bbb.in'], "checked-out bbb.in\n")
94 test.write(['sub', 'eee.in'], "checked-out sub/eee.in\n")
96 sub_SConscript = os.path.join('sub', 'SConscript')
97 SConstruct_file_line = test.python_file_line(test.workpath('SConstruct'), 17)[:-1]
101 scons: warning: Ignoring missing SConscript '%(sub_SConscript)s'
102 %(SConstruct_file_line)s
103 scons: *** [aaa.out] Source `aaa.in' not found, needed by target `aaa.out'.
106 test.run(status=2, stderr=expect)
108 test.run(arguments = '--diskcheck=sccs', stderr = None)
110 lines = string.split("""
113 cat(["aaa.out"], ["aaa.in"])
114 cat(["bbb.out"], ["bbb.in"])
116 cat(["ccc.out"], ["ccc.in"])
117 cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
119 cat(["sub/ddd.out"], ["sub/ddd.in"])
120 cat(["sub/eee.out"], ["sub/eee.in"])
122 cat(["sub/fff.out"], ["sub/fff.in"])
123 cat(["sub/all"], ["sub/ddd.out", "sub/eee.out", "sub/fff.out"])
126 test.must_contain_all_lines(test.stdout(), lines)
128 test.must_match('all', """\
134 test.must_not_be_writable(test.workpath('sub', 'SConscript'))
135 test.must_not_be_writable(test.workpath('aaa.in'))
136 test.must_not_be_writable(test.workpath('ccc.in'))
137 test.must_not_be_writable(test.workpath('sub', 'ddd.in'))
138 test.must_not_be_writable(test.workpath('sub', 'fff.in'))
146 # indent-tabs-mode:nil
148 # vim: set expandtab tabstop=4 shiftwidth=4: