Test explicit checkouts from local SCCS files.
"""
+import string
+
import TestSCons
test = TestSCons.TestSCons()
-test.subdir('sub')
+test.subdir('SCCS', 'sub', ['sub', 'SCCS'])
for f in ['aaa.in', 'bbb.in', 'ccc.in']:
- test.write(f, "%s\n" % f)
+ test.write(f, "%%F%% %s\n" % f)
args = "create %s" % f
test.run(program = sccs, arguments = args, stderr = None)
test.unlink(f)
test.unlink(['sub', ',SConscript'])
for f in ['ddd.in', 'eee.in', 'fff.in']:
- test.write(['sub', f], "sub/%s\n" % f)
+ test.write(['sub', f], "%%F%% sub/%s\n" % f)
args = "create %s" % f
test.run(chdir = 'sub', program = sccs, arguments = args, stderr = None)
test.unlink(['sub', f])
f.write(open(src, "rb").read())
f.close()
env = Environment(BUILDERS={'Cat':Builder(action=cat)},
+ SCCSCOM = 'cd ${TARGET.dir} && $SCCS get $SCCSGETFLAGS ${TARGET.file}',
SCCSGETFLAGS='-e')
env.Cat('aaa.out', 'aaa.in')
env.Cat('bbb.out', 'bbb.in')
test.write(['sub', 'eee.in'], "checked-out sub/eee.in\n")
-test.run(arguments = '.',
- stdout = test.wrap_stdout(read_str = """\
-sccs get -e sub/SConscript
-""",
- build_str = """\
+test.run(arguments = '.', stderr = None)
+
+lines = string.split("""
+sccs get -e SConscript
sccs get -e aaa.in
cat(["aaa.out"], ["aaa.in"])
cat(["bbb.out"], ["bbb.in"])
sccs get -e ccc.in
cat(["ccc.out"], ["ccc.in"])
cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
-sccs get -e sub/ddd.in
+sccs get -e ddd.in
cat(["sub/ddd.out"], ["sub/ddd.in"])
cat(["sub/eee.out"], ["sub/eee.in"])
-sccs get -e sub/fff.in
+sccs get -e fff.in
cat(["sub/fff.out"], ["sub/fff.in"])
cat(["sub/all"], ["sub/ddd.out", "sub/eee.out", "sub/fff.out"])
-"""),
- stderr = """\
-sub/SConscript 1.1 -> 1.2: 5 lines
-aaa.in 1.1 -> 1.2: 1 lines
-ccc.in 1.1 -> 1.2: 1 lines
-sub/ddd.in 1.1 -> 1.2: 1 lines
-sub/fff.in 1.1 -> 1.2: 1 lines
+""", '\n')
+
+stdout = test.stdout()
+missing = filter(lambda l, s=stdout: string.find(s, l) == -1, lines)
+if missing:
+ print "Missing the following output lines:"
+ print string.join(missing, '\n')
+ print "Actual STDOUT =========="
+ print stdout
+ test.fail_test(1)
+
+test.must_match('all', """\
+%F% aaa.in
+checked-out bbb.in
+%F% ccc.in
""")
-test.must_match('all', "aaa.in\nchecked-out bbb.in\nccc.in\n")
-
test.must_be_writable(test.workpath('sub', 'SConscript'))
test.must_be_writable(test.workpath('aaa.in'))
test.must_be_writable(test.workpath('ccc.in'))
Test transparent SCCS checkouts of implicit dependencies.
"""
+import string
+
import TestSCons
test = TestSCons.TestSCons()
test.subdir('SCCS')
test.write('foo.c', """\
+/* %%F%% */
#include "foo.h"
int
main(int argc, char *argv[]) {
test.unlink(',foo.h')
test.write('SConstruct', """
+DefaultEnvironment()['SCCSCOM'] = 'cd ${TARGET.dir} && $SCCS get ${TARGET.file}'
env = Environment()
env.Program('foo.c')
""")
-test.run(stderr = """\
-foo.c 1.1: 6 lines
-foo.h 1.1: 1 lines
-""")
+test.run(stderr = None)
+
+lines = string.split("""
+sccs get foo.c
+sccs get foo.h
+""", '\n')
+
+stdout = test.stdout()
+missing = filter(lambda l, s=stdout: string.find(s, l) == -1, lines)
+if missing:
+ print "Missing the following output lines:"
+ print string.join(missing, '\n')
+ print "Actual STDOUT =========="
+ print stdout
+ test.fail_test(1)
Test transparent checkouts from SCCS files in an SCCS subdirectory.
"""
+import string
+
import TestSCons
test = TestSCons.TestSCons()
test.subdir('SCCS', 'sub', ['sub', 'SCCS'])
for f in ['aaa.in', 'bbb.in', 'ccc.in']:
- test.write(f, "%s\n" % f)
+ test.write(f, "%%F%% %s\n" % f)
args = "create %s" % f
test.run(program = sccs, arguments = args, stderr = None)
test.unlink(f)
test.unlink(','+f)
test.write(['sub', 'SConscript'], """\
+# %%F%%
Import("env")
env.Cat('ddd.out', 'ddd.in')
env.Cat('eee.out', 'eee.in')
test.unlink(['sub', ',SConscript'])
for f in ['ddd.in', 'eee.in', 'fff.in']:
- test.write(['sub', f], "sub/%s\n" % f)
+ test.write(['sub', f], "%%F%% sub/%s\n" % f)
args = "create %s" % f
test.run(chdir = 'sub', program = sccs, arguments = args, stderr = None)
test.unlink(['sub', f])
test.unlink(['sub', ','+f])
test.write(['SConstruct'], """
+DefaultEnvironment()['SCCSCOM'] = 'cd ${TARGET.dir} && $SCCS get ${TARGET.file}'
def cat(env, source, target):
target = str(target[0])
source = map(str, source)
for src in source:
f.write(open(src, "rb").read())
f.close()
-env = Environment(BUILDERS={'Cat':Builder(action=cat)})
+env = Environment(BUILDERS={'Cat':Builder(action=cat)},
+ SCCSFLAGS='-k')
env.Cat('aaa.out', 'aaa.in')
env.Cat('bbb.out', 'bbb.in')
env.Cat('ccc.out', 'ccc.in')
test.write(['sub', 'eee.in'], "checked-out sub/eee.in\n")
-test.run(arguments = '.',
- stdout = test.wrap_stdout(read_str = """\
-sccs get sub/SConscript
-""",
- build_str = """\
+test.run(arguments = '.', stderr = None)
+
+lines = string.split("""
+sccs get SConscript
sccs get aaa.in
cat(["aaa.out"], ["aaa.in"])
cat(["bbb.out"], ["bbb.in"])
sccs get ccc.in
cat(["ccc.out"], ["ccc.in"])
cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
-sccs get sub/ddd.in
+sccs get ddd.in
cat(["sub/ddd.out"], ["sub/ddd.in"])
cat(["sub/eee.out"], ["sub/eee.in"])
-sccs get sub/fff.in
+sccs get fff.in
cat(["sub/fff.out"], ["sub/fff.in"])
cat(["sub/all"], ["sub/ddd.out", "sub/eee.out", "sub/fff.out"])
-"""),
- stderr = """\
-sub/SConscript 1.1: 5 lines
-aaa.in 1.1: 1 lines
-ccc.in 1.1: 1 lines
-sub/ddd.in 1.1: 1 lines
-sub/fff.in 1.1: 1 lines
+""", '\n')
+
+stdout = test.stdout()
+missing = filter(lambda l, s=stdout: string.find(s, l) == -1, lines)
+if missing:
+ print "Missing the following output lines:"
+ print string.join(missing, '\n')
+ print "Actual STDOUT =========="
+ print stdout
+ test.fail_test(1)
+
+test.must_match('all', """\
+s.aaa.in aaa.in
+checked-out bbb.in
+s.ccc.in ccc.in
""")
-test.must_match('all', "aaa.in\nchecked-out bbb.in\nccc.in\n")
-
test.must_not_be_writable(test.workpath('sub', 'SConscript'))
test.must_not_be_writable(test.workpath('aaa.in'))
test.must_not_be_writable(test.workpath('ccc.in'))