summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2002-09-30 16:53:47 (GMT)
committerSteven Knight <knight@baldmt.com>2002-09-30 16:53:47 (GMT)
commit752502105f63c91ee1f87cc35b83634c6bc42c3b (patch)
tree0b603afdbd7d32b8aa3e7482dc72badf69345874
parentf6141b3f503c8f78fca191bfd59d9785cd81bf10 (diff)
downloadSCons-752502105f63c91ee1f87cc35b83634c6bc42c3b.zip
SCons-752502105f63c91ee1f87cc35b83634c6bc42c3b.tar.gz
SCons-752502105f63c91ee1f87cc35b83634c6bc42c3b.tar.bz2
Add output to tell people when we're reading SConscript files versus when we're building targets.
-rw-r--r--etc/TestSCons.py45
-rw-r--r--src/CHANGES.txt4
-rw-r--r--src/engine/SCons/Script/SConscript.py11
-rw-r--r--src/engine/SCons/Script/__init__.py32
-rw-r--r--test/Alias.py10
-rw-r--r--test/FindFile.py5
-rw-r--r--test/Help.py8
-rw-r--r--test/Options.py12
-rw-r--r--test/Platform.py5
-rw-r--r--test/SCONSFLAGS.py7
-rw-r--r--test/SConscript.py3
-rw-r--r--test/SConstruct.py12
-rw-r--r--test/Scanner.py3
-rw-r--r--test/SetBuildSignatureType.py15
-rw-r--r--test/SideEffect.py16
-rw-r--r--test/Split.py5
-rw-r--r--test/WhereIs.py10
-rw-r--r--test/build-errors.py6
-rw-r--r--test/chained-build.py24
-rw-r--r--test/errors.py6
-rw-r--r--test/exitfns.py4
-rw-r--r--test/option--.py2
-rw-r--r--test/option--C.py15
-rw-r--r--test/option--I.py6
-rw-r--r--test/option--max-drift.py20
-rw-r--r--test/option-c.py20
-rw-r--r--test/option-f.py32
-rw-r--r--test/option-n.py4
-rw-r--r--test/option-s.py6
-rw-r--r--test/preserve-source.py2
-rw-r--r--test/scan-once.py20
-rw-r--r--test/sconsign.py3
-rw-r--r--test/timestamp-fallback.py12
-rw-r--r--test/up-to-date.py4
34 files changed, 237 insertions, 152 deletions
diff --git a/etc/TestSCons.py b/etc/TestSCons.py
index 1caef4f..5d4d4a0 100644
--- a/etc/TestSCons.py
+++ b/etc/TestSCons.py
@@ -133,15 +133,15 @@ class TestSCons(TestCmd.TestCmd):
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()
@@ -151,12 +151,23 @@ class TestSCons(TestCmd.TestCmd):
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)
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 86737fc..3ad1fc7 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -41,6 +41,10 @@ RELEASE 0.09 -
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.
diff --git a/src/engine/SCons/Script/SConscript.py b/src/engine/SCons/Script/SConscript.py
index a8ce5d7..9ecd3d7 100644
--- a/src/engine/SCons/Script/SConscript.py
+++ b/src/engine/SCons/Script/SConscript.py
@@ -1,4 +1,4 @@
-"""engine.SCons.SConscript
+"""SCons.Script.SConscript
This module defines the Python API provided to SConscript and SConstruct
files.
@@ -47,8 +47,10 @@ import os.path
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)
@@ -216,10 +218,7 @@ def Local(*targets):
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)
diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py
index f0ac039..9fd1327 100644
--- a/src/engine/SCons/Script/__init__.py
+++ b/src/engine/SCons/Script/__init__.py
@@ -1,4 +1,4 @@
-"""engine.SCons.script
+"""SCons.Script
This file implements the main() function used by the scons script.
@@ -179,6 +179,9 @@ profiling = 0
max_drift = None
repositories = []
+# Exceptions for this module
+class PrintHelp(Exception):
+ pass
# utility functions
@@ -503,9 +506,11 @@ def options_init():
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'],
@@ -939,11 +944,20 @@ def _main():
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)
@@ -1011,6 +1025,7 @@ def _main():
calc = SCons.Sig.default_calc
+ print "scons: Building targets ..."
taskmaster = SCons.Taskmaster.Taskmaster(nodes, task_class, calc)
jobs = SCons.Job.Jobs(num_jobs, taskmaster)
@@ -1018,6 +1033,7 @@ def _main():
try:
jobs.run()
finally:
+ print "scons: done building targets."
SCons.Sig.write()
def main():
diff --git a/test/Alias.py b/test/Alias.py
index ca9075f..9758693 100644
--- a/test/Alias.py
+++ b/test/Alias.py
@@ -120,9 +120,8 @@ test.fail_test(not os.path.exists(test.workpath('f3.out')))
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')
@@ -151,9 +150,8 @@ test.fail_test(not os.path.exists(test.workpath('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')
diff --git a/test/FindFile.py b/test/FindFile.py
index 6123c5a..2d680f8 100644
--- a/test/FindFile.py
+++ b/test/FindFile.py
@@ -48,7 +48,7 @@ file4 = FindFile('testfile2', [ 'bar/baz', 'foo', '.', 'bar' ])
print open(str(file4), 'r').read()
""")
-expect = """test 1
+expect = test.wrap_stdout(read_str = """test 1
test 3
@@ -56,8 +56,7 @@ test 2
test 4
-scons: "." is up to date.
-"""
+""", build_str = 'scons: "." is up to date.\n')
test.run(arguments = ".", stdout = expect)
diff --git a/test/Help.py b/test/Help.py
index 03ca2a9..93ec491 100644
--- a/test/Help.py
+++ b/test/Help.py
@@ -34,7 +34,13 @@ test.write('SConstruct', r"""
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)
diff --git a/test/Options.py b/test/Options.py
index 2b2d5a2..b431d88 100644
--- a/test/Options.py
+++ b/test/Options.py
@@ -36,7 +36,7 @@ print env['CCFLAGS']
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')
@@ -77,7 +77,7 @@ Default(env.Alias('dummy'))
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'])
@@ -102,8 +102,10 @@ check(['1', '0', cc, ccflags + ' -O'])
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
@@ -118,6 +120,6 @@ CC: The C compiler
actual: %s
Use scons -H for help about command-line options.
-"""%cc
+"""%cc)
test.pass_test()
diff --git a/test/Platform.py b/test/Platform.py
index c2a113a..34f1b52 100644
--- a/test/Platform.py
+++ b/test/Platform.py
@@ -53,7 +53,7 @@ Platform('win32')(env)
print "'%s'" % env['LIBSUFFIX']
""")
-expect = """'.exe'
+expect = test.wrap_stdout(read_str = """'.exe'
'.exe'
''
'.exe'
@@ -61,8 +61,7 @@ expect = """'.exe'
'.lib'
'.a'
'.lib'
-scons: "." is up to date.
-"""
+""", build_str = 'scons: "." is up to date.\n')
test.run(arguments = ".", stdout = expect)
diff --git a/test/SCONSFLAGS.py b/test/SCONSFLAGS.py
index 86f4246..f8d757a 100644
--- a/test/SCONSFLAGS.py
+++ b/test/SCONSFLAGS.py
@@ -37,7 +37,12 @@ test.write('SConstruct', r"""
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'] = ''
diff --git a/test/SConscript.py b/test/SConscript.py
index 6f87a9a..083dbe5 100644
--- a/test/SConscript.py
+++ b/test/SConscript.py
@@ -209,7 +209,8 @@ Return("result")
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()
diff --git a/test/SConstruct.py b/test/SConstruct.py
index bf35edc..48f2642 100644
--- a/test/SConstruct.py
+++ b/test/SConstruct.py
@@ -46,7 +46,9 @@ 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.write('Sconstruct', """
@@ -54,13 +56,17 @@ 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.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()
diff --git a/test/Scanner.py b/test/Scanner.py
index dbaa8b5..9608899 100644
--- a/test/Scanner.py
+++ b/test/Scanner.py
@@ -132,6 +132,7 @@ test.fail_test(test.read('foo') != "foo.k 1 line 1\nxxx 2\nyyy 2\nfoo.k 1 line 4
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()
diff --git a/test/SetBuildSignatureType.py b/test/SetBuildSignatureType.py
index 39534dd..b9dd080 100644
--- a/test/SetBuildSignatureType.py
+++ b/test/SetBuildSignatureType.py
@@ -49,9 +49,11 @@ SetBuildSignatureType('content')
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()
@@ -73,7 +75,8 @@ env.Copy1('foo.out.out', 'foo.out')
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()
@@ -95,7 +98,8 @@ env.Copy1('foo.out.out', 'foo.out')
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()
@@ -116,7 +120,8 @@ env.Copy1('foo.out.out', 'foo.out')
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()
diff --git a/test/SideEffect.py b/test/SideEffect.py
index 7d37947..6e37420 100644
--- a/test/SideEffect.py
+++ b/test/SideEffect.py
@@ -54,10 +54,10 @@ test.write('foo.in', 'foo.in\n')
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
@@ -67,10 +67,10 @@ assert test.read('log.txt') == expect
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
@@ -82,10 +82,10 @@ assert test.read('log.txt') == expect
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
@@ -103,12 +103,12 @@ test.fail_test(os.path.exists(test.workpath('bar.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
diff --git a/test/Split.py b/test/Split.py
index 5207d8d..8fce0df 100644
--- a/test/Split.py
+++ b/test/Split.py
@@ -47,9 +47,10 @@ expect = """['aaa']
['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()
diff --git a/test/WhereIs.py b/test/WhereIs.py
index f8c7b94..f052909 100644
--- a/test/WhereIs.py
+++ b/test/WhereIs.py
@@ -103,10 +103,11 @@ expect = [ test.workpath(sub3_xxx_exe),
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)
@@ -120,9 +121,10 @@ expect = [ test.workpath(sub4_xxx_exe),
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()
diff --git a/test/build-errors.py b/test/build-errors.py
index 956842e..94f8820 100644
--- a/test/build-errors.py
+++ b/test/build-errors.py
@@ -47,7 +47,7 @@ env.bld(target = 'f1', source = 'f1.in')
""" % 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)
@@ -84,7 +84,7 @@ env.bld(target = 'f2', source = 'f2.in')
""" % 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)
@@ -108,7 +108,7 @@ env.bld(target = 'f3', source = 'f3.in')
""" % 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)
diff --git a/test/chained-build.py b/test/chained-build.py
index 1a7daf9..94277fd 100644
--- a/test/chained-build.py
+++ b/test/chained-build.py
@@ -48,18 +48,26 @@ env.B('foo.out', 'foo.mid')
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()
diff --git a/test/errors.py b/test/errors.py
index 0f83e64..979c6e1 100644
--- a/test/errors.py
+++ b/test/errors.py
@@ -71,7 +71,7 @@ a ! x
""")
test.run(arguments='-f SConstruct1',
- stdout = "",
+ stdout = "scons: Reading SConscript files ...\n",
stderr = """ File "SConstruct1", line 2
a ! x
@@ -90,7 +90,7 @@ raise SCons.Errors.UserError, 'Depends() require both sources and targets.'
""")
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 \?
@@ -103,7 +103,7 @@ raise InternalError, 'error inside'
""")
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 .+
diff --git a/test/exitfns.py b/test/exitfns.py
index 8a9e01e..c8663bc 100644
--- a/test/exitfns.py
+++ b/test/exitfns.py
@@ -46,8 +46,8 @@ register(x3, "no kwd args")
"""
-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
diff --git a/test/option--.py b/test/option--.py
index 6a18cf5..039ce3a 100644
--- a/test/option--.py
+++ b/test/option--.py
@@ -50,7 +50,7 @@ env.MyBuild(target = '-f2.out', source = 'f2.in')
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)
diff --git a/test/option--C.py b/test/option--C.py
index 5bbbd31..dc39a9b 100644
--- a/test/option--C.py
+++ b/test/option--C.py
@@ -66,19 +66,24 @@ print GetBuildPath('..')
""")
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()
diff --git a/test/option--I.py b/test/option--I.py
index b315a60..5cc2be3 100644
--- a/test/option--I.py
+++ b/test/option--I.py
@@ -52,10 +52,12 @@ print bar.variable
""")
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()
diff --git a/test/option--max-drift.py b/test/option--max-drift.py
index facaeca..fb289eb 100644
--- a/test/option--max-drift.py
+++ b/test/option--max-drift.py
@@ -58,31 +58,35 @@ test.write('f2.in', "f2.in\n")
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()
diff --git a/test/option-c.py b/test/option-c.py
index 6bb25da..060ebfb 100644
--- a/test/option-c.py
+++ b/test/option-c.py
@@ -62,21 +62,24 @@ test.fail_test(test.read(test.workpath('foo2.xxx')) != "foo2.in\n")
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')))
@@ -90,7 +93,8 @@ test.fail_test(test.read(test.workpath('foo2.xxx')) != "foo2.in\n")
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')))
@@ -98,7 +102,7 @@ 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 .',
- 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')))
@@ -106,11 +110,11 @@ test.fail_test(os.path.exists(test.workpath('foo3.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)
@@ -125,7 +129,7 @@ test.writable('.', 0)
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')))
diff --git a/test/option-f.py b/test/option-f.py
index 30c49bb..cda5ab8 100644
--- a/test/option-f.py
+++ b/test/option-f.py
@@ -46,38 +46,46 @@ print "subdir/BuildThis", os.getcwd()
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()
diff --git a/test/option-n.py b/test/option-n.py
index 7c796df..0fed3d0 100644
--- a/test/option-n.py
+++ b/test/option-n.py
@@ -51,7 +51,7 @@ test.write('f1.in', "f1.in\n")
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')))
@@ -84,7 +84,7 @@ test.run(arguments = args)
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)
diff --git a/test/option-s.py b/test/option-s.py
index 450e994..67155d4 100644
--- a/test/option-s.py
+++ b/test/option-s.py
@@ -50,21 +50,21 @@ env.MyBuild(target = 'f2.out', source = 'f2.in')
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')))
diff --git a/test/preserve-source.py b/test/preserve-source.py
index 4ca9cd6..b0acdaa 100644
--- a/test/preserve-source.py
+++ b/test/preserve-source.py
@@ -53,7 +53,7 @@ test.run(arguments = '.')
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'))
diff --git a/test/scan-once.py b/test/scan-once.py
index 76c3451..7ddf9c9 100644
--- a/test/scan-once.py
+++ b/test/scan-once.py
@@ -60,35 +60,39 @@ f3 = env.Echo(source=['file3'], target=['file4'])
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()
diff --git a/test/sconsign.py b/test/sconsign.py
index 57906af..6da6717 100644
--- a/test/sconsign.py
+++ b/test/sconsign.py
@@ -87,8 +87,7 @@ SCons warning: Ignoring corrupt .sconsign file: sub1..sconsign
.*
'''
-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)
diff --git a/test/timestamp-fallback.py b/test/timestamp-fallback.py
index f284afe..749ee5b 100644
--- a/test/timestamp-fallback.py
+++ b/test/timestamp-fallback.py
@@ -66,10 +66,8 @@ test.write('f4.in', "f4.in\n")
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')),
@@ -78,10 +76,8 @@ os.utime(test.workpath('f3.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()
diff --git a/test/up-to-date.py b/test/up-to-date.py
index 3db1047..ab5e607 100644
--- a/test/up-to-date.py
+++ b/test/up-to-date.py
@@ -58,11 +58,11 @@ test.write('f4.in', "f4.in\n")
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()