diff options
author | Steven Knight <knight@baldmt.com> | 2005-06-10 01:18:41 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2005-06-10 01:18:41 (GMT) |
commit | d696df92602493ea6ca6fb2c2a252c73aae704bd (patch) | |
tree | 8d1015bf1ef5c4cf899e087aa6075ba77c75dcf9 | |
parent | 086a115a4add32f83be62140e9c0677cfdb90d73 (diff) | |
download | SCons-d696df92602493ea6ca6fb2c2a252c73aae704bd.zip SCons-d696df92602493ea6ca6fb2c2a252c73aae704bd.tar.gz SCons-d696df92602493ea6ca6fb2c2a252c73aae704bd.tar.bz2 |
Fix test/SCCS/* portability issues.
-rw-r--r-- | test/SCCS/explicit.py | 46 | ||||
-rw-r--r-- | test/SCCS/implicit.py | 23 | ||||
-rw-r--r-- | 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 a501dda..23bb6eb 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 a8e6568..3c3676e 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 e873051..ba614cd 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')) |