print self.stderr()
raise TestFailed
if not stdout is None and not self.match(self.stdout(), stdout):
- print "Expected STDOUT =========="
- print stdout
- print "Actual STDOUT ============"
- print self.stdout()
- stderr = self.stderr()
- if stderr:
- print "STDERR ==================="
- print stderr
- raise TestFailed
+ print "Expected STDOUT =========="
+ print stdout
+ print "Actual STDOUT ============"
+ print self.stdout()
+ stderr = self.stderr()
+ if stderr:
+ print "STDERR ==================="
+ print stderr
+ raise TestFailed
if not stderr is None and not self.match(self.stderr(), stderr):
print "STDOUT ==================="
print self.stdout()
print self.stderr()
raise TestFailed
+ def wrap_stdout(self, build_str = "", read_str = ""):
+ """Wraps standard output string(s) in the normal
+ "Reading ... done" and "Building ... done" strings
+ """
+ return "scons: Reading SConscript files ...\n" + \
+ read_str + \
+ "scons: done reading SConscript files.\n" + \
+ "scons: Building targets ...\n" + \
+ build_str + \
+ "scons: done building targets.\n"
+
def up_to_date(self, options = None, arguments = None, **kw):
- s = ""
- for arg in string.split(arguments):
- s = s + 'scons: "%s" is up to date.\n' % arg
- if options:
- arguments = options + " " + arguments
- kw['arguments'] = arguments
- kw['stdout'] = s
- apply(self.run, [], kw)
+ s = ""
+ for arg in string.split(arguments):
+ s = s + 'scons: "%s" is up to date.\n' % arg
+ if options:
+ arguments = options + " " + arguments
+ kw['arguments'] = arguments
+ kw['stdout'] = self.wrap_stdout(build_str = s)
+ apply(self.run, [], kw)
existence of a file before scanning it. (This adds a generic
hook to check an arbitrary condition before scanning.)
+ - Add explicit messages to tell when we're "Reading SConscript files
+ ...," "done reading SConscript files," "Building targets," and
+ "done building targets."
+
From Jeff Petkau:
- Fix interpretation of '#/../foo' on Win32 systems.
-"""engine.SCons.SConscript
+"""SCons.Script.SConscript
This module defines the Python API provided to SConscript and SConstruct
files.
import string
import sys
+def do_nothing(text): pass
+HelpFunction = do_nothing
+
default_targets = []
-print_help = 0
arguments = {}
launch_dir = os.path.abspath(os.curdir)
t.set_local()
def Help(text):
- if print_help:
- print text
- print "Use scons -H for help about command-line options."
- sys.exit(0)
+ HelpFunction(text)
def BuildDir(build_dir, src_dir, duplicate=1):
SCons.Node.FS.default_fs.BuildDir(build_dir, src_dir, duplicate)
-"""engine.SCons.script
+"""SCons.Script
This file implements the main() function used by the scons script.
max_drift = None
repositories = []
+# Exceptions for this module
+class PrintHelp(Exception):
+ pass
# utility functions
help = "Read FILE as the top-level SConstruct file.")
def opt_help(opt, arg):
- global help_option
+ global help_option
help_option = 'h'
- SCons.Script.SConscript.print_help = 1
+ def raisePrintHelp(text):
+ raise PrintHelp, text
+ SCons.Script.SConscript.HelpFunction = raisePrintHelp
Option(func = opt_help,
short = 'h', long = ['help'],
for rep in repositories:
SCons.Node.FS.default_fs.Repository(rep)
- start_time = time.time()
- for script in scripts:
- SCons.Script.SConscript.SConscript(script)
- global sconscript_time
- sconscript_time = time.time() - start_time
+ print "scons: Reading SConscript files ..."
+ try:
+ start_time = time.time()
+ for script in scripts:
+ SCons.Script.SConscript.SConscript(script)
+ global sconscript_time
+ sconscript_time = time.time() - start_time
+ except PrintHelp, text:
+ print "scons: done reading SConscript files."
+ print text
+ print "Use scons -H for help about command-line options."
+ sys.exit(0)
+
+ print "scons: done reading SConscript files."
SCons.Node.FS.default_fs.chdir(SCons.Node.FS.default_fs.Top)
calc = SCons.Sig.default_calc
+ print "scons: Building targets ..."
taskmaster = SCons.Taskmaster.Taskmaster(nodes, task_class, calc)
jobs = SCons.Job.Jobs(num_jobs, taskmaster)
try:
jobs.run()
finally:
+ print "scons: done building targets."
SCons.Sig.write()
def main():
test.write('f3.in', "f3.in 2 \n")
-test.run(arguments = 'f1.out', stdout=""".* build.py f3.out f3.in
-.* build.py f1.out f1.in
-""")
+test.run(arguments = 'f1.out',
+ stdout = test.wrap_stdout(".* build.py f3.out f3.in\n.* build.py f1.out f1.in\n"))
test.up_to_date(arguments = 'f1.out')
test.write('f3.in', "f3.in 3 \n")
-test.run(arguments = 'f1.out', stdout=""".* build.py f3.out f3.in
-.* build.py f1.out f1.in
-""")
+test.run(arguments = 'f1.out',
+ stdout = test.wrap_stdout('.* build.py f3.out f3.in\n.* build.py f1.out f1.in\n'))
test.up_to_date(arguments = 'f1.out')
print open(str(file4), 'r').read()
""")
-expect = """test 1
+expect = test.wrap_stdout(read_str = """test 1
test 3
test 4
-scons: "." is up to date.
-"""
+""", build_str = 'scons: "." is up to date.\n')
test.run(arguments = ".", stdout = expect)
Help("Help text\ngoes here.\n")
""")
-expect = "Help text\ngoes here.\n\nUse scons -H for help about command-line options.\n"
+expect = """scons: Reading SConscript files ...
+scons: done reading SConscript files.
+Help text
+goes here.
+
+Use scons -H for help about command-line options.
+"""
test.run(arguments = '-h', stdout = expect)
Default(env.Alias('dummy'))
""")
test.run()
-cc, ccflags = string.split(test.stdout(), '\n')[:2]
+cc, ccflags = string.split(test.stdout(), '\n')[1:3]
test.write('SConstruct', """
opts = Options('custom.py')
def check(expect):
result = string.split(test.stdout(), '\n')
- assert result[0:len(expect)] == expect, (result[0:len(expect)], expect)
+ assert result[1:len(expect)+1] == expect, (result[1:len(expect)+1], expect)
test.run()
check(['0', '1', cc, ccflags + ' -g'])
test.run(arguments='"DEBUG_BUILD=1"')
check(['1', '1', cc, ccflags + ' -O -g'])
-test.run(arguments='-h')
-assert test.stdout() == """Variables settable in custom.py or on the command line:
+test.run(arguments='-h',
+ stdout = """scons: Reading SConscript files ...
+scons: done reading SConscript files.
+Variables settable in custom.py or on the command line:
RELEASE_BUILD: Set to 1 to build a release build
default: 0
actual: %s
Use scons -H for help about command-line options.
-"""%cc
+"""%cc)
test.pass_test()
print "'%s'" % env['LIBSUFFIX']
""")
-expect = """'.exe'
+expect = test.wrap_stdout(read_str = """'.exe'
'.exe'
''
'.exe'
'.lib'
'.a'
'.lib'
-scons: "." is up to date.
-"""
+""", build_str = 'scons: "." is up to date.\n')
test.run(arguments = ".", stdout = expect)
Help("Help text.\n")
""")
-expect = "Help text.\n\nUse scons -H for help about command-line options.\n"
+expect = """scons: Reading SConscript files ...
+scons: done reading SConscript files.
+Help text.
+
+Use scons -H for help about command-line options.
+"""
os.environ['SCONSFLAGS'] = ''
wpath = test.workpath()
test.run(arguments = ".",
- stdout = 'SConstruct %s\nSConscript %s\nscons: "." is up to date.\n' % (wpath, wpath))
+ stdout = test.wrap_stdout(read_str = 'SConstruct %s\nSConscript %s\n' % (wpath, wpath),
+ build_str = 'scons: "." is up to date.\n'))
test.pass_test()
print "sconstruct", os.getcwd()
""")
-test.run(arguments = ".", stdout = 'sconstruct %s\nscons: "." is up to date.\n' % wpath)
+test.run(arguments = ".",
+ stdout = test.wrap_stdout(read_str = 'sconstruct %s\n' % wpath,
+ build_str = 'scons: "." is up to date.\n'))
test.write('Sconstruct', """
print "Sconstruct", os.getcwd()
""")
-test.run(arguments = ".", stdout = 'Sconstruct %s\nscons: "." is up to date.\n' % wpath)
+test.run(arguments = ".",
+ stdout = test.wrap_stdout(read_str = 'Sconstruct %s\n' % wpath,
+ build_str = 'scons: "." is up to date.\n'))
test.write('SConstruct', """
import os
print "SConstruct", os.getcwd()
""")
-test.run(arguments = ".", stdout = 'SConstruct %s\nscons: "." is up to date.\n' % wpath)
+test.run(arguments = ".",
+ stdout = test.wrap_stdout(read_str = 'SConstruct %s\n' % wpath,
+ build_str = 'scons: "." is up to date.\n'))
test.pass_test()
test.fail_test(test.read('bar') != "yyy 2\nbar.in 1 line 2\nbar.in 1 line 3\nzzz 2\n")
-test.run(arguments = 'foo', stdout='scons: "foo" is up to date.\n')
+test.run(arguments = 'foo',
+ stdout=test.wrap_stdout('scons: "foo" is up to date.\n'))
test.pass_test()
test.write('foo.in', 'foo.in')
-test.run(arguments='foo.out.out', stdout='copy foo.in -> foo.out\ncopy foo.out -> foo.out.out\n')
+test.run(arguments='foo.out.out',
+ stdout=test.wrap_stdout('copy foo.in -> foo.out\ncopy foo.out -> foo.out.out\n'))
-test.run(arguments='foo.out.out', stdout='scons: "foo.out.out" is up to date.\n')
+test.run(arguments='foo.out.out',
+ stdout=test.wrap_stdout('scons: "foo.out.out" is up to date.\n'))
test.write('SConstruct', """
env = Environment()
SetBuildSignatureType('content')
""")
-test.run(arguments='foo.out.out', stdout='copy foo.in -> foo.out\nscons: "foo.out.out" is up to date.\n')
+test.run(arguments='foo.out.out',
+ stdout=test.wrap_stdout('copy foo.in -> foo.out\nscons: "foo.out.out" is up to date.\n'))
test.write('SConstruct', """
env = Environment()
SetBuildSignatureType('build')
""")
-test.run(arguments='foo.out.out', stdout='copy foo.out -> foo.out.out\n')
+test.run(arguments='foo.out.out',
+ stdout=test.wrap_stdout('copy foo.out -> foo.out.out\n'))
test.write('SConstruct', """
env = Environment()
SetBuildSignatureType('build')
""")
-test.run(arguments='foo.out.out', stdout='copy foo.in -> foo.out\ncopy foo.out -> foo.out.out\n')
+test.run(arguments='foo.out.out',
+ stdout=test.wrap_stdout('copy foo.in -> foo.out\ncopy foo.out -> foo.out.out\n'))
test.pass_test()
test.write('bar.in', 'bar.in\n')
test.write('blat.in', 'blat.in\n')
-test.run(arguments = 'foo.out bar.out', stdout="""\
+test.run(arguments = 'foo.out bar.out', stdout=test.wrap_stdout("""\
copy() < foo.in > foo.out
copy() < bar.in > bar.out
-""")
+"""))
expect = """\
foo.in -> foo.out
test.write('bar.in', 'bar.in 2 \n')
-test.run(arguments = 'log.txt', stdout="""\
+test.run(arguments = 'log.txt', stdout=test.wrap_stdout("""\
copy() < bar.in > bar.out
copy() < blat.in > blat.out
-""")
+"""))
expect = """\
foo.in -> foo.out
test.write('foo.in', 'foo.in 2 \n')
-test.run(arguments = ".", stdout="""\
+test.run(arguments = ".", stdout=test.wrap_stdout("""\
copy() < foo.in > foo.out
copy() < log.txt > log.out
-""")
+"""))
expect = """\
foo.in -> foo.out
test.fail_test(os.path.exists(test.workpath('blat.out')))
test.fail_test(os.path.exists(test.workpath('log.txt')))
-test.run(arguments = "-j 4 .", stdout="""\
+test.run(arguments = "-j 4 .", stdout=test.wrap_stdout("""\
copy() < bar.in > bar.out
copy() < blat.in > blat.out
copy() < foo.in > foo.out
copy() < log.txt > log.out
-""")
+"""))
expect = """\
bar.in -> bar.out
['fff']
['ggg', 'hhh']
['iii', 'jjj']
-scons: "." is up to date.
"""
-test.run(arguments = ".", stdout = expect)
+test.run(arguments = ".",
+ stdout = test.wrap_stdout(read_str = expect,
+ build_str = 'scons: "." is up to date.\n'))
test.pass_test()
test.workpath(sub4_xxx_exe),
test.workpath(sub3_xxx_exe),
test.workpath(sub4_xxx_exe),
- 'scons: "." is up to date.',
]
-test.run(arguments = ".", stdout = string.join(expect, "\n") + "\n")
+test.run(arguments = ".",
+ stdout = test.wrap_stdout(read_str = string.join(expect, "\n") + "\n",
+ build_str = 'scons: "." is up to date.\n'))
os.environ['PATH'] = string.join(pathdirs_1243, os.pathsep)
test.workpath(sub4_xxx_exe),
test.workpath(sub3_xxx_exe),
test.workpath(sub4_xxx_exe),
- 'scons: "." is up to date.',
]
-test.run(arguments = ".", stdout = string.join(expect, "\n") + "\n")
+test.run(arguments = ".",
+ stdout = test.wrap_stdout(read_str = string.join(expect, "\n") + "\n",
+ build_str = 'scons: "." is up to date.\n'))
test.pass_test()
""" % string.replace(no_such_file, '\\', '\\\\'))
test.run(arguments='-f SConstruct1 .',
- stdout = "%s f1.in f1\n" % no_such_file,
+ stdout = test.wrap_stdout("%s f1.in f1\n" % no_such_file),
stderr = None,
status = 2)
""" % string.replace(not_executable, '\\', '\\\\'))
test.run(arguments='-f SConstruct2 .',
- stdout = "%s f2.in f2\n" % not_executable,
+ stdout = test.wrap_stdout("%s f2.in f2\n" % not_executable),
stderr = None,
status = 2)
""" % string.replace(test.workdir, '\\', '\\\\'))
test.run(arguments='-f SConstruct3 .',
- stdout = "%s f3.in f3\n" % test.workdir,
+ stdout = test.wrap_stdout("%s f3.in f3\n" % test.workdir),
stderr = None,
status = 2)
test.write('foo.in', "foo.in")
-test.run(arguments="--max-drift=0 -f SConstruct1 foo.mid", stdout='built foo.mid\n')
-test.run(arguments="--max-drift=0 -f SConstruct2 foo.out", stdout='built foo.out\n')
+test.run(arguments="--max-drift=0 -f SConstruct1 foo.mid",
+ stdout = test.wrap_stdout('built foo.mid\n'))
+test.run(arguments="--max-drift=0 -f SConstruct2 foo.out",
+ stdout = test.wrap_stdout('built foo.out\n'))
-test.run(arguments="--max-drift=0 -f SConstruct1 foo.mid", stdout='scons: "foo.mid" is up to date.\n')
-test.run(arguments="--max-drift=0 -f SConstruct2 foo.out", stdout='scons: "foo.out" is up to date.\n')
+test.run(arguments="--max-drift=0 -f SConstruct1 foo.mid",
+ stdout = test.wrap_stdout('scons: "foo.mid" is up to date.\n'))
+test.run(arguments="--max-drift=0 -f SConstruct2 foo.out",
+ stdout = test.wrap_stdout('scons: "foo.out" is up to date.\n'))
test.write('foo.in', "foo.in 2")
-test.run(arguments="--max-drift=0 -f SConstruct1 foo.mid", stdout='built foo.mid\n')
-test.run(arguments="--max-drift=0 -f SConstruct2 foo.out", stdout='built foo.out\n')
+test.run(arguments="--max-drift=0 -f SConstruct1 foo.mid",
+ stdout = test.wrap_stdout('built foo.mid\n'))
+test.run(arguments="--max-drift=0 -f SConstruct2 foo.out",
+ stdout = test.wrap_stdout('built foo.out\n'))
-test.run(arguments="--max-drift=0 -f SConstruct1 foo.mid", stdout='scons: "foo.mid" is up to date.\n')
-test.run(arguments="--max-drift=0 -f SConstruct2 foo.out", stdout='scons: "foo.out" is up to date.\n')
+test.run(arguments="--max-drift=0 -f SConstruct1 foo.mid",
+ stdout = test.wrap_stdout('scons: "foo.mid" is up to date.\n'))
+test.run(arguments="--max-drift=0 -f SConstruct2 foo.out",
+ stdout = test.wrap_stdout('scons: "foo.out" is up to date.\n'))
test.pass_test()
""")
test.run(arguments='-f SConstruct1',
- stdout = "",
+ stdout = "scons: Reading SConscript files ...\n",
stderr = """ File "SConstruct1", line 2
a ! x
""")
test.run(arguments='-f SConstruct2',
- stdout = "",
+ stdout = "scons: Reading SConscript files ...\n",
stderr = """
SCons error: Depends\(\) require both sources and targets.
File "SConstruct2", line 4, in \?
""")
test.run(arguments='-f SConstruct3',
- stdout = "other errors\n",
+ stdout = "scons: Reading SConscript files ...\nother errors\n",
stderr = r"""Traceback \((most recent call|innermost) last\):
File ".+", line \d+, in .+
File ".+", line \d+, in .+
"""
-expected_output = """scons: "." is up to date.
-running x3('no kwd args', kwd=None)
+expected_output = test.wrap_stdout('scons: "." is up to date.\n') + \
+"""running x3('no kwd args', kwd=None)
running x3(5, kwd='bar')
running x2(12)
running x1
test.write('f1.in', "f1.in\n")
test.write('f2.in', "f2.in\n")
-expect = "%s build.py -f1.out\n%s build.py -f2.out\n" % (python, python)
+expect = test.wrap_stdout("%s build.py -f1.out\n%s build.py -f2.out\n" % (python, python))
test.run(arguments = '-- -f1.out -f2.out', stdout = expect)
""")
test.run(arguments = '-C sub .',
- stdout = '%s\nscons: "." is up to date.\n' % wpath)
+ stdout = test.wrap_stdout(read_str = '%s\n' % wpath,
+ build_str = 'scons: "." is up to date.\n'))
test.run(arguments = '-C sub -C dir .',
- stdout = '%s\nscons: "." is up to date.\n' % wpath_sub)
+ stdout = test.wrap_stdout(read_str = '%s\n' % wpath_sub,
+ build_str = 'scons: "." is up to date.\n'))
test.run(arguments = ".",
- stdout = 'SConstruct %s\nscons: "." is up to date.\n' % wpath)
+ stdout = test.wrap_stdout(read_str = 'SConstruct %s\n' % wpath,
+ build_str = 'scons: "." is up to date.\n'))
test.run(arguments = '--directory=sub/dir .',
- stdout = '%s\nscons: "." is up to date.\n' % wpath_sub)
+ stdout = test.wrap_stdout(read_str = '%s\n' % wpath_sub,
+ build_str = 'scons: "." is up to date.\n'))
test.run(arguments = '-C %s -C %s .' % (wpath_sub_dir, wpath_sub),
- stdout = '%s\nscons: "." is up to date.\n' % wpath)
+ stdout = test.wrap_stdout(read_str = '%s\n' % wpath,
+ build_str = 'scons: "." is up to date.\n'))
test.pass_test()
""")
test.run(arguments = '-I sub1 -I sub2 .',
- stdout = 'sub1/foo\nsub2/bar\nscons: "." is up to date.\n')
+ stdout = test.wrap_stdout(read_str = 'sub1/foo\nsub2/bar\n',
+ build_str = 'scons: "." is up to date.\n'))
test.run(arguments = '--include-dir=sub2 --include-dir=sub1 .',
- stdout = 'sub2/foo\nsub2/bar\nscons: "." is up to date.\n')
+ stdout = test.wrap_stdout(read_str = 'sub2/foo\nsub2/bar\n',
+ build_str = 'scons: "." is up to date.\n'))
test.pass_test()
test.run(arguments = 'f1.out')
-test.run(arguments = 'f1.out f2.out', stdout =
+test.run(arguments = 'f1.out f2.out',
+ stdout = test.wrap_stdout(
"""scons: "f1.out" is up to date.
%s build.py f2.out f2.in
-""" % python)
+""" % python))
atime = os.path.getatime(test.workpath('f1.in'))
mtime = os.path.getmtime(test.workpath('f1.in'))
-test.run(arguments = '--max-drift=0 f1.out f2.out', stdout =
+test.run(arguments = '--max-drift=0 f1.out f2.out',
+ stdout = test.wrap_stdout(
"""scons: "f1.out" is up to date.
scons: "f2.out" is up to date.
-""")
+"""))
test.write('f1.in', "f1.in delta\n")
os.utime(test.workpath('f1.in'), (atime,mtime))
-test.run(arguments = '--max-drift=0 f1.out f2.out', stdout =
+test.run(arguments = '--max-drift=0 f1.out f2.out',
+ stdout = test.wrap_stdout(
"""scons: "f1.out" is up to date.
scons: "f2.out" is up to date.
-""")
+"""))
-test.run(arguments = '--max-drift=-1 f1.out f2.out', stdout =
+test.run(arguments = '--max-drift=-1 f1.out f2.out',
+ stdout = test.wrap_stdout(
"""%s build.py f1.out f1.in
scons: "f2.out" is up to date.
-"""%python)
+""" % python))
test.pass_test()
test.fail_test(test.read(test.workpath('foo2.out')) != "foo2.in\n")
test.fail_test(test.read(test.workpath('foo3.out')) != "foo3.in\n")
-test.run(arguments = '-c foo1.out', stdout = "Removed foo1.out\n")
+test.run(arguments = '-c foo1.out',
+ stdout = test.wrap_stdout("Removed foo1.out\n"))
test.fail_test(os.path.exists(test.workpath('foo1.out')))
test.fail_test(not os.path.exists(test.workpath('foo2.xxx')))
test.fail_test(not os.path.exists(test.workpath('foo2.out')))
test.fail_test(not os.path.exists(test.workpath('foo3.out')))
-test.run(arguments = '--clean foo2.out foo2.xxx', stdout = "Removed foo2.xxx\nRemoved foo2.out\n")
+test.run(arguments = '--clean foo2.out foo2.xxx',
+ stdout = test.wrap_stdout("Removed foo2.xxx\nRemoved foo2.out\n"))
test.fail_test(os.path.exists(test.workpath('foo1.out')))
test.fail_test(os.path.exists(test.workpath('foo2.xxx')))
test.fail_test(os.path.exists(test.workpath('foo2.out')))
test.fail_test(not os.path.exists(test.workpath('foo3.out')))
-test.run(arguments = '--remove foo3.out', stdout = "Removed foo3.out\n")
+test.run(arguments = '--remove foo3.out',
+ stdout = test.wrap_stdout("Removed foo3.out\n"))
test.fail_test(os.path.exists(test.workpath('foo1.out')))
test.fail_test(os.path.exists(test.workpath('foo2.xxx')))
test.fail_test(test.read(test.workpath('foo2.out')) != "foo2.in\n")
test.fail_test(test.read(test.workpath('foo3.out')) != "foo3.in\n")
-test.run(arguments = '-c foo2.xxx', stdout = "Removed foo2.xxx\n")
+test.run(arguments = '-c foo2.xxx',
+ stdout = test.wrap_stdout("Removed foo2.xxx\n"))
test.fail_test(test.read(test.workpath('foo1.out')) != "foo1.in\n")
test.fail_test(os.path.exists(test.workpath('foo2.xxx')))
test.fail_test(test.read(test.workpath('foo3.out')) != "foo3.in\n")
test.run(arguments = '-c .',
- stdout = "Removed foo1.out\nRemoved foo2.out\nRemoved foo3.out\n")
+ stdout = test.wrap_stdout("Removed foo1.out\nRemoved foo2.out\nRemoved foo3.out\n"))
test.fail_test(os.path.exists(test.workpath('foo1.out')))
test.fail_test(os.path.exists(test.workpath('foo2.out')))
test.run(arguments = 'foo1.out foo2.out foo3.out')
-expect = """Removed foo1.out
+expect = test.wrap_stdout("""Removed foo1.out
Removed foo2.xxx
Removed foo2.out
Removed foo3.out
-"""
+""")
test.run(arguments = '-c -n foo1.out foo2.out foo3.out', stdout = expect)
f = open(test.workpath('foo1.out'))
test.run(arguments = '-c foo1.out',
- stdout = "scons: Could not remove 'foo1.out': Permission denied\n")
+ stdout = test.wrap_stdout("scons: Could not remove 'foo1.out': Permission denied\n"))
test.fail_test(not os.path.exists(test.workpath('foo1.out')))
wpath = test.workpath()
test.run(arguments = '-f SConscript .',
- stdout = 'SConscript %s\nscons: "." is up to date.\n' % wpath)
-
+ stdout = test.wrap_stdout(read_str = 'SConscript %s\n' % wpath,
+ build_str = 'scons: "." is up to date.\n'))
test.run(arguments = '-f %s .' % subdir_BuildThis,
- stdout = 'subdir/BuildThis %s\nscons: "." is up to date.\n' % wpath)
+ stdout = test.wrap_stdout(read_str = 'subdir/BuildThis %s\n' % wpath,
+ build_str = 'scons: "." is up to date.\n'))
test.run(arguments = '--file=SConscript .',
- stdout = 'SConscript %s\nscons: "." is up to date.\n' % wpath)
+ stdout = test.wrap_stdout(read_str = 'SConscript %s\n' % wpath,
+ build_str = 'scons: "." is up to date.\n'))
test.run(arguments = '--file=%s .' % subdir_BuildThis,
- stdout = 'subdir/BuildThis %s\nscons: "." is up to date.\n' % wpath)
+ stdout = test.wrap_stdout(read_str = 'subdir/BuildThis %s\n' % wpath,
+ build_str = 'scons: "." is up to date.\n'))
test.run(arguments = '--makefile=SConscript .',
- stdout = 'SConscript %s\nscons: "." is up to date.\n' % wpath)
+ stdout = test.wrap_stdout(read_str = 'SConscript %s\n' % wpath,
+ build_str = 'scons: "." is up to date.\n'))
test.run(arguments = '--makefile=%s .' % subdir_BuildThis,
- stdout = 'subdir/BuildThis %s\nscons: "." is up to date.\n' % wpath)
+ stdout = test.wrap_stdout(read_str = 'subdir/BuildThis %s\n' % wpath,
+ build_str = 'scons: "." is up to date.\n'))
test.run(arguments = '--sconstruct=SConscript .',
- stdout = 'SConscript %s\nscons: "." is up to date.\n' % wpath)
+ stdout = test.wrap_stdout(read_str = 'SConscript %s\n' % wpath,
+ build_str = 'scons: "." is up to date.\n'))
test.run(arguments = '--sconstruct=%s .' % subdir_BuildThis,
- stdout = 'subdir/BuildThis %s\nscons: "." is up to date.\n' % wpath)
+ stdout = test.wrap_stdout(read_str = 'subdir/BuildThis %s\n' % wpath,
+ build_str = 'scons: "." is up to date.\n'))
test.run(arguments = '-f - .', stdin = """
import os
print "STDIN " + os.getcwd()
""",
- stdout = 'STDIN %s\nscons: "." is up to date.\n' % wpath)
+ stdout = test.wrap_stdout(read_str = 'STDIN %s\n' % wpath,
+ build_str = 'scons: "." is up to date.\n'))
test.run(arguments = '-f no_such_file .',
- stdout = 'scons: "." is up to date.\n',
- stderr = "Ignoring missing SConscript 'no_such_file'\n")
+ stdout = test.wrap_stdout('scons: "." is up to date.\n'),
+ stderr = "Ignoring missing SConscript 'no_such_file'\n")
test.pass_test()
test.write('f2.in', "f2.in\n")
args = 'f1.out f2.out'
-expect = "%s build.py f1.out\n%s build.py f2.out\n" % (python, python)
+expect = test.wrap_stdout("%s build.py f1.out\n%s build.py f2.out\n" % (python, python))
test.run(arguments = args, stdout = expect)
test.fail_test(not os.path.exists(test.workpath('f1.out')))
test.fail_test(not os.path.exists(test.workpath('f1.out')))
test.fail_test(not os.path.exists(test.workpath('f2.out')))
-expect = "Removed f1.out\nRemoved f2.out\n"
+expect = test.wrap_stdout("Removed f1.out\nRemoved f2.out\n")
test.run(arguments = '-n -c ' + args, stdout = expect)
test.write('f1.in', "f1.in\n")
test.write('f2.in', "f2.in\n")
-test.run(arguments = '-s f1.out f2.out', stdout = "")
+test.run(arguments = '-s f1.out f2.out', stdout = test.wrap_stdout(""))
test.fail_test(not os.path.exists(test.workpath('f1.out')))
test.fail_test(not os.path.exists(test.workpath('f2.out')))
test.unlink('f1.out')
test.unlink('f2.out')
-test.run(arguments = '--silent f1.out f2.out', stdout = "")
+test.run(arguments = '--silent f1.out f2.out', stdout = test.wrap_stdout(""))
test.fail_test(not os.path.exists(test.workpath('f1.out')))
test.fail_test(not os.path.exists(test.workpath('f2.out')))
test.unlink('f1.out')
test.unlink('f2.out')
-test.run(arguments = '--quiet f1.out f2.out', stdout = "")
+test.run(arguments = '--quiet f1.out f2.out', stdout = test.wrap_stdout(""))
test.fail_test(not os.path.exists(test.workpath('f1.out')))
test.fail_test(not os.path.exists(test.workpath('f2.out')))
test.fail_test(test.read('aaa.out') != "aaa.in\n")
#
-test.run(arguments = "aaa.in", stdout = "")
+test.run(arguments = "aaa.in", stdout = test.wrap_stdout(""))
test.fail_test(not os.path.exists('aaa.in'))
Default(f3)
""")
-test.run(arguments = '.', stdout = """create file2.s from file1.s
+test.run(arguments = '.',
+ stdout = test.wrap_stdout("""create file2.s from file1.s
create file3.s from file2.s
create file4.s from file3.s
-""")
+"""))
test.write('file1.s', 'file1.s\n')
-test.run(arguments = '.', stdout = """scanning file1.s for file2.s
+test.run(arguments = '.',
+ stdout = test.wrap_stdout("""scanning file1.s for file2.s
create file2.s from file1.s
scanning file1.s for file2.s
create file3.s from file2.s
create file4.s from file3.s
-""")
+"""))
test.write('file2.s', 'file2.s\n')
-test.run(arguments = '.', stdout = """scanning file1.s for file2.s
+test.run(arguments = '.',
+ stdout = test.wrap_stdout("""scanning file1.s for file2.s
scanning file2.s for file3.s
create file3.s from file2.s
scanning file2.s for file3.s
create file4.s from file3.s
-""")
+"""))
test.write('file3.s', 'file3.s\n')
-test.run(arguments = '.', stdout = """scanning file1.s for file2.s
+test.run(arguments = '.',
+ stdout = test.wrap_stdout("""scanning file1.s for file2.s
scanning file2.s for file3.s
scanning file3.s for file4.s
create file4.s from file3.s
-""")
+"""))
test.pass_test()
.*
'''
-stdout = '''foo.in->sub1.foo.out
-'''
+stdout = test.wrap_stdout('foo.in->sub1.foo.out\n')
test.write(sub1__sconsign, 'garbage')
test.run(arguments = '.', stderr=stderr, stdout=stdout)
test.run(arguments = 'f1.out f3.out')
-test.run(arguments = 'f1.out f2.out f3.out f4.out', stdout =
-"""scons: "f1.out" is up to date.
-scons: "f3.out" is up to date.
-""")
+test.run(arguments = 'f1.out f2.out f3.out f4.out',
+ stdout = test.wrap_stdout('scons: "f1.out" is up to date.\nscons: "f3.out" is up to date.\n'))
os.utime(test.workpath('f1.in'),
(os.path.getatime(test.workpath('f1.in')),
(os.path.getatime(test.workpath('f3.in')),
os.path.getmtime(test.workpath('f3.in'))+10))
-test.run(arguments = 'f1.out f2.out f3.out f4.out', stdout =
-"""scons: "f2.out" is up to date.
-scons: "f4.out" is up to date.
-""")
+test.run(arguments = 'f1.out f2.out f3.out f4.out',
+ stdout = test.wrap_stdout('scons: "f2.out" is up to date.\nscons: "f4.out" is up to date.\n'))
test.pass_test()
test.run(arguments = 'f1.out f3.out')
test.run(arguments = 'f1.out f2.out f3.out f4.out', stdout =
-"""scons: "f1.out" is up to date.
+test.wrap_stdout("""scons: "f1.out" is up to date.
%s build.py f2.out f2.in
scons: "f3.out" is up to date.
%s build.py f4.out f4.in
-""" % (python, python))
+""" % (python, python)))
test.pass_test()