diff options
author | Steven Knight <knight@baldmt.com> | 2003-03-22 23:49:41 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2003-03-22 23:49:41 (GMT) |
commit | 904be3fe063b4ad64bccd63909ecc3dbffc549d7 (patch) | |
tree | d0d1706e890a9f605caa088621956ef637939453 /test/CVS.py | |
parent | bf40333ce747dbb66388dc9cb40e5ce741cb0055 (diff) | |
download | SCons-904be3fe063b4ad64bccd63909ecc3dbffc549d7.zip SCons-904be3fe063b4ad64bccd63909ecc3dbffc549d7.tar.gz SCons-904be3fe063b4ad64bccd63909ecc3dbffc549d7.tar.bz2 |
Check out files from various source code systems properly.
Diffstat (limited to 'test/CVS.py')
-rw-r--r-- | test/CVS.py | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/test/CVS.py b/test/CVS.py index bf1e830..ff6963f 100644 --- a/test/CVS.py +++ b/test/CVS.py @@ -29,6 +29,7 @@ Test fetching source files from CVS. """ import os +import stat import TestSCons @@ -39,6 +40,10 @@ if not cvs: print "Could not find CVS, skipping test(s)." test.pass_test(1) +def is_writable(file): + mode = os.stat(file)[stat.ST_MODE] + return mode & stat.S_IWUSR + test.subdir('CVS', 'import', ['import', 'sub'], 'work1', 'work2') # Set up the CVS repository. @@ -76,8 +81,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)}, - CVSFLAGS='-Q') +env = Environment(BUILDERS={'Cat':Builder(action=cat)}) +env.Prepend(CVSFLAGS='-Q ') env.Cat('aaa.out', 'foo/aaa.in') env.Cat('bbb.out', 'foo/bbb.in') env.Cat('ccc.out', 'foo/ccc.in') @@ -95,19 +100,19 @@ test.write(['work1', 'foo', 'sub', 'eee.in'], "work1/foo/sub/eee.in\n") test.run(chdir = 'work1', arguments = '.', stdout = test.wrap_stdout(read_str = """\ -cvs -Q -d %s co -p foo/sub/SConscript > foo/sub/SConscript +cvs -Q -d %s co foo/sub/SConscript """ % (cvsroot), build_str = """\ -cvs -Q -d %s co -p foo/aaa.in > foo/aaa.in +cvs -Q -d %s co foo/aaa.in cat("aaa.out", "foo/aaa.in") cat("bbb.out", "foo/bbb.in") -cvs -Q -d %s co -p foo/ccc.in > foo/ccc.in +cvs -Q -d %s co foo/ccc.in cat("ccc.out", "foo/ccc.in") cat("all", ["aaa.out", "bbb.out", "ccc.out"]) -cvs -Q -d %s co -p foo/sub/ddd.in > foo/sub/ddd.in +cvs -Q -d %s co foo/sub/ddd.in cat("foo/sub/ddd.out", "foo/sub/ddd.in") cat("foo/sub/eee.out", "foo/sub/eee.in") -cvs -Q -d %s co -p foo/sub/fff.in > foo/sub/fff.in +cvs -Q -d %s co foo/sub/fff.in cat("foo/sub/fff.out", "foo/sub/fff.in") cat("foo/sub/all", ["foo/sub/ddd.out", "foo/sub/eee.out", "foo/sub/fff.out"]) """ % (cvsroot, cvsroot, cvsroot, cvsroot))) @@ -116,6 +121,12 @@ test.fail_test(test.read(['work1', 'all']) != "import/aaa.in\nwork1/foo/bbb.in\n test.fail_test(test.read(['work1', 'foo', 'sub', 'all']) != "import/sub/ddd.in\nwork1/foo/sub/eee.in\nimport/sub/fff.in\n") +test.fail_test(not is_writable(test.workpath('work1', 'foo', 'sub', 'SConscript'))) +test.fail_test(not is_writable(test.workpath('work1', 'foo', 'aaa.in'))) +test.fail_test(not is_writable(test.workpath('work1', 'foo', 'ccc.in'))) +test.fail_test(not is_writable(test.workpath('work1', 'foo', 'sub', 'ddd.in'))) +test.fail_test(not is_writable(test.workpath('work1', 'foo', 'sub', 'fff.in'))) + # Test CVS checkouts when the module name is specified. test.write(['work2', 'SConstruct'], """ def cat(env, source, target): @@ -125,8 +136,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)}, - CVSFLAGS='-q') +env = Environment(BUILDERS={'Cat':Builder(action=cat)}) +env.Prepend(CVSFLAGS='-q ') env.Cat('aaa.out', 'aaa.in') env.Cat('bbb.out', 'bbb.in') env.Cat('ccc.out', 'ccc.in') @@ -164,4 +175,10 @@ test.fail_test(test.read(['work2', 'all']) != "import/aaa.in\nwork2/bbb.in\nimpo test.fail_test(test.read(['work2', 'sub', 'all']) != "import/sub/ddd.in\nwork2/sub/eee.in\nimport/sub/fff.in\n") +test.fail_test(not is_writable(test.workpath('work2', 'sub', 'SConscript'))) +test.fail_test(not is_writable(test.workpath('work2', 'aaa.in'))) +test.fail_test(not is_writable(test.workpath('work2', 'ccc.in'))) +test.fail_test(not is_writable(test.workpath('work2', 'sub', 'ddd.in'))) +test.fail_test(not is_writable(test.workpath('work2', 'sub', 'fff.in'))) + test.pass_test() |