diff options
-rw-r--r-- | etc/TestCmd.py | 964 | ||||
-rw-r--r-- | src/CHANGES.txt | 4 | ||||
-rw-r--r-- | src/engine/SCons/Errors.py | 7 | ||||
-rw-r--r-- | src/engine/SCons/ErrorsTests.py | 9 | ||||
-rw-r--r-- | src/engine/SCons/Script/SConscript.py | 26 | ||||
-rw-r--r-- | src/engine/SCons/Script/__init__.py | 53 | ||||
-rw-r--r-- | src/engine/SCons/Taskmaster.py | 27 | ||||
-rw-r--r-- | src/engine/SCons/TaskmasterTests.py | 30 | ||||
-rw-r--r-- | test/BuildDir-errors.py | 14 | ||||
-rw-r--r-- | test/Scanner-exception.py | 8 | ||||
-rw-r--r-- | test/SharedLibrary.py | 2 | ||||
-rw-r--r-- | test/errors.py | 83 |
12 files changed, 775 insertions, 452 deletions
diff --git a/etc/TestCmd.py b/etc/TestCmd.py index 6d6db73..1b78739 100644 --- a/etc/TestCmd.py +++ b/etc/TestCmd.py @@ -5,27 +5,158 @@ The TestCmd module provides a framework for portable automated testing of executable commands and scripts (in any language, not just Python), especially commands and scripts that require file system interaction. -In addition to running tests and evaluating conditions, the TestCmd module -manages and cleans up one or more temporary workspace directories, and -provides methods for creating files and directories in those workspace -directories from in-line data, here-documents), allowing tests to be -completely self-contained. +In addition to running tests and evaluating conditions, the TestCmd +module manages and cleans up one or more temporary workspace +directories, and provides methods for creating files and directories in +those workspace directories from in-line data, here-documents), allowing +tests to be completely self-contained. A TestCmd environment object is created via the usual invocation: - test = TestCmd() + import TestCmd + test = TestCmd.TestCmd() + +There are a bunch of keyword arguments that you can use at instantiation +time: + + test = TestCmd.TestCmd(description = 'string', + program = 'program_or_script_to_test', + interpreter = 'script_interpreter', + workdir = 'prefix', + subdir = 'subdir', + verbose = Boolean, + match = default_match_function, + combine = Boolean) + +There are a bunch of methods that let you do a bunch of different +things. Here is an overview of them: + + test.verbose_set(1) + + test.description_set('string') + + test.program_set('program_or_script_to_test') + + test.interpreter_set('script_interpreter') + + test.workdir_set('prefix') + test.workdir_set('') + + test.workpath('file') + test.workpath('subdir', 'file') + + test.subdir('subdir', ...) + + test.write('file', "contents\n") + test.write(['subdir', 'file'], "contents\n") + + test.read('file') + test.read(['subdir', 'file']) + test.read('file', mode) + test.read(['subdir', 'file'], mode) + + test.writable('dir', 1) + test.writable('dir', None) + + test.preserve(condition, ...) + + test.cleanup(condition) + + test.run(program = 'program_or_script_to_run', + interpreter = 'script_interpreter', + arguments = 'arguments to pass to program', + chdir = 'directory_to_chdir_to', + stdin = 'input to feed to the program\n') + + test.pass_test() + test.pass_test(condition) + test.pass_test(condition, function) + + test.fail_test() + test.fail_test(condition) + test.fail_test(condition, function) + test.fail_test(condition, function, skip) + + test.no_result() + test.no_result(condition) + test.no_result(condition, function) + test.no_result(condition, function, skip) + + test.stdout() + test.stdout(run) + + test.stderr() + test.stderr(run) + + test.match(actual, expected) + + test.match_exact("actual 1\nactual 2\n", "expected 1\nexpected 2\n") + test.match_exact(["actual 1\n", "actual 2\n"], + ["expected 1\n", "expected 2\n"]) + + test.match_re("actual 1\nactual 2\n", regex_string) + test.match_re(["actual 1\n", "actual 2\n"], list_of_regexes) + + test.match_re_dotall("actual 1\nactual 2\n", regex_string) + test.match_re_dotall(["actual 1\n", "actual 2\n"], list_of_regexes) + + test.sleep() + test.sleep(seconds) + + test.where_is('foo') + test.where_is('foo', 'PATH1:PATH2') + test.where_is('foo', 'PATH1;PATH2', '.suffix3;.suffix4') + + test.unlink('file') + test.unlink('subdir', 'file') The TestCmd module provides pass_test(), fail_test(), and no_result() -unbound methods that report test results for use with the Aegis change +unbound functions that report test results for use with the Aegis change management system. These methods terminate the test immediately, reporting PASSED, FAILED, or NO RESULT respectively, and exiting with status 0 (success), 1 or 2 respectively. This allows for a distinction between an actual failed test and a test that could not be properly evaluated because of an external condition (such as a full file system or incorrect permissions). + + import TestCmd + + TestCmd.pass_test() + TestCmd.pass_test(condition) + TestCmd.pass_test(condition, function) + + TestCmd.fail_test() + TestCmd.fail_test(condition) + TestCmd.fail_test(condition, function) + TestCmd.fail_test(condition, function, skip) + + TestCmd.no_result() + TestCmd.no_result(condition) + TestCmd.no_result(condition, function) + TestCmd.no_result(condition, function, skip) + +The TestCmd module also provides unbound functions that handle matching +in the same way as the match_*() methods described above. + + import TestCmd + + test = TestCmd.TestCmd(match = TestCmd.match_exact) + + test = TestCmd.TestCmd(match = TestCmd.match_re) + + test = TestCmd.TestCmd(match = TestCmd.match_re_dotall) + +Lastly, the where_is() method also exists in an unbound function +version. + + import TestCmd + + TestCmd.where_is('foo') + TestCmd.where_is('foo', 'PATH1:PATH2') + TestCmd.where_is('foo', 'PATH1;PATH2', '.suffix3;.suffix4') """ -# Copyright 2000 Steven Knight +# Copyright 2000, 2001, 2002, 2003 Steven Knight # This module is free software, and you may redistribute it and/or modify # it under the same terms as Python itself, so long as this copyright message # and disclaimer are retained in their original form. @@ -41,9 +172,9 @@ or incorrect permissions). # AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -__author__ = "Steven Knight <knight@baldmt.com>" -__revision__ = "TestCmd.py 0.D002 2001/08/31 14:56:12 software" -__version__ = "0.02" +__author__ = "Steven Knight <knight at baldmt dot com>" +__revision__ = "TestCmd.py 0.04.D009 2003/07/18 17:37:29 knight" +__version__ = "0.04" import os import os.path @@ -54,8 +185,14 @@ import stat import string import sys import tempfile +import time import traceback import types +import UserList + +def is_List(e): + return type(e) is types.ListType \ + or isinstance(e, UserList.UserList) try: from UserString import UserString @@ -102,7 +239,7 @@ def _clean(): _Cleanup = [] list.reverse() for test in list: - test.cleanup() + test.cleanup() sys.exitfunc = _clean @@ -110,17 +247,17 @@ def _caller(tblist, skip): string = "" arr = [] for file, line, name, text in tblist: - if file[-10:] == "TestCmd.py": - break - arr = [(file, line, name, text)] + arr + if file[-10:] == "TestCmd.py": + break + arr = [(file, line, name, text)] + arr atfrom = "at" for file, line, name, text in arr[skip:]: - if name == "?": - name = "" - else: - name = " (" + name + ")" - string = string + ("%s line %d of %s%s\n" % (atfrom, line, file, name)) - atfrom = "\tfrom" + if name == "?": + name = "" + else: + name = " (" + name + ")" + string = string + ("%s line %d of %s%s\n" % (atfrom, line, file, name)) + atfrom = "\tfrom" return string def fail_test(self = None, condition = 1, function = None, skip = 0): @@ -131,19 +268,19 @@ def fail_test(self = None, condition = 1, function = None, skip = 0): the test fails only if the condition is true. """ if not condition: - return + return if not function is None: - function() + function() of = "" desc = "" sep = " " if not self is None: - if self.program: - of = " of " + self.program - sep = "\n\t" - if self.description: - desc = " [" + self.description + "]" - sep = "\n\t" + if self.program: + of = " of " + self.program + sep = "\n\t" + if self.description: + desc = " [" + self.description + "]" + sep = "\n\t" at = _caller(traceback.extract_stack(), skip) sys.stderr.write("FAILED test" + of + desc + sep + at) @@ -158,19 +295,19 @@ def no_result(self = None, condition = 1, function = None, skip = 0): the test fails only if the condition is true. """ if not condition: - return + return if not function is None: - function() + function() of = "" desc = "" sep = " " if not self is None: - if self.program: - of = " of " + self.program - sep = "\n\t" - if self.description: - desc = " [" + self.description + "]" - sep = "\n\t" + if self.program: + of = " of " + self.program + sep = "\n\t" + if self.description: + desc = " [" + self.description + "]" + sep = "\n\t" at = _caller(traceback.extract_stack(), skip) sys.stderr.write("NO RESULT for test" + of + desc + sep + at) @@ -185,38 +322,38 @@ def pass_test(self = None, condition = 1, function = None): the test passes only if the condition is true. """ if not condition: - return + return if not function is None: - function() + function() sys.stderr.write("PASSED\n") sys.exit(0) def match_exact(lines = None, matches = None): """ """ - if not type(lines) is types.ListType: - lines = string.split(lines, "\n") - if not type(matches) is types.ListType: - matches = string.split(matches, "\n") + if not is_List(lines): + lines = string.split(lines, "\n") + if not is_List(matches): + matches = string.split(matches, "\n") if len(lines) != len(matches): - return + return for i in range(len(lines)): - if lines[i] != matches[i]: - return + if lines[i] != matches[i]: + return return 1 def match_re(lines = None, res = None): """ """ - if not type(lines) is types.ListType: - lines = string.split(lines, "\n") - if not type(res) is types.ListType: - res = string.split(res, "\n") + if not is_List(lines): + lines = string.split(lines, "\n") + if not is_List(res): + res = string.split(res, "\n") if len(lines) != len(res): - return + return for i in range(len(lines)): - if not re.compile("^" + res[i] + "$").search(lines[i]): - return + if not re.compile("^" + res[i] + "$").search(lines[i]): + return return 1 def match_re_dotall(lines = None, res = None): @@ -239,6 +376,8 @@ else: if sys.platform == 'win32': + default_sleep_seconds = 2 + def where_is(file, path=None, pathext=None): if path is None: path = os.environ['PATH'] @@ -278,424 +417,447 @@ else: return f return None + default_sleep_seconds = 1 + class TestCmd: """Class TestCmd """ def __init__(self, description = None, - program = None, - interpreter = None, - workdir = None, - subdir = None, - verbose = 0, - match = None): - self._cwd = os.getcwd() - self.description_set(description) - self.program_set(program) - self.interpreter_set(interpreter) - self.verbose_set(verbose) - if not match is None: - self.match_func = match - else: - self.match_func = match_re - self._dirlist = [] - self._preserve = {'pass_test': 0, 'fail_test': 0, 'no_result': 0} - if os.environ.has_key('PRESERVE') and not os.environ['PRESERVE'] is '': - self._preserve['pass_test'] = os.environ['PRESERVE'] - self._preserve['fail_test'] = os.environ['PRESERVE'] - self._preserve['no_result'] = os.environ['PRESERVE'] - else: - try: - self._preserve['pass_test'] = os.environ['PRESERVE_PASS'] - except KeyError: - pass - try: - self._preserve['fail_test'] = os.environ['PRESERVE_FAIL'] - except KeyError: - pass - try: - self._preserve['no_result'] = os.environ['PRESERVE_NO_RESULT'] - except KeyError: - pass - self._stdout = [] - self._stderr = [] - self.status = None - self.condition = 'no_result' - self.workdir_set(workdir) - self.subdir(subdir) + program = None, + interpreter = None, + workdir = None, + subdir = None, + verbose = 0, + match = None, + combine = 0): + self._cwd = os.getcwd() + self.description_set(description) + self.program_set(program) + self.interpreter_set(interpreter) + self.verbose_set(verbose) + self.combine = combine + if not match is None: + self.match_func = match + else: + self.match_func = match_re + self._dirlist = [] + self._preserve = {'pass_test': 0, 'fail_test': 0, 'no_result': 0} + if os.environ.has_key('PRESERVE') and not os.environ['PRESERVE'] is '': + self._preserve['pass_test'] = os.environ['PRESERVE'] + self._preserve['fail_test'] = os.environ['PRESERVE'] + self._preserve['no_result'] = os.environ['PRESERVE'] + else: + try: + self._preserve['pass_test'] = os.environ['PRESERVE_PASS'] + except KeyError: + pass + try: + self._preserve['fail_test'] = os.environ['PRESERVE_FAIL'] + except KeyError: + pass + try: + self._preserve['no_result'] = os.environ['PRESERVE_NO_RESULT'] + except KeyError: + pass + self._stdout = [] + self._stderr = [] + self.status = None + self.condition = 'no_result' + self.workdir_set(workdir) + self.subdir(subdir) def __del__(self): - self.cleanup() + self.cleanup() def __repr__(self): - return "%x" % id(self) + return "%x" % id(self) def cleanup(self, condition = None): - """Removes any temporary working directories for the specified - TestCmd environment. If the environment variable PRESERVE was - set when the TestCmd environment was created, temporary working - directories are not removed. If any of the environment variables - PRESERVE_PASS, PRESERVE_FAIL, or PRESERVE_NO_RESULT were set - when the TestCmd environment was created, then temporary working - directories are not removed if the test passed, failed, or had - no result, respectively. Temporary working directories are also - preserved for conditions specified via the preserve method. - - Typically, this method is not called directly, but is used when - the script exits to clean up temporary working directories as - appropriate for the exit status. - """ - if not self._dirlist: - return - if condition is None: - condition = self.condition - #print "cleanup(" + condition + "): ", self._preserve - if self._preserve[condition]: - return - os.chdir(self._cwd) - self.workdir = None - list = self._dirlist[:] - self._dirlist = [] - list.reverse() - for dir in list: - self.writable(dir, 1) - shutil.rmtree(dir, ignore_errors = 1) - try: - global _Cleanup - _Cleanup.remove(self) - except (AttributeError, ValueError): - pass + """Removes any temporary working directories for the specified + TestCmd environment. If the environment variable PRESERVE was + set when the TestCmd environment was created, temporary working + directories are not removed. If any of the environment variables + PRESERVE_PASS, PRESERVE_FAIL, or PRESERVE_NO_RESULT were set + when the TestCmd environment was created, then temporary working + directories are not removed if the test passed, failed, or had + no result, respectively. Temporary working directories are also + preserved for conditions specified via the preserve method. + + Typically, this method is not called directly, but is used when + the script exits to clean up temporary working directories as + appropriate for the exit status. + """ + if not self._dirlist: + return + if condition is None: + condition = self.condition + if self._preserve[condition]: + for dir in self._dirlist: + print "Preserved directory", dir + else: + list = self._dirlist[:] + list.reverse() + for dir in list: + self.writable(dir, 1) + shutil.rmtree(dir, ignore_errors = 1) + self._dirlist = [] + + self.workdir = None + os.chdir(self._cwd) + try: + global _Cleanup + _Cleanup.remove(self) + except (AttributeError, ValueError): + pass def description_set(self, description): - """Set the description of the functionality being tested. - """ - self.description = description + """Set the description of the functionality being tested. + """ + self.description = description # def diff(self): -# """Diff two arrays. -# """ +# """Diff two arrays. +# """ def fail_test(self, condition = 1, function = None, skip = 0): - """Cause the test to fail. - """ - if not condition: - return - self.condition = 'fail_test' - fail_test(self = self, - condition = condition, - function = function, - skip = skip) + """Cause the test to fail. + """ + if not condition: + return + self.condition = 'fail_test' + fail_test(self = self, + condition = condition, + function = function, + skip = skip) def interpreter_set(self, interpreter): - """Set the program to be used to interpret the program - under test as a script. - """ - self.interpreter = interpreter + """Set the program to be used to interpret the program + under test as a script. + """ + self.interpreter = interpreter def match(self, lines, matches): - """Compare actual and expected file contents. - """ - return self.match_func(lines, matches) + """Compare actual and expected file contents. + """ + return self.match_func(lines, matches) def match_exact(self, lines, matches): - """Compare actual and expected file contents. - """ - return match_exact(lines, matches) + """Compare actual and expected file contents. + """ + return match_exact(lines, matches) def match_re(self, lines, res): - """Compare actual and expected file contents. - """ - return match_re(lines, res) + """Compare actual and expected file contents. + """ + return match_re(lines, res) + + def match_re_dotall(self, lines, res): + """Compare actual and expected file contents. + """ + return match_re_dotall(lines, res) def no_result(self, condition = 1, function = None, skip = 0): - """Report that the test could not be run. - """ - if not condition: - return - self.condition = 'no_result' - no_result(self = self, - condition = condition, - function = function, - skip = skip) + """Report that the test could not be run. + """ + if not condition: + return + self.condition = 'no_result' + no_result(self = self, + condition = condition, + function = function, + skip = skip) def pass_test(self, condition = 1, function = None): - """Cause the test to pass. - """ - if not condition: - return - self.condition = 'pass_test' - pass_test(self = self, condition = condition, function = function) + """Cause the test to pass. + """ + if not condition: + return + self.condition = 'pass_test' + pass_test(self = self, condition = condition, function = function) def preserve(self, *conditions): - """Arrange for the temporary working directories for the - specified TestCmd environment to be preserved for one or more - conditions. If no conditions are specified, arranges for - the temporary working directories to be preserved for all - conditions. - """ - if conditions is (): - conditions = ('pass_test', 'fail_test', 'no_result') - for cond in conditions: - self._preserve[cond] = 1 + """Arrange for the temporary working directories for the + specified TestCmd environment to be preserved for one or more + conditions. If no conditions are specified, arranges for + the temporary working directories to be preserved for all + conditions. + """ + if conditions is (): + conditions = ('pass_test', 'fail_test', 'no_result') + for cond in conditions: + self._preserve[cond] = 1 def program_set(self, program): - """Set the executable program or script to be tested. - """ - if program and not os.path.isabs(program): - program = os.path.join(self._cwd, program) - self.program = program + """Set the executable program or script to be tested. + """ + if program and not os.path.isabs(program): + program = os.path.join(self._cwd, program) + self.program = program def read(self, file, mode = 'rb'): - """Reads and returns the contents of the specified file name. - The file name may be a list, in which case the elements are - concatenated with the os.path.join() method. The file is - assumed to be under the temporary working directory unless it - is an absolute path name. The I/O mode for the file may - be specified; it must begin with an 'r'. The default is - 'rb' (binary read). - """ - if type(file) is types.ListType: - file = apply(os.path.join, tuple(file)) - if not os.path.isabs(file): - file = os.path.join(self.workdir, file) - if mode[0] != 'r': - raise ValueError, "mode must begin with 'r'" - return open(file, mode).read() + """Reads and returns the contents of the specified file name. + The file name may be a list, in which case the elements are + concatenated with the os.path.join() method. The file is + assumed to be under the temporary working directory unless it + is an absolute path name. The I/O mode for the file may + be specified; it must begin with an 'r'. The default is + 'rb' (binary read). + """ + if is_List(file): + file = apply(os.path.join, tuple(file)) + if not os.path.isabs(file): + file = os.path.join(self.workdir, file) + if mode[0] != 'r': + raise ValueError, "mode must begin with 'r'" + return open(file, mode).read() def run(self, program = None, - interpreter = None, - arguments = None, - chdir = None, - stdin = None): - """Runs a test of the program or script for the test - environment. Standard output and error output are saved for - future retrieval via the stdout() and stderr() methods. - """ - if chdir: - oldcwd = os.getcwd() - if not os.path.isabs(chdir): - chdir = os.path.join(self.workpath(chdir)) - if self.verbose: - sys.stderr.write("chdir(" + chdir + ")\n") - os.chdir(chdir) - cmd = None - if program: - if not os.path.isabs(program): - program = os.path.join(self._cwd, program) - cmd = escape_cmd(program) - if interpreter: - cmd = interpreter + " " + cmd - else: - cmd = self.program - if self.interpreter: - cmd = self.interpreter + " " + cmd - if arguments: - cmd = cmd + " " + arguments - if self.verbose: - sys.stderr.write(cmd + "\n") - try: + interpreter = None, + arguments = None, + chdir = None, + stdin = None): + """Runs a test of the program or script for the test + environment. Standard output and error output are saved for + future retrieval via the stdout() and stderr() methods. + """ + if chdir: + oldcwd = os.getcwd() + if not os.path.isabs(chdir): + chdir = os.path.join(self.workpath(chdir)) + if self.verbose: + sys.stderr.write("chdir(" + chdir + ")\n") + os.chdir(chdir) + cmd = None + if program: + if not os.path.isabs(program): + program = os.path.join(self._cwd, program) + cmd = escape_cmd(program) + if interpreter: + cmd = interpreter + " " + cmd + else: + cmd = self.program + if self.interpreter: + cmd = self.interpreter + " " + cmd + if arguments: + cmd = cmd + " " + arguments + if self.verbose: + sys.stderr.write(cmd + "\n") + try: p = popen2.Popen3(cmd, 1) - except AttributeError: - (tochild, fromchild, childerr) = os.popen3(cmd) - if stdin: - if type(stdin) is types.ListType: - for line in stdin: - tochild.write(line) - else: - tochild.write(stdin) - tochild.close() - self._stdout.append(fromchild.read()) - self._stderr.append(childerr.read()) - fromchild.close() + except AttributeError: + (tochild, fromchild, childerr) = os.popen3(cmd) + if stdin: + if is_List(stdin): + for line in stdin: + tochild.write(line) + else: + tochild.write(stdin) + tochild.close() + out = fromchild.read() + err = childerr.read() + if self.combine: + self._stdout.append(out + err) + else: + self._stdout.append(out) + self._stderr.append(err) + fromchild.close() self.status = childerr.close() if not self.status: self.status = 0 - except: - raise - else: - if stdin: - if type(stdin) is types.ListType: - for line in stdin: - p.tochild.write(line) - else: - p.tochild.write(stdin) - p.tochild.close() - self._stdout.append(p.fromchild.read()) - self._stderr.append(p.childerr.read()) - self.status = p.wait() - if chdir: - os.chdir(oldcwd) + except: + raise + else: + if stdin: + if is_List(stdin): + for line in stdin: + p.tochild.write(line) + else: + p.tochild.write(stdin) + p.tochild.close() + out = p.fromchild.read() + err = p.childerr.read() + if self.combine: + self._stdout.append(out + err) + else: + self._stdout.append(out) + self._stderr.append(err) + self.status = p.wait() + if chdir: + os.chdir(oldcwd) + + def sleep(self, seconds = default_sleep_seconds): + """Sleeps at least the specified number of seconds. If no + number is specified, sleeps at least the minimum number of + seconds necessary to advance file time stamps on the current + system. Sleeping more seconds is all right. + """ + time.sleep(seconds) def stderr(self, run = None): - """Returns the error output from the specified run number. - If there is no specified run number, then returns the error - output of the last run. If the run number is less than zero, - then returns the error output from that many runs back from the - current run. - """ - if not run: - run = len(self._stderr) - elif run < 0: - run = len(self._stderr) + run - run = run - 1 - if run >= len(self._stderr) or run < 0: - return '' - else: - return self._stderr[run] + """Returns the error output from the specified run number. + If there is no specified run number, then returns the error + output of the last run. If the run number is less than zero, + then returns the error output from that many runs back from the + current run. + """ + if not run: + run = len(self._stderr) + elif run < 0: + run = len(self._stderr) + run + run = run - 1 + return self._stderr[run] def stdout(self, run = None): - """Returns the standard output from the specified run number. - If there is no specified run number, then returns the standard - output of the last run. If the run number is less than zero, - then returns the standard output from that many runs back from - the current run. - """ - if not run: - run = len(self._stdout) - elif run < 0: - run = len(self._stdout) + run - run = run - 1 - if run >= len(self._stdout) or run < 0: - return '' - else: - return self._stdout[run] + """Returns the standard output from the specified run number. + If there is no specified run number, then returns the standard + output of the last run. If the run number is less than zero, + then returns the standard output from that many runs back from + the current run. + """ + if not run: + run = len(self._stdout) + elif run < 0: + run = len(self._stdout) + run + run = run - 1 + return self._stdout[run] def subdir(self, *subdirs): - """Create new subdirectories under the temporary working - directory, one for each argument. An argument may be a list, - in which case the list elements are concatenated using the - os.path.join() method. Subdirectories multiple levels deep - must be created using a separate argument for each level: - - test.subdir('sub', ['sub', 'dir'], ['sub', 'dir', 'ectory']) - - Returns the number of subdirectories actually created. - """ - count = 0 - for sub in subdirs: - if sub is None: - continue - if type(sub) is types.ListType: - sub = apply(os.path.join, tuple(sub)) - new = os.path.join(self.workdir, sub) - try: - os.mkdir(new) - except: - pass - else: - count = count + 1 - return count + """Create new subdirectories under the temporary working + directory, one for each argument. An argument may be a list, + in which case the list elements are concatenated using the + os.path.join() method. Subdirectories multiple levels deep + must be created using a separate argument for each level: + + test.subdir('sub', ['sub', 'dir'], ['sub', 'dir', 'ectory']) + + Returns the number of subdirectories actually created. + """ + count = 0 + for sub in subdirs: + if sub is None: + continue + if is_List(sub): + sub = apply(os.path.join, tuple(sub)) + new = os.path.join(self.workdir, sub) + try: + os.mkdir(new) + except: + pass + else: + count = count + 1 + return count def unlink (self, file): """Unlinks the specified file name. - The file name may be a list, in which case the elements are - concatenated with the os.path.join() method. The file is - assumed to be under the temporary working directory unless it - is an absolute path name. - """ - if type(file) is types.ListType: - file = apply(os.path.join, tuple(file)) - if not os.path.isabs(file): - file = os.path.join(self.workdir, file) + The file name may be a list, in which case the elements are + concatenated with the os.path.join() method. The file is + assumed to be under the temporary working directory unless it + is an absolute path name. + """ + if is_List(file): + file = apply(os.path.join, tuple(file)) + if not os.path.isabs(file): + file = os.path.join(self.workdir, file) os.unlink(file) - def verbose_set(self, verbose): - """Set the verbose level. - """ - self.verbose = verbose + """Set the verbose level. + """ + self.verbose = verbose def where_is(self, file, path=None, pathext=None): """Find an executable file. """ - if type(file) is types.ListType: + if is_List(file): file = apply(os.path.join, tuple(file)) if not os.path.isabs(file): file = where_is(file, path, pathext) return file def workdir_set(self, path): - """Creates a temporary working directory with the specified - path name. If the path is a null string (''), a unique - directory name is created. - """ - if (path != None): - if path == '': - path = tempfile.mktemp() - if path != None: - os.mkdir(path) - self._dirlist.append(path) - global _Cleanup - try: - _Cleanup.index(self) - except ValueError: - _Cleanup.append(self) - # We'd like to set self.workdir like this: - # self.workdir = path - # But symlinks in the path will report things - # differently from os.getcwd(), so chdir there - # and back to fetch the canonical path. - cwd = os.getcwd() - os.chdir(path) - self.workdir = os.getcwd() + """Creates a temporary working directory with the specified + path name. If the path is a null string (''), a unique + directory name is created. + """ + if (path != None): + if path == '': + path = tempfile.mktemp() + if path != None: + os.mkdir(path) + # We'd like to set self.workdir like this: + # self.workdir = path + # But symlinks in the path will report things + # differently from os.getcwd(), so chdir there + # and back to fetch the canonical path. + cwd = os.getcwd() + os.chdir(path) + self.workdir = os.getcwd() + os.chdir(cwd) # Uppercase the drive letter since the case of drive # letters is pretty much random on win32: drive,rest = os.path.splitdrive(self.workdir) if drive: self.workdir = string.upper(drive) + rest - os.chdir(cwd) - else: - self.workdir = None + # + self._dirlist.append(self.workdir) + global _Cleanup + try: + _Cleanup.index(self) + except ValueError: + _Cleanup.append(self) + else: + self.workdir = None def workpath(self, *args): - """Returns the absolute path name to a subdirectory or file - within the current temporary working directory. Concatenates - the temporary working directory name with the specified - arguments using the os.path.join() method. - """ - return apply(os.path.join, (self.workdir,) + tuple(args)) + """Returns the absolute path name to a subdirectory or file + within the current temporary working directory. Concatenates + the temporary working directory name with the specified + arguments using the os.path.join() method. + """ + return apply(os.path.join, (self.workdir,) + tuple(args)) def writable(self, top, write): - """Make the specified directory tree writable (write == 1) - or not (write == None). - """ - - def _walk_chmod(arg, dirname, names): - st = os.stat(dirname) - os.chmod(dirname, arg(st[stat.ST_MODE])) - for name in names: - n = os.path.join(dirname, name) - st = os.stat(n) - os.chmod(n, arg(st[stat.ST_MODE])) - - def _mode_writable(mode): - return stat.S_IMODE(mode|0200) - - def _mode_non_writable(mode): - return stat.S_IMODE(mode&~0200) - - if write: - f = _mode_writable - else: - f = _mode_non_writable - try: - os.path.walk(top, _walk_chmod, f) - except: - pass # ignore any problems changing modes - + """Make the specified directory tree writable (write == 1) + or not (write == None). + """ + + def _walk_chmod(arg, dirname, names): + st = os.stat(dirname) + os.chmod(dirname, arg(st[stat.ST_MODE])) + for name in names: + n = os.path.join(dirname, name) + st = os.stat(n) + os.chmod(n, arg(st[stat.ST_MODE])) + + def _mode_writable(mode): + return stat.S_IMODE(mode|0200) + + def _mode_non_writable(mode): + return stat.S_IMODE(mode&~0200) + + if write: + f = _mode_writable + else: + f = _mode_non_writable + try: + os.path.walk(top, _walk_chmod, f) + except: + pass # ignore any problems changing modes + def write(self, file, content, mode = 'wb'): - """Writes the specified content text (second argument) to the - specified file name (first argument). The file name may be - a list, in which case the elements are concatenated with the - os.path.join() method. The file is created under the temporary - working directory. Any subdirectories in the path must already - exist. The I/O mode for the file may be specified; it must - begin with a 'w'. The default is 'wb' (binary write). - """ - if type(file) is types.ListType: - file = apply(os.path.join, tuple(file)) - if not os.path.isabs(file): - file = os.path.join(self.workdir, file) - if mode[0] != 'w': - raise ValueError, "mode must begin with 'w'" - open(file, mode).write(content) + """Writes the specified content text (second argument) to the + specified file name (first argument). The file name may be + a list, in which case the elements are concatenated with the + os.path.join() method. The file is created under the temporary + working directory. Any subdirectories in the path must already + exist. The I/O mode for the file may be specified; it must + begin with a 'w'. The default is 'wb' (binary write). + """ + if is_List(file): + file = apply(os.path.join, tuple(file)) + if not os.path.isabs(file): + file = os.path.join(self.workdir, file) + if mode[0] != 'w': + raise ValueError, "mode must begin with 'w'" + open(file, mode).write(content) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 57b6fa7..6368d78 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -52,6 +52,8 @@ RELEASE 0.XX - XXX - Allow the source of Command() to be a directory. + - Better error handling of things like raw TypeErrors in SConscripts. + From Gary Oberbrunner: - Report the target being built in error messages when building @@ -65,6 +67,8 @@ RELEASE 0.XX - XXX - Fix the value returned by the Node.prevsiginfo() method to conform to a previous change when checking whether a node is current. + - Supply a stack trace if the Taskmaster catches an exception. + From Laurent Pelecq: - When the -debug=pdb option is specified, use pdb.Pdb().runcall() to diff --git a/src/engine/SCons/Errors.py b/src/engine/SCons/Errors.py index cc8bb3d..0a57614 100644 --- a/src/engine/SCons/Errors.py +++ b/src/engine/SCons/Errors.py @@ -61,3 +61,10 @@ class ConfigureDryRunError(UserError): but the user requested a dry-run""" def __init__(self,file): UserError.__init__(self,"Cannot update configure test (%s) within a dry-run." % str(file)) + +class TaskmasterException(Exception): + def __init__(self, type, value, traceback, *args): + self.type = type + self.value = value + self.traceback = traceback + self.args = args diff --git a/src/engine/SCons/ErrorsTests.py b/src/engine/SCons/ErrorsTests.py index 810f840..4771a3f 100644 --- a/src/engine/SCons/ErrorsTests.py +++ b/src/engine/SCons/ErrorsTests.py @@ -65,6 +65,15 @@ class ErrorsTestCase(unittest.TestCase): except SCons.Errors.UserError, e: assert e.args == "Cannot update configure test (FileName) within a dry-run." + def test_TaskmasterException(self): + """Test the TaskmasterException.""" + try: + raise SCons.Errors.TaskmasterException("one", "two", "three") + except SCons.Errors.TaskmasterException, e: + assert e.type == "one", e.type + assert e.value == "two", e.value + assert e.traceback == "three", e.traceback + if __name__ == "__main__": suite = unittest.makeSuite(ErrorsTestCase, 'test_') diff --git a/src/engine/SCons/Script/SConscript.py b/src/engine/SCons/Script/SConscript.py index 313a3f2..2984160 100644 --- a/src/engine/SCons/Script/SConscript.py +++ b/src/engine/SCons/Script/SConscript.py @@ -309,6 +309,30 @@ def SConscript(*ls, **kw): else: return tuple(results) +def is_our_exec_statement(line): + return not line is None and line[:12] == "exec _file_ " + +def SConscript_exception(file=sys.stderr): + """Print an exception stack trace just for the SConscript file(s). + This will show users who have Python errors where the problem is, + without cluttering the output with all of the internal calls leading + up to where we exec the SConscript.""" + stack = traceback.extract_tb(sys.exc_traceback) + last_text = "" + i = 0 + for frame in stack: + if is_our_exec_statement(last_text): + break + i = i + 1 + last_text = frame[3] + type = str(sys.exc_type) + if type[:11] == "exceptions.": + type = type[11:] + file.write('%s: %s:\n' % (type, sys.exc_value)) + for fname, line, func, text in stack[i:]: + file.write(' File "%s", line %d:\n' % (fname, line)) + file.write(' %s\n' % text) + def annotate(node): """Annotate a node with the stack frame describing the SConscript file and line number that created it.""" @@ -319,7 +343,7 @@ def annotate(node): # magic "exec _file_ " string, then this frame describes the # SConscript file and line number that caused this node to be # created. Record the tuple and carry on. - if not last_text is None and last_text[:12] == "exec _file_ ": + if is_our_exec_statement(last_text): node.creator = frame return last_text = frame[3] diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py index c171a91..a413054 100644 --- a/src/engine/SCons/Script/__init__.py +++ b/src/engine/SCons/Script/__init__.py @@ -133,28 +133,41 @@ class BuildTask(SCons.Taskmaster.Task): print tree def failed(self): - e = sys.exc_value + # Handle the failure of a build task. The primary purpose here + # is to display the various types of Errors and Exceptions + # appropriately. status = 2 - if sys.exc_type == SCons.Errors.BuildError: + e = sys.exc_value + t = sys.exc_type + tb = None + if t is SCons.Errors.TaskmasterException: + # The Taskmaster received an Error or Exception while trying + # to process or build the Nodes and dependencies, which it + # wrapped up for us in the object recorded as the value of + # the Exception, so process the wrapped info instead of the + # TaskmasterException itself. + t = e.type + tb = e.traceback + e = e.value + + if t == SCons.Errors.BuildError: sys.stderr.write("scons: *** [%s] %s\n" % (e.node, e.errstr)) if e.errstr == 'Exception': traceback.print_exception(e.args[0], e.args[1], e.args[2]) - elif sys.exc_type == SCons.Errors.UserError: - # We aren't being called out of a user frame, so - # don't try to walk the stack, just print the error. - sys.stderr.write("\nscons: *** %s\n" % e) - elif sys.exc_type == SCons.Errors.StopError: - s = str(e) - if not keep_going_on_error: - s = s + ' Stop.' - sys.stderr.write("scons: *** %s\n" % s) - elif sys.exc_type == SCons.Errors.ExplicitExit: + elif t == SCons.Errors.ExplicitExit: status = e.status sys.stderr.write("scons: *** [%s] Explicit exit, status %s\n" % (e.node, e.status)) else: if e is None: - e = sys.exc_type - sys.stderr.write("scons: *** %s\n" % e) + e = t + s = str(e) + if t == SCons.Errors.StopError and not keep_going_on_error: + s = s + ' Stop.' + sys.stderr.write("scons: *** %s\n" % s) + + if tb: + sys.stderr.write("scons: internal stack trace:\n") + traceback.print_tb(tb, file=sys.stderr) self.do_failed(status) @@ -290,11 +303,11 @@ def _scons_internal_warning(e): sys.stderr.write("\nscons: warning: %s\n" % e) sys.stderr.write('File "%s", line %d, in %s\n' % (filename, lineno, routine)) -def _scons_other_errors(): +def _scons_internal_error(): """Handle all errors but user errors. Print out a message telling the user what to do in this case and print a normal trace. """ - print 'other errors' + print 'internal error' traceback.print_exc() sys.exit(2) @@ -984,12 +997,18 @@ def main(): sys.exit(2) except SyntaxError, e: _scons_syntax_error(e) + except SCons.Errors.InternalError: + _scons_internal_error() except SCons.Errors.UserError, e: _scons_user_error(e) except SCons.Errors.ConfigureDryRunError, e: _scons_configure_dryrun_error(e) except: - _scons_other_errors() + # An exception here is likely a builtin Python exception Python + # code in an SConscript file. Show them precisely what the + # problem was and where it happened. + SCons.Script.SConscript.SConscript_exception() + sys.exit(2) if print_time: total_time = time.time()-start_time diff --git a/src/engine/SCons/Taskmaster.py b/src/engine/SCons/Taskmaster.py index 2fbc6e2..7937569 100644 --- a/src/engine/SCons/Taskmaster.py +++ b/src/engine/SCons/Taskmaster.py @@ -31,6 +31,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import string import sys +import traceback import SCons.Node import SCons.Errors @@ -238,7 +239,10 @@ class Taskmaster: # children (like a child couldn't be linked in to a # BuildDir, or a Scanner threw something). Arrange to # raise the exception when the Task is "executed." - self.exception_set(sys.exc_type, sys.exc_value) + x = SCons.Errors.TaskmasterException(sys.exc_type, + sys.exc_value, + sys.exc_traceback) + self.exception_set(x) self.candidates.pop() self.ready = node break @@ -262,7 +266,10 @@ class Taskmaster: # the kids are derived (like a child couldn't be linked # from a repository). Arrange to raise the exception # when the Task is "executed." - self.exception_set(sys.exc_type, sys.exc_value) + x = SCons.Errors.TaskmasterException(sys.exc_type, + sys.exc_value, + sys.exc_traceback) + self.exception_set(x) self.candidates.pop() self.ready = node break @@ -338,7 +345,10 @@ class Taskmaster: # a child couldn't be linked in to a BuildDir when deciding # whether this node is current). Arrange to raise the # exception when the Task is "executed." - self.exception_set(sys.exc_type, sys.exc_value) + x = SCons.Errors.TaskmasterException(sys.exc_type, + sys.exc_value, + sys.exc_traceback) + self.exception_set(x) self.ready = None return task @@ -373,18 +383,23 @@ class Taskmaster: self.candidates.extend(self.pending) self.pending = [] - def exception_set(self, type, value): + def exception_set(self, type, value=None): """Record an exception type and value to raise later, at an appropriate time.""" self.exc_type = type self.exc_value = value + self.exc_traceback = traceback def exception_raise(self): """Raise any pending exception that was recorded while getting a Task ready for execution.""" if self.exc_type: try: - raise self.exc_type, self.exc_value + try: + raise self.exc_type, self.exc_value + except TypeError: + # exc_type was probably an instance, + # so raise it by itself. + raise self.exc_type finally: self.exception_set(None, None) - diff --git a/src/engine/SCons/TaskmasterTests.py b/src/engine/SCons/TaskmasterTests.py index 3616370..4dbf8b3 100644 --- a/src/engine/SCons/TaskmasterTests.py +++ b/src/engine/SCons/TaskmasterTests.py @@ -404,8 +404,11 @@ class TaskmasterTestCase(unittest.TestCase): n1 = Node("n1") tm = SCons.Taskmaster.Taskmaster(targets = [n1], tasker = MyTask) t = tm.next_task() - assert tm.exc_type == MyException, tm.exc_type - assert str(tm.exc_value) == "from make_ready()", tm.exc_value + assert isinstance(tm.exc_type, SCons.Errors.TaskmasterException), repr(tm.exc_type) + assert tm.exc_value is None, tm.exc_value + e = tm.exc_type + assert e.type == MyException, e.type + assert str(e.value) == "from make_ready()", str(e.value) def test_children_errors(self): @@ -417,11 +420,16 @@ class TaskmasterTestCase(unittest.TestCase): class ExitNode(Node): def children(self): sys.exit(77) + n1 = StopNode("n1") tm = SCons.Taskmaster.Taskmaster([n1]) t = tm.next_task() - assert tm.exc_type == SCons.Errors.StopError, "Did not record StopError on node" - assert str(tm.exc_value) == "stop!", "Unexpected exc_value `%s'" % tm.exc_value + assert isinstance(tm.exc_type, SCons.Errors.TaskmasterException), repr(tm.exc_type) + assert tm.exc_value is None, tm.exc_value + e = tm.exc_type + assert e.type == SCons.Errors.StopError, e.type + assert str(e.value) == "stop!", "Unexpected exc_value `%s'" % e.value + n2 = ExitNode("n2") tm = SCons.Taskmaster.Taskmaster([n2]) t = tm.next_task() @@ -576,10 +584,12 @@ class TaskmasterTestCase(unittest.TestCase): exc_caught = None try: t.prepare() - except MyException, v: - assert str(v) == "exception value", v + except MyException, e: exc_caught = 1 + except: + pass assert exc_caught, "did not catch expected MyException" + assert str(e) == "exception value", e assert built_text is None, built_text def test_execute(self): @@ -652,6 +662,10 @@ class TaskmasterTestCase(unittest.TestCase): assert tm.exc_type == 1, tm.exc_type assert tm.exc_value == 2, tm.exc_value + tm.exception_set(3) + assert tm.exc_type == 3, tm.exc_type + assert tm.exc_value is None, tm.exc_value + tm.exception_set(None, None) assert tm.exc_type is None, tm.exc_type assert tm.exc_value is None, tm.exc_value @@ -661,7 +675,7 @@ class TaskmasterTestCase(unittest.TestCase): tm.exception_raise() except: assert sys.exc_type == "exception 1", sys.exc_type - assert sys.exc_value is None, sys.exc_type + assert sys.exc_value is None, sys.exc_value else: assert 0, "did not catch expected exception" @@ -670,7 +684,7 @@ class TaskmasterTestCase(unittest.TestCase): tm.exception_raise() except: assert sys.exc_type == "exception 2", sys.exc_type - assert sys.exc_value == "xyzzy", sys.exc_type + assert sys.exc_value == "xyzzy", sys.exc_value else: assert 0, "did not catch expected exception" diff --git a/test/BuildDir-errors.py b/test/BuildDir-errors.py index f6646a7..ead5056 100644 --- a/test/BuildDir-errors.py +++ b/test/BuildDir-errors.py @@ -132,12 +132,22 @@ os.chmod(dir, os.stat(dir)[stat.ST_MODE] & ~stat.S_IWUSR) test.run(chdir = 'ro-src', arguments = ".", status = 2, - stderr = "scons: *** Cannot duplicate `%s' in `build': Permission denied. Stop.\n" % os.path.join('src', 'file.in')) + stderr = None) +test.fail_test(not test.match_re_dotall(test.stderr(), """\ +scons: \\*\\*\\* Cannot duplicate `src.file\\.in' in `build': Permission denied. Stop. +scons: internal stack trace: + File .* +""")) test.run(chdir = 'ro-src', arguments = "-k .", status = 2, - stderr = "scons: *** Cannot duplicate `%s' in `build': Permission denied.\n" % os.path.join('src', 'file.in')) + stderr = None) +test.fail_test(not test.match_re_dotall(test.stderr(), """\ +scons: \\*\\*\\* Cannot duplicate `src.file\.in' in `build': Permission denied. +scons: internal stack trace: + File .* +""")) f.close() diff --git a/test/Scanner-exception.py b/test/Scanner-exception.py index 8fe7875..53ae7a0 100644 --- a/test/Scanner-exception.py +++ b/test/Scanner-exception.py @@ -24,6 +24,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import string import sys import TestSCons @@ -107,6 +108,11 @@ test.write('zzz', "zzz 1\n") test.run(arguments = '.', status = 2, - stderr = "scons: *** kfile_scan error: yyy 1\n") + stderr = None) +test.fail_test(not test.match_re_dotall(test.stderr(), """\ +scons: \\*\\*\\* kfile_scan error: yyy 1 +scons: internal stack trace: + File .* +""")) test.pass_test() diff --git a/test/SharedLibrary.py b/test/SharedLibrary.py index fe35c02..97b5253 100644 --- a/test/SharedLibrary.py +++ b/test/SharedLibrary.py @@ -202,7 +202,7 @@ test.run(program = test.workpath('prog'), if sys.platform == 'win32' or string.find(sys.platform, 'irix') != -1: test.run(arguments = '-f SConstructFoo') else: - test.run(arguments = '-f SConstructFoo', status=2, stderr=''' + test.run(arguments = '-f SConstructFoo', status=2, stderr='''\ scons: \*\*\* Source file: foo\..* is static and is not compatible with shared target: .* ''') diff --git a/test/errors.py b/test/errors.py index 46a80ed..420eb5e 100644 --- a/test/errors.py +++ b/test/errors.py @@ -33,9 +33,13 @@ python = TestSCons.python test = TestSCons.TestSCons(match = TestCmd.match_re_dotall) -test.write('foo.in', 'foo') -test.write('exit.in', 'exit') -test.write('SConstruct', """ + + +test.write('foo.in', 'foo\n') + +test.write('exit.in', 'exit\n') + +test.write('SConstruct', """\ import sys def foo(env, target, source): @@ -70,13 +74,40 @@ assert string.find(test.stdout(), "scons: `foo.out' is up to date.") != -1, test -test.write('SConstruct1', """ +# Test AttributeError. +test.write('SConstruct', """\ +a = 1 +a.append(2) +""") + +test.run(status = 2, stderr = """\ +AttributeError: 'int' object has no attribute 'append': + File "SConstruct", line 2: + a.append\(2\) +""") + + + +# Test NameError. +test.write('SConstruct', """\ +a == 1 +""") + +test.run(status = 2, stderr = """\ +NameError: a: + File "SConstruct", line 1: + a == 1 +""") + + + +# Test SyntaxError. +test.write('SConstruct', """ a ! x """) -test.run(arguments='-f SConstruct1', - stdout = "scons: Reading SConscript files ...\n", - stderr = """ File "SConstruct1", line 2 +test.run(stdout = "scons: Reading SConscript files ...\n", + stderr = """ File "SConstruct", line 2 a ! x @@ -87,32 +118,49 @@ SyntaxError: invalid syntax """, status=2) -test.write('SConstruct2', """ + +# Test TypeError. +test.write('SConstruct', """\ +a = 1 +a[2] = 3 +""") + +test.run(status = 2, stderr = """\ +TypeError: object does not support item assignment: + File "SConstruct", line 2: + a\[2\] = 3 +""") + + + +# Test UserError. +test.write('SConstruct', """ assert not globals().has_key("UserError") import SCons.Errors raise SCons.Errors.UserError, 'Depends() require both sources and targets.' """) -test.run(arguments='-f SConstruct2', - stdout = "scons: Reading SConscript files ...\n", +test.run(stdout = "scons: Reading SConscript files ...\n", stderr = """ scons: \*\*\* Depends\(\) require both sources and targets. -File "SConstruct2", line 4, in \? +File "SConstruct", line 4, in \? """, status=2) -test.write('SConstruct3', """ + + +# Test InternalError. +test.write('SConstruct', """ assert not globals().has_key("InternalError") from SCons.Errors import InternalError raise InternalError, 'error inside' """) -test.run(arguments='-f SConstruct3', - stdout = "scons: Reading SConscript files ...\nother errors\n", +test.run(stdout = "scons: Reading SConscript files ...\ninternal error\n", stderr = r"""Traceback \((most recent call|innermost) last\): File ".+", line \d+, in .+ File ".+", line \d+, in .+ File ".+", line \d+, in .+ - File "SConstruct3", line \d+, in \? + File "SConstruct", line \d+, in \? raise InternalError, 'error inside' InternalError: error inside """, status=2) @@ -122,6 +170,9 @@ import sys sys.exit(2) ''') + + +# Test ... test.write('SConstruct', """ env=Environment() Default(env.Command(['one.out', 'two.out'], ['foo.in'], action=r'%s build.py')) @@ -129,4 +180,6 @@ Default(env.Command(['one.out', 'two.out'], ['foo.in'], action=r'%s build.py')) test.run(status=2, stderr="scons: \\*\\*\\* \\[one.out\\] Error 2\n") + + test.pass_test() |