for t in tlist:
if t.side_effect:
raise UserError, "Multiple ways to build the same target were specified for: %s" % str(t)
- if t.has_builder():
+ if t.has_builder(fetch = 0):
if t.env != env:
raise UserError, "Two different environments were specified for the same target: %s"%str(t)
elif t.overrides != overrides:
return self.name
def builder_set(self, builder):
self.builder = builder
- def has_builder(self):
+ def has_builder(self, fetch=1):
return not self.builder is None
def env_set(self, env, safe=0):
self.env = env
if self.fs.CachePath and self.fs.cache_force and os.path.exists(self.path):
CachePush(self, None, None)
- def has_builder(self):
+ def has_builder(self, fetch = 1):
"""Return whether this Node has a builder or not.
If this Node doesn't have an explicit builder, this is where we
try:
b = self.builder
except AttributeError:
- if not os.path.exists(self.path):
+ if fetch and not os.path.exists(self.path):
b = self.src_builder()
else:
b = None
f1 = fs.File('f1', d)
f2 = fs.File('f2', d)
f3 = fs.File('f3', d)
+ f4 = fs.File('f4', d)
+ f5 = fs.File('f5', d)
+ f6 = fs.File('f6', d)
+ f7 = fs.File('f7', d)
h = f1.has_builder()
assert not h, h
assert h, h
assert f3.builder is b1, f3.builder
+ test.write(['sub', 'f4'], "sub/f4\n")
+ test.write(['sub', 'f6'], "sub/f6\n")
+ h = f4.has_builder(fetch = 0)
+ assert not h, h
+ h = f5.has_builder(fetch = 0)
+ assert not h, h
+ h = f6.has_builder(fetch = 1)
+ assert not h, h
+ h = f7.has_builder(fetch = 1)
+ assert h, h
+
class prepareTestCase(unittest.TestCase):
def runTest(self):
"""Test the prepare() method"""
node.builder_set(b)
assert node.builder == b
+ def test_has_builder(self):
+ """Test the has_builder() method
+ """
+ n1 = SCons.Node.Node()
+ n2 = SCons.Node.Node()
+ n3 = SCons.Node.Node()
+
+ assert n1.has_builder() == 0
+ assert n2.has_builder(fetch = 0) == 0
+ assert n3.has_builder(fetch = 1) == 0
+
+ n1.builder_set(Builder())
+ n2.builder_set(Builder())
+ n3.builder_set(Builder())
+
+ assert n1.has_builder() == 1
+ assert n2.has_builder(fetch = 0) == 1
+ assert n3.has_builder(fetch = 1) == 1
+
def test_builder_sig_adapter(self):
"""Test the node's adapter for builder signatures
"""
def builder_set(self, builder):
self.builder = builder
- def has_builder(self):
+ def has_builder(self, fetch = 1):
"""Return whether this Node has a builder or not.
In Boolean tests, this turns out to be a *lot* more efficient
f = fn
else:
f = SCons.Node.FS.default_fs.File(str(fn))
+ _file_ = None
if f.rexists():
_file_ = open(f.rstr(), "r")
+ elif f.has_builder():
+ # The SConscript file apparently exists in a source
+ # code management system. Build it, but then remove
+ # the builder so that it doesn't get built *again*
+ # during the actual build phase.
+ f.build()
+ f.builder_set(None)
+ s = str(f)
+ if os.path.exists(s):
+ _file_ = open(s, "r")
+
+ if _file_:
SCons.Node.FS.default_fs.chdir(f.dir)
if sconscript_chdir:
old_dir = os.getcwd()
env['CO'] = 'co'
env['RCS'] = 'rcs'
env['RCSFLAGS'] = ''
- env['RCSCOM'] = '$CO $RCSFLAGS -p $TARGET,v > $TARGET'
+ env['RCSCOM'] = '$CO $RCSFLAGS $TARGET'
def exists(env):
return env.Detect('rcs')
bk = test.where_is('bk')
if not bk:
print "Could not find BitKeeper, skipping test(s)."
- test.no_result(1)
+ test.pass_test(1)
try:
login = os.getlogin()
email = "%s@%s" % (login, host)
-test.subdir('BitKeeper', 'import', 'work1', 'work2', 'work3')
+test.subdir('BitKeeper', 'import', ['import', 'sub'], 'work1', 'work2')
# Set up the BitKeeper repository.
bkroot = test.workpath('BitKeeper')
test.write(['import', 'bbb.in'], "import/bbb.in\n")
test.write(['import', 'ccc.in'], "import/ccc.in\n")
+test.write(['import', 'sub', 'SConscript'], """\
+Import("env")
+env.Cat('ddd.out', 'ddd.in')
+env.Cat('eee.out', 'eee.in')
+env.Cat('fff.out', 'fff.in')
+env.Cat('all', ['ddd.out', 'eee.out', 'fff.out'])
+""")
+
+test.write(['import', 'sub', 'ddd.in'], "import/sub/ddd.in\n")
+test.write(['import', 'sub', 'eee.in'], "import/sub/eee.in\n")
+test.write(['import', 'sub', 'fff.in'], "import/sub/fff.in\n")
+
test.run(chdir = 'import',
program = bk,
arguments = 'import -q -f -tplain . %s/foo' % bkroot)
env.Cat('ccc.out', 'foo/ccc.in')
env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out'])
env.SourceCode('.', env.BitKeeper(r'%s'))
+SConscript('foo/sub/SConscript', "env")
""" % bkroot)
test.subdir(['work1', 'foo'])
test.write(['work1', 'foo', 'bbb.in'], "work1/foo/bbb.in\n")
+test.subdir(['work1', 'foo', 'sub'])
+test.write(['work1', 'foo', 'sub', 'eee.in'], "work1/foo/sub/eee.in\n")
+
test.run(chdir = 'work1',
arguments = '.',
- stdout = test.wrap_stdout("""\
+ stdout = test.wrap_stdout(read_str = """\
+bk get -p %s/foo/sub/SConscript > foo/sub/SConscript
+""" % (bkroot),
+ build_str = """\
bk get -p %s/foo/aaa.in > foo/aaa.in
cat("aaa.out", "foo/aaa.in")
cat("bbb.out", "foo/bbb.in")
bk get -p %s/foo/ccc.in > foo/ccc.in
cat("ccc.out", "foo/ccc.in")
cat("all", ["aaa.out", "bbb.out", "ccc.out"])
-""" % (bkroot, bkroot)),
+bk get -p %s/foo/sub/ddd.in > foo/sub/ddd.in
+cat("foo/sub/ddd.out", "foo/sub/ddd.in")
+cat("foo/sub/eee.out", "foo/sub/eee.in")
+bk get -p %s/foo/sub/fff.in > 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"])
+""" % (bkroot, bkroot, bkroot, bkroot)),
stderr = """\
+%s/foo/sub/SConscript 1.1: 5 lines
%s/foo/aaa.in 1.1: 1 lines
%s/foo/ccc.in 1.1: 1 lines
-""" % (bkroot, bkroot))
+%s/foo/sub/ddd.in 1.1: 1 lines
+%s/foo/sub/fff.in 1.1: 1 lines
+""" % (bkroot, bkroot, bkroot, bkroot, bkroot))
test.fail_test(test.read(['work1', 'all']) != "import/aaa.in\nwork1/foo/bbb.in\nimport/ccc.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 BitKeeper checkouts when the module name is specified.
test.write(['work2', 'SConstruct'], """
def cat(env, source, target):
env.Cat('ccc.out', 'ccc.in')
env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out'])
env.SourceCode('.', env.BitKeeper(r'%s', 'foo'))
+SConscript('sub/SConscript', "env")
""" % bkroot)
test.write(['work2', 'bbb.in'], "work2/bbb.in\n")
+test.subdir(['work2', 'sub'])
+test.write(['work2', 'sub', 'eee.in'], "work2/sub/eee.in\n")
+
test.run(chdir = 'work2',
arguments = '.',
- stdout = test.wrap_stdout("""\
+ stdout = test.wrap_stdout(read_str = """\
+bk get -q -p %s/foo/sub/SConscript > sub/SConscript
+""" % (bkroot),
+ build_str = """\
bk get -q -p %s/foo/aaa.in > aaa.in
cat("aaa.out", "aaa.in")
cat("bbb.out", "bbb.in")
bk get -q -p %s/foo/ccc.in > ccc.in
cat("ccc.out", "ccc.in")
cat("all", ["aaa.out", "bbb.out", "ccc.out"])
-""" % (bkroot, bkroot)))
+bk get -q -p %s/foo/sub/ddd.in > sub/ddd.in
+cat("sub/ddd.out", "sub/ddd.in")
+cat("sub/eee.out", "sub/eee.in")
+bk get -q -p %s/foo/sub/fff.in > sub/fff.in
+cat("sub/fff.out", "sub/fff.in")
+cat("sub/all", ["sub/ddd.out", "sub/eee.out", "sub/fff.out"])
+""" % (bkroot, bkroot, bkroot, bkroot)))
test.fail_test(test.read(['work2', 'all']) != "import/aaa.in\nwork2/bbb.in\nimport/ccc.in\n")
+test.fail_test(test.read(['work2', 'sub', 'all']) != "import/sub/ddd.in\nwork2/sub/eee.in\nimport/sub/fff.in\n")
+
test.pass_test()
cvs = test.where_is('cvs')
if not cvs:
print "Could not find CVS, skipping test(s)."
- test.no_result(1)
+ test.pass_test(1)
-test.subdir('CVS', 'import', 'work1', 'work2', 'work3')
+test.subdir('CVS', 'import', ['import', 'sub'], 'work1', 'work2')
# Set up the CVS repository.
cvsroot = test.workpath('CVS')
test.write(['import', 'bbb.in'], "import/bbb.in\n")
test.write(['import', 'ccc.in'], "import/ccc.in\n")
+test.write(['import', 'sub', 'SConscript'], """\
+Import("env")
+env.Cat('ddd.out', 'ddd.in')
+env.Cat('eee.out', 'eee.in')
+env.Cat('fff.out', 'fff.in')
+env.Cat('all', ['ddd.out', 'eee.out', 'fff.out'])
+""")
+
+test.write(['import', 'sub', 'ddd.in'], "import/sub/ddd.in\n")
+test.write(['import', 'sub', 'eee.in'], "import/sub/eee.in\n")
+test.write(['import', 'sub', 'fff.in'], "import/sub/fff.in\n")
+
test.run(chdir = 'import',
program = cvs,
arguments = '-q import -m "import" foo v v-r')
env.Cat('ccc.out', 'foo/ccc.in')
env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out'])
env.SourceCode('.', env.CVS(r'%s'))
+SConscript('foo/sub/SConscript', "env")
""" % cvsroot)
test.subdir(['work1', 'foo'])
test.write(['work1', 'foo', 'bbb.in'], "work1/foo/bbb.in\n")
+test.subdir(['work1', 'foo', 'sub',])
+test.write(['work1', 'foo', 'sub', 'eee.in'], "work1/foo/sub/eee.in\n")
+
test.run(chdir = 'work1',
arguments = '.',
- stdout = test.wrap_stdout("""\
+ stdout = test.wrap_stdout(read_str = """\
+cvs -Q -d %s co -p foo/sub/SConscript > foo/sub/SConscript
+""" % (cvsroot),
+ build_str = """\
cvs -Q -d %s co -p foo/aaa.in > 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
cat("ccc.out", "foo/ccc.in")
cat("all", ["aaa.out", "bbb.out", "ccc.out"])
-""" % (cvsroot, cvsroot)))
+cvs -Q -d %s co -p foo/sub/ddd.in > 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
+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)))
test.fail_test(test.read(['work1', 'all']) != "import/aaa.in\nwork1/foo/bbb.in\nimport/ccc.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 CVS checkouts when the module name is specified.
test.write(['work2', 'SConstruct'], """
def cat(env, source, target):
env.Cat('ccc.out', 'ccc.in')
env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out'])
env.SourceCode('.', env.CVS(r'%s', 'foo'))
+SConscript('sub/SConscript', "env")
""" % cvsroot)
test.write(['work2', 'bbb.in'], "work2/bbb.in\n")
+test.subdir(['work2', 'sub'])
+test.write(['work2', 'sub', 'eee.in'], "work2/sub/eee.in\n")
+
test.run(chdir = 'work2',
arguments = '.',
- stdout = test.wrap_stdout("""\
+ stdout = test.wrap_stdout(read_str = """\
+cvs -q -d %s co -p foo/sub/SConscript > sub/SConscript
+""" % (cvsroot),
+ build_str = """\
cvs -q -d %s co -p foo/aaa.in > aaa.in
cat("aaa.out", "aaa.in")
cat("bbb.out", "bbb.in")
cvs -q -d %s co -p foo/ccc.in > ccc.in
cat("ccc.out", "ccc.in")
cat("all", ["aaa.out", "bbb.out", "ccc.out"])
-""" % (cvsroot, cvsroot)))
+cvs -q -d %s co -p foo/sub/ddd.in > sub/ddd.in
+cat("sub/ddd.out", "sub/ddd.in")
+cat("sub/eee.out", "sub/eee.in")
+cvs -q -d %s co -p foo/sub/fff.in > sub/fff.in
+cat("sub/fff.out", "sub/fff.in")
+cat("sub/all", ["sub/ddd.out", "sub/eee.out", "sub/fff.out"])
+""" % (cvsroot, cvsroot, cvsroot, cvsroot)))
test.fail_test(test.read(['work2', 'all']) != "import/aaa.in\nwork2/bbb.in\nimport/ccc.in\n")
+test.fail_test(test.read(['work2', 'sub', 'all']) != "import/sub/ddd.in\nwork2/sub/eee.in\nimport/sub/fff.in\n")
+
test.pass_test()
rcs = test.where_is('rcs')
if not rcs:
print "Could not find RCS, skipping test(s)."
- test.no_result(1)
+ test.pass_test(1)
ci = test.where_is('ci')
if not ci:
print "Could not find `ci' command, skipping test(s)."
- test.no_result(1)
+ test.pass_test(1)
# Test checkouts from local RCS files
-test.subdir('work1')
+test.subdir('work1', ['work1', 'sub'])
for file in ['aaa.in', 'bbb.in', 'ccc.in']:
test.write(['work1', file], "work1/%s\n" % file)
args = "-f -t%s %s" % (file, file)
test.run(chdir = 'work1', program = ci, arguments = args, stderr = None)
+test.write(['work1', 'sub', 'SConscript'], """\
+Import("env")
+env.Cat('ddd.out', 'ddd.in')
+env.Cat('eee.out', 'eee.in')
+env.Cat('fff.out', 'fff.in')
+env.Cat('all', ['ddd.out', 'eee.out', 'fff.out'])
+""")
+args = "-f -tsub/SConscript sub/SConscript"
+test.run(chdir = 'work1', program = ci, arguments = args, stderr = None)
+
+for file in ['ddd.in', 'eee.in', 'fff.in']:
+ test.write(['work1', 'sub', file], "work1/sub/%s\n" % file)
+ args = "-f -tsub/%s sub/%s" % (file, file)
+ test.run(chdir = 'work1', program = ci, arguments = args, stderr = None)
+
test.no_result(os.path.exists(test.workpath('work1', 'aaa.in')))
test.no_result(os.path.exists(test.workpath('work1', 'bbb.in')))
test.no_result(os.path.exists(test.workpath('work1', 'ccc.in')))
+test.no_result(os.path.exists(test.workpath('work1', 'sub', 'SConscript')))
+
+test.no_result(os.path.exists(test.workpath('work1', 'sub', 'ddd.in')))
+test.no_result(os.path.exists(test.workpath('work1', 'sub', 'eee.in')))
+test.no_result(os.path.exists(test.workpath('work1', 'sub', 'fff.in')))
+
test.write(['work1', 'SConstruct'], """
def cat(env, source, target):
target = str(target[0])
env.Cat('ccc.out', 'ccc.in')
env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out'])
env.SourceCode('.', env.RCS())
+SConscript('sub/SConscript', "env")
""")
test.write(['work1', 'bbb.in'], "checked-out work1/bbb.in\n")
+test.write(['work1', 'sub', 'eee.in'], "checked-out work1/sub/eee.in\n")
+
test.run(chdir = 'work1',
arguments = '.',
- stdout = test.wrap_stdout("""\
-co -p aaa.in,v > aaa.in
+ stdout = test.wrap_stdout(read_str = """\
+co sub/SConscript
+""",
+ build_str = """\
+co aaa.in
cat("aaa.out", "aaa.in")
cat("bbb.out", "bbb.in")
-co -p ccc.in,v > ccc.in
+co ccc.in
cat("ccc.out", "ccc.in")
cat("all", ["aaa.out", "bbb.out", "ccc.out"])
+co sub/ddd.in
+cat("sub/ddd.out", "sub/ddd.in")
+cat("sub/eee.out", "sub/eee.in")
+co sub/fff.in
+cat("sub/fff.out", "sub/fff.in")
+cat("sub/all", ["sub/ddd.out", "sub/eee.out", "sub/fff.out"])
"""),
stderr = """\
-aaa.in,v --> standard output
+sub/SConscript,v --> sub/SConscript
+revision 1.1
+done
+aaa.in,v --> aaa.in
+revision 1.1
+done
+ccc.in,v --> ccc.in
+revision 1.1
+done
+sub/ddd.in,v --> sub/ddd.in
revision 1.1
-ccc.in,v --> standard output
+done
+sub/fff.in,v --> sub/fff.in
revision 1.1
+done
""")
test.fail_test(test.read(['work1', 'all']) != "work1/aaa.in\nchecked-out work1/bbb.in\nwork1/ccc.in\n")
+test.fail_test(test.read(['work1', 'sub', 'all']) != "work1/sub/ddd.in\nchecked-out work1/sub/eee.in\nwork1/sub/fff.in\n")
+
# Test RCS checkouts from an RCS subdirectory.
-test.subdir('work2', ['work2', 'RCS'])
+test.subdir('work2', ['work2', 'RCS'],
+ ['work2', 'sub'], ['work2', 'sub', 'RCS'])
for file in ['aaa.in', 'bbb.in', 'ccc.in']:
test.write(['work2', file], "work2/%s\n" % file)
args = "-f -t%s %s" % (file, file)
test.run(chdir = 'work2', program = ci, arguments = args, stderr = None)
+for file in ['ddd.in', 'eee.in', 'fff.in']:
+ test.write(['work2', 'sub', file], "work2/sub/%s\n" % file)
+ args = "-f -tsub/%s sub/%s" % (file, file)
+ test.run(chdir = 'work2', program = ci, arguments = args, stderr = None)
+
+test.write(['work2', 'sub', 'SConscript'], """\
+Import("env")
+env.Cat('ddd.out', 'ddd.in')
+env.Cat('eee.out', 'eee.in')
+env.Cat('fff.out', 'fff.in')
+env.Cat('all', ['ddd.out', 'eee.out', 'fff.out'])
+""")
+args = "-f -tsub/SConscript sub/SConscript"
+test.run(chdir = 'work2', program = ci, arguments = args, stderr = None)
+
test.no_result(os.path.exists(test.workpath('work2', 'aaa.in')))
test.no_result(os.path.exists(test.workpath('work2', 'bbb.in')))
test.no_result(os.path.exists(test.workpath('work2', 'ccc.in')))
+test.no_result(os.path.exists(test.workpath('work2', 'sub', 'SConscript')))
+
+test.no_result(os.path.exists(test.workpath('work2', 'sub', 'aaa.in')))
+test.no_result(os.path.exists(test.workpath('work2', 'sub', 'bbb.in')))
+test.no_result(os.path.exists(test.workpath('work2', 'sub', 'ccc.in')))
+
test.write(['work2', 'SConstruct'], """
def cat(env, source, target):
target = str(target[0])
env.Cat('ccc.out', 'ccc.in')
env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out'])
env.SourceCode('.', env.RCS())
+SConscript('sub/SConscript', "env")
""")
test.write(['work2', 'bbb.in'], "checked-out work2/bbb.in\n")
+test.write(['work2', 'sub', 'eee.in'], "checked-out work2/sub/eee.in\n")
+
test.run(chdir = 'work2',
arguments = '.',
- stdout = test.wrap_stdout("""\
-co -q -p aaa.in,v > aaa.in
+ stdout = test.wrap_stdout(read_str = """\
+co -q sub/SConscript
+""",
+ build_str = """\
+co -q aaa.in
cat("aaa.out", "aaa.in")
cat("bbb.out", "bbb.in")
-co -q -p ccc.in,v > ccc.in
+co -q ccc.in
cat("ccc.out", "ccc.in")
cat("all", ["aaa.out", "bbb.out", "ccc.out"])
+co -q sub/ddd.in
+cat("sub/ddd.out", "sub/ddd.in")
+cat("sub/eee.out", "sub/eee.in")
+co -q sub/fff.in
+cat("sub/fff.out", "sub/fff.in")
+cat("sub/all", ["sub/ddd.out", "sub/eee.out", "sub/fff.out"])
"""))
test.fail_test(test.read(['work2', 'all']) != "work2/aaa.in\nchecked-out work2/bbb.in\nwork2/ccc.in\n")
+test.fail_test(test.read(['work2', 'sub', 'all']) != "work2/sub/ddd.in\nchecked-out work2/sub/eee.in\nwork2/sub/fff.in\n")
+
test.pass_test()
sccs = test.where_is('sccs')
if not sccs:
print "Could not find SCCS, skipping test(s)."
- test.no_result(1)
+ test.pass_test(1)
# Test checkouts from local SCCS files.
-test.subdir('work1')
+test.subdir('work1', ['work1', 'sub'])
test.preserve()
test.unlink(['work1', file])
test.unlink(['work1', ','+file])
+test.write(['work1', 'sub', 'SConscript'], """\
+Import("env")
+env.Cat('ddd.out', 'ddd.in')
+env.Cat('eee.out', 'eee.in')
+env.Cat('fff.out', 'fff.in')
+env.Cat('all', ['ddd.out', 'eee.out', 'fff.out'])
+""")
+args = "create SConscript"
+test.run(chdir = 'work1/sub', program = sccs, arguments = args, stderr = None)
+test.unlink(['work1', 'sub', 'SConscript'])
+test.unlink(['work1', 'sub', ',SConscript'])
+
+for file in ['ddd.in', 'eee.in', 'fff.in']:
+ test.write(['work1', 'sub', file], "work1/sub/%s\n" % file)
+ args = "create %s" % file
+ test.run(chdir = 'work1/sub', program = sccs, arguments = args, stderr = None)
+ test.unlink(['work1', 'sub', file])
+ test.unlink(['work1', 'sub', ','+file])
+
test.write(['work1', 'SConstruct'], """
def cat(env, source, target):
target = str(target[0])
env.Cat('ccc.out', 'ccc.in')
env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out'])
env.SourceCode('.', env.SCCS())
+SConscript('sub/SConscript', "env")
""")
test.write(['work1', 'bbb.in'], "checked-out work1/bbb.in\n")
+test.write(['work1', 'sub', 'eee.in'], "checked-out work1/sub/eee.in\n")
+
test.run(chdir = 'work1',
arguments = '.',
- stdout = test.wrap_stdout("""\
+ stdout = test.wrap_stdout(read_str = """\
+sccs get sub/SConscript
+""",
+ build_str = """\
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
+cat("sub/ddd.out", "sub/ddd.in")
+cat("sub/eee.out", "sub/eee.in")
+sccs get sub/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
""")
test.fail_test(test.read(['work1', 'all']) != "work1/aaa.in\nchecked-out work1/bbb.in\nwork1/ccc.in\n")
svn = test.where_is('svn')
if not svn:
print "Could not find Subversion, skipping test(s)."
- test.no_result(1)
+ test.pass_test(1)
svnadmin = test.where_is('svnadmin')
if not svn:
print "Could not find Subversion, skipping test(s)."
- test.no_result(1)
+ test.pass_test(1)
-test.subdir('Subversion', 'import', 'work1', 'work2', 'work3')
+test.subdir('Subversion', 'import', ['import', 'sub'], 'work1', 'work2')
# Set up the Subversion repository.
svnrootpath = test.workpath('Subversion')
test.write(['import', 'bbb.in'], "import/bbb.in\n")
test.write(['import', 'ccc.in'], "import/ccc.in\n")
+test.write(['import', 'sub', 'SConscript'], """\
+Import("env")
+env.Cat('ddd.out', 'ddd.in')
+env.Cat('eee.out', 'eee.in')
+env.Cat('fff.out', 'fff.in')
+env.Cat('all', ['ddd.out', 'eee.out', 'fff.out'])
+""")
+
+test.write(['import', 'sub', 'ddd.in'], "import/sub/ddd.in\n")
+test.write(['import', 'sub', 'eee.in'], "import/sub/eee.in\n")
+test.write(['import', 'sub', 'fff.in'], "import/sub/fff.in\n")
+
test.run(chdir = 'import',
program = svn,
arguments = 'import %s . foo -m"import foo"' % svnrooturl)
env.Cat('ccc.out', 'foo/ccc.in')
env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out'])
env.SourceCode('.', env.Subversion(r'%s'))
+SConscript('foo/sub/SConscript', "env")
""" % svnrooturl)
test.subdir(['work1', 'foo'])
test.write(['work1', 'foo', 'bbb.in'], "work1/foo/bbb.in\n")
+test.subdir(['work1', 'foo', 'sub'])
+test.write(['work1', 'foo', 'sub', 'eee.in'], "work1/foo/sub/eee.in\n")
+
test.run(chdir = 'work1',
arguments = '.',
- stdout = test.wrap_stdout("""\
+ stdout = test.wrap_stdout(read_str = """\
+svn cat %s/foo/sub/SConscript > foo/sub/SConscript
+""" % (svnrooturl),
+ build_str = """\
svn cat %s/foo/aaa.in > foo/aaa.in
cat("aaa.out", "foo/aaa.in")
cat("bbb.out", "foo/bbb.in")
svn cat %s/foo/ccc.in > foo/ccc.in
cat("ccc.out", "foo/ccc.in")
cat("all", ["aaa.out", "bbb.out", "ccc.out"])
-""" % (svnrooturl, svnrooturl)))
+svn cat %s/foo/sub/ddd.in > foo/sub/ddd.in
+cat("foo/sub/ddd.out", "foo/sub/ddd.in")
+cat("foo/sub/eee.out", "foo/sub/eee.in")
+svn cat %s/foo/sub/fff.in > 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"])
+""" % (svnrooturl, svnrooturl, svnrooturl, svnrooturl)))
test.fail_test(test.read(['work1', 'all']) != "import/aaa.in\nwork1/foo/bbb.in\nimport/ccc.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 Subversion checkouts when the module name is specified.
test.write(['work2', 'SConstruct'], """
def cat(env, source, target):
env.Cat('ccc.out', 'ccc.in')
env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out'])
env.SourceCode('.', env.Subversion(r'%s', 'foo'))
+SConscript('sub/SConscript', "env")
""" % svnrooturl)
test.write(['work2', 'bbb.in'], "work2/bbb.in\n")
+test.subdir(['work2', 'sub'])
+test.write(['work2', 'sub', 'eee.in'], "work2/sub/eee.in\n")
+
test.run(chdir = 'work2',
arguments = '.',
- stdout = test.wrap_stdout("""\
+ stdout = test.wrap_stdout(read_str = """\
+svn cat %s/foo/sub/SConscript > sub/SConscript
+""" % (svnrooturl),
+ build_str = """\
svn cat %s/foo/aaa.in > aaa.in
cat("aaa.out", "aaa.in")
cat("bbb.out", "bbb.in")
svn cat %s/foo/ccc.in > ccc.in
cat("ccc.out", "ccc.in")
cat("all", ["aaa.out", "bbb.out", "ccc.out"])
-""" % (svnrooturl, svnrooturl)))
+svn cat %s/foo/sub/ddd.in > sub/ddd.in
+cat("sub/ddd.out", "sub/ddd.in")
+cat("sub/eee.out", "sub/eee.in")
+svn cat %s/foo/sub/fff.in > sub/fff.in
+cat("sub/fff.out", "sub/fff.in")
+cat("sub/all", ["sub/ddd.out", "sub/eee.out", "sub/fff.out"])
+""" % (svnrooturl, svnrooturl, svnrooturl, svnrooturl)))
test.fail_test(test.read(['work2', 'all']) != "import/aaa.in\nwork2/bbb.in\nimport/ccc.in\n")
+test.fail_test(test.read(['work2', 'sub', 'all']) != "import/sub/ddd.in\nwork2/sub/eee.in\nimport/sub/fff.in\n")
+
test.pass_test()