import os
import os.path
+import string
import TestCmd
class TestFailed(Exception):
print "Actual STDERR ============"
print self.stderr()
raise TestFailed
+
+ def up_to_date(self, arguments = None, **kw):
+ kw['arguments'] = arguments
+ s = ""
+ for arg in string.split(arguments):
+ s = s + 'scons: "%s" is up to date.\n' % arg
+ kw['stdout'] = s
+ apply(self.run, [], kw)
if not targets:
targets = default_targets
+ # XXX Right now, this next block prints all "up to date" messages
+ # first, and then goes through and builds the other nodes:
+ #
+ # $ scons aaa bbb ccc ddd
+ # scons: "aaa" is up to date.
+ # scons: "ccc" is up to date.
+ # cc -o bbb bbb.c
+ # cc -o ddd ddd.c
+ #
+ # When we get the real Task and Taskmaster classes, this should
+ # be changed to interact with the engine to deal with targets in
+ # the same order as specified:
+ #
+ # $ scons aaa bbb ccc ddd
+ # scons: "aaa" is up to date.
+ # cc -o bbb bbb.c
+ # scons: "ccc" is up to date.
+ # cc -o ddd ddd.c
+ #
calc = SCons.Sig.Calculator(SCons.Sig.MD5)
- nodes = map(lambda x: SCons.Node.FS.default_fs.File(x), targets)
- nodes = filter(lambda x, calc=calc: not calc.current(x), nodes)
+ nodes = []
+ for t in map(lambda x: SCons.Node.FS.default_fs.File(x), targets):
+ if calc.current(t):
+ print 'scons: "%s" is up to date.' % t.path
+ else:
+ nodes.append(t)
taskmaster = Taskmaster(nodes)
#XXXtest.run(program = test.workpath('foo3'), stdout = "f3a.c\nf3b.c\nf3c.c\n")
#XXXtest.up_to_date(arguments = '.')
+test.up_to_date(arguments = 'foo1 foo2')
test.write('f1.c', """
int
#XXXtest.run(program = test.workpath('foo3'), stdout = "f3a.c\nf3b.c X\nf3c.c\n")
#XXXtest.up_to_date(arguments = '.')
+test.up_to_date(arguments = 'foo1 foo2')
# make sure the programs don't get rebuilt, because nothing changed:
oldtime1 = os.path.getmtime(test.workpath('foo1'))