Add output to tell people when we're reading SConscript files versus when we're build...
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Mon, 30 Sep 2002 16:53:47 +0000 (16:53 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Mon, 30 Sep 2002 16:53:47 +0000 (16:53 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@471 fdb21ef1-2011-0410-befe-b5e4ea1792b1

34 files changed:
etc/TestSCons.py
src/CHANGES.txt
src/engine/SCons/Script/SConscript.py
src/engine/SCons/Script/__init__.py
test/Alias.py
test/FindFile.py
test/Help.py
test/Options.py
test/Platform.py
test/SCONSFLAGS.py
test/SConscript.py
test/SConstruct.py
test/Scanner.py
test/SetBuildSignatureType.py
test/SideEffect.py
test/Split.py
test/WhereIs.py
test/build-errors.py
test/chained-build.py
test/errors.py
test/exitfns.py
test/option--.py
test/option--C.py
test/option--I.py
test/option--max-drift.py
test/option-c.py
test/option-f.py
test/option-n.py
test/option-s.py
test/preserve-source.py
test/scan-once.py
test/sconsign.py
test/timestamp-fallback.py
test/up-to-date.py

index 1caef4f72a2effcaa138f6bda501d19da9237cf5..5d4d4a09a64589d88c3018f729ffb399e40c634f 100644 (file)
@@ -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)
index 86737fc34b83e93d553eb1fe70646ec7754aa863..3ad1fc7dfaf250e0d1854a095f91341c7841c2db 100644 (file)
@@ -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.
index a8ce5d78c1c998c4a10b2988160484cb38ca93df..9ecd3d7847be3788a9be9d91300e6b38a009f71b 100644 (file)
@@ -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)
index f0ac0398330ed4541feeeb42dc8a6e4284682657..9fd1327f4b2c43e1fa30771b187f095b38d83979 100644 (file)
@@ -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():
index ca9075f0036122d52bf8a5d202fae4387392ef15..97586937c8f21b88ba2645d60f46947773db6ea5 100644 (file)
@@ -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')
 
index 6123c5ad414cb29b2a05792799e373794b4862a7..2d680f865ba27ba1b8604d06ec5a9b7e597f6472 100644 (file)
@@ -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)
 
index 03ca2a97ee19efa5e398f01846cc93b23180bf09..93ec491289c4ab803ca537b34019c9062caccb23 100644 (file)
@@ -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)
 
index 2b2d5a2f4254cdf639dd6d00fb5791afa5926181..b431d8806080368c112ce3159314d7ccea97254c 100644 (file)
@@ -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()
index c2a113ada34c373c4debae90de64ee6de7e3b2c5..34f1b5250227fd8860a7d24a153abb7085bc99e2 100644 (file)
@@ -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)
 
index 86f424686f280da41bcb718053120e7d9a6228a1..f8d757ad1dfe8a5e354cd39b51ce67d5c9b6fa85 100644 (file)
@@ -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'] = ''
 
index 6f87a9ad46de949718d6d14571ab178fb9b518d5..083dbe50fbe62670c5b8b6dffad33ccd2756a57c 100644 (file)
@@ -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()
index bf35edce0c4246451b7245726ad19d040c366a52..48f2642a9a8b1e964056ce969656541197967a76 100644 (file)
@@ -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()
index dbaa8b557064b9768000298c3ad1412d617696de..96088994ee9d914c724e9203e8105cc90fa48b2b 100644 (file)
@@ -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()
index 39534dd57132826df7d600c1f4e20992f8d64d0f..b9dd0809d2e488a9598ceeb29723508bdd4170cf 100644 (file)
@@ -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()
index 7d379478227ad601c7e945748a4708e7a10ae22f..6e37420335e2a8a330acd3dd2ace503519a9a58d 100644 (file)
@@ -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
index 5207d8de309785a88051ee9a9be7126ff36c90a3..8fce0df820eca4cdb5675c1a1672813bf85de100 100644 (file)
@@ -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()
index f8c7b944802bb2adaa6f5b0eaba8e992bb098796..f052909581c87999090ac1940f00251158cbb22f 100644 (file)
@@ -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()
index 956842efba4430fb712853b0b03816a521a9b296..94f882094d25f569417c3920470a11f91e5d9fdd 100644 (file)
@@ -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)
 
index 1a7daf915ec8dc28357fca5c8431da8a473f9f1a..94277fd4cfd453cf60b930d53e3cf1802636328b 100644 (file)
@@ -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()
index 0f83e6479d2ac42ba509f0da8cc7bbe3c83f6da3..979c6e11368700be8117d5b3fcf0b44e769e80aa 100644 (file)
@@ -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 .+
index 8a9e01ebd3fbe7c43c016fc08e3a5659f0f0f3aa..c8663bc8cb1f33bd24f82d7334449b234ab60611 100644 (file)
@@ -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
index 6a18cf51f518b23060722ecb9d84c15d9c6be4b0..039ce3a7a33cbd225486cedfff7469afd2965e84 100644 (file)
@@ -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)
 
index 5bbbd31ab0494c7b9e941afd1e71f124a8076963..dc39a9b2f59a8c88a467aaa2ed5d9b086f4e6b43 100644 (file)
@@ -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()
  
index b315a60fbdd095a8d0a4b2c86dbbcd8ed327b91e..5cc2be34f944fa2cf5942497bfd3f55df9169255 100644 (file)
@@ -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()
  
index facaecae0d0b63b1084758daf3e28673b4680d09..fb289ebc7aaf3f116e0031eb24e3775685d2da24 100644 (file)
@@ -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()
 
index 6bb25daa159f4f4a0339ee46e097b0b48142bdd0..060ebfb1bfef7c7eddf32b06c5da446e0a83755a 100644 (file)
@@ -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')))
 
index 30c49bbdb0e35b4773b5c520013357c14f5463f6..cda5ab8670a9c16b6f10aed1aabe0ee84bf6ba02 100644 (file)
@@ -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()
index 7c796dfb70fc84e343dbff1aa941ef5624a271ac..0fed3d00cbfcaa3ad511314f2b3cffd8dfa2c15f 100644 (file)
@@ -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)
 
index 450e994ac0d93be30b1bc70921486814345d38af..67155d47a96074c86131bd8b3415ef970dfeb58c 100644 (file)
@@ -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')))
 
index 4ca9cd600302102876b1e8f286365f38f265ad81..b0acdaa0fba0ad28a2a36d99f8c226d9c148c4ed 100644 (file)
@@ -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'))
 
index 76c3451d140553bee57365bc7f3a9c552c9abd64..7ddf9c9d2bd296e24d01039ef793d4862425ebcd 100644 (file)
@@ -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()
index 57906af42a04bd82d889b8dc1e231188c2fbe8be..6da67177e4b686e20b527edace7c12072c9f7909 100644 (file)
@@ -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)
index f284afe5942f7997d9ed9737e055c14dcc3b7634..749ee5b1027212d6048876004ce08d54fb874cea 100644 (file)
@@ -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()
index 3db10476304a2847b078fc6b05e856a115f29509..ab5e6075e815be79cceae510ef811657cd549e6a 100644 (file)
@@ -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()