From 5478367f0ce1368182ba7cba8f0276d6a1ea3254 Mon Sep 17 00:00:00 2001 From: stevenknight Date: Fri, 10 Jun 2005 01:18:41 +0000 Subject: [PATCH] Fix test/SCCS/* portability issues. git-svn-id: http://scons.tigris.org/svn/scons/trunk@1309 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- test/SCCS/explicit.py | 46 ++++++++++++++++++++++---------------- test/SCCS/implicit.py | 23 +++++++++++++++---- test/SCCS/transparent.py | 48 ++++++++++++++++++++++++---------------- 3 files changed, 75 insertions(+), 42 deletions(-) diff --git a/test/SCCS/explicit.py b/test/SCCS/explicit.py index a501dda7..23bb6eb8 100644 --- a/test/SCCS/explicit.py +++ b/test/SCCS/explicit.py @@ -28,6 +28,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" Test explicit checkouts from local SCCS files. """ +import string + import TestSCons test = TestSCons.TestSCons() @@ -39,10 +41,10 @@ if not sccs: -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) @@ -61,7 +63,7 @@ test.unlink(['sub', 'SConscript']) 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]) @@ -76,6 +78,7 @@ def cat(env, source, target): 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') @@ -89,34 +92,39 @@ test.write('bbb.in', "checked-out bbb.in\n") 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')) diff --git a/test/SCCS/implicit.py b/test/SCCS/implicit.py index a8e65685..3c3676e1 100644 --- a/test/SCCS/implicit.py +++ b/test/SCCS/implicit.py @@ -28,6 +28,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" Test transparent SCCS checkouts of implicit dependencies. """ +import string + import TestSCons test = TestSCons.TestSCons() @@ -42,6 +44,7 @@ if not sccs: test.subdir('SCCS') test.write('foo.c', """\ +/* %%F%% */ #include "foo.h" int main(int argc, char *argv[]) { @@ -61,14 +64,26 @@ test.unlink('foo.h') 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) diff --git a/test/SCCS/transparent.py b/test/SCCS/transparent.py index e8730514..ba614cde 100644 --- a/test/SCCS/transparent.py +++ b/test/SCCS/transparent.py @@ -28,6 +28,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" Test transparent checkouts from SCCS files in an SCCS subdirectory. """ +import string + import TestSCons test = TestSCons.TestSCons() @@ -42,13 +44,14 @@ if not sccs: 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') @@ -61,13 +64,14 @@ test.unlink(['sub', 'SConscript']) 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) @@ -75,7 +79,8 @@ def cat(env, source, target): 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') @@ -87,34 +92,39 @@ test.write(['bbb.in'], "checked-out bbb.in\n") 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')) -- 2.26.2