summaryrefslogtreecommitdiffstats
path: root/test/build-errors.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2002-01-11 07:03:58 (GMT)
committerSteven Knight <knight@baldmt.com>2002-01-11 07:03:58 (GMT)
commit1337a21f86a49c41940e9b95b7ebf5139cfa03d3 (patch)
treea35eb93886633346141fd0032f4c9c784f73ead4 /test/build-errors.py
parent73d5fcf51f9002bb3a0da8a32576b2e8ce0cb54a (diff)
downloadSCons-1337a21f86a49c41940e9b95b7ebf5139cfa03d3.zip
SCons-1337a21f86a49c41940e9b95b7ebf5139cfa03d3.tar.gz
SCons-1337a21f86a49c41940e9b95b7ebf5139cfa03d3.tar.bz2
Add command-line redirection (Charles Crain).
Diffstat (limited to 'test/build-errors.py')
-rw-r--r--test/build-errors.py61
1 files changed, 50 insertions, 11 deletions
diff --git a/test/build-errors.py b/test/build-errors.py
index 9f09ea0..8545642 100644
--- a/test/build-errors.py
+++ b/test/build-errors.py
@@ -48,28 +48,56 @@ env.bld(target = 'f1', source = 'f1.in')
test.run(arguments='-f SConstruct1 .',
stdout = "%s f1.in f1\n" % no_such_file,
- stderr = """scons: %s: No such file or directory
+ stderr = None)
+
+bad_command = "Bad command or file name\n"
+
+unrecognized = """'%s' is not recognized as an internal or external command,
+operable program or batch file.
+scons: *** [%s] Error 1
+"""
+
+unspecified = """The name specified is not recognized as an
+internal or external command, operable program or batch file.
+scons: *** [%s] Error 1
+"""
+
+test.description_set("Incorrect STDERR:\n%s\n" % test.stderr())
+if os.name == 'nt':
+ errs = [
+ bad_command,
+ unrecognized % (no_such_file, 'f1'),
+ unspecified % 'f1'
+ ]
+ test.fail_test(not test.stderr() in errs)
+else:
+ test.fail_test(test.stderr() != """sh: %s: No such file or directory
scons: *** [f1] Error 127
""" % no_such_file)
+
test.write('SConstruct2', r"""
bld = Builder(name = 'bld', action = '%s $SOURCES $TARGET')
env = Environment(BUILDERS = [bld])
env.bld(target = 'f2', source = 'f2.in')
""" % string.replace(not_executable, '\\', '\\\\'))
+test.run(arguments='-f SConstruct2 .',
+ stdout = "%s f2.in f2\n" % not_executable,
+ stderr = None)
+
+test.description_set("Incorrect STDERR:\n%s\n" % test.stderr())
if os.name == 'nt':
- expect = """scons: %s: No such file or directory
-scons: *** [f2] Error 127
-""" % not_executable
+ errs = [
+ bad_command,
+ unrecognized % (no_such_file, 'f2'),
+ unspecified % 'f2'
+ ]
+ test.fail_test(not test.stderr() in errs)
else:
- expect = """scons: %s: Permission denied
+ test.fail_test(test.stderr() != """sh: %s: Permission denied
scons: *** [f2] Error 126
-""" % not_executable
-
-test.run(arguments='-f SConstruct2 .',
- stdout = "%s f2.in f2\n" % not_executable,
- stderr = expect)
+""" % not_executable)
test.write('SConstruct3', r"""
bld = Builder(name = 'bld', action = '%s $SOURCES $TARGET')
@@ -79,7 +107,18 @@ env.bld(target = 'f3', source = 'f3.in')
test.run(arguments='-f SConstruct3 .',
stdout = "%s f3.in f3\n" % test.workdir,
- stderr = """scons: %s: Permission denied
+ stderr = None)
+
+test.description_set("Incorrect STDERR:\n%s\n" % test.stderr())
+if os.name == 'nt':
+ errs = [
+ bad_command,
+ unrecognized % (no_such_file, 'f3'),
+ unspecified % 'f3'
+ ]
+ test.fail_test(not test.stderr() in errs)
+else:
+ test.fail_test(test.stderr() != """sh: %s: is a directory
scons: *** [f3] Error 126
""" % test.workdir)