summaryrefslogtreecommitdiff
path: root/test/Errors
diff options
context:
space:
mode:
authorDirk Baechle <dl9obn@darc.de>2012-12-16 18:56:16 +0100
committerDirk Baechle <dl9obn@darc.de>2012-12-16 18:56:16 +0100
commitbcfc775b40eaa51af854862d1902267e8152128c (patch)
tree53e4be521ebf4c4f65c14c9e68b64b5327bf61c4 /test/Errors
parent8a4d58873138ff82370e4055c55f4c6d770ab373 (diff)
downloadscons-bcfc775b40eaa51af854862d1902267e8152128c.tar.gz
- extended the must_contain* methods of the test framework, such that they all support user-defined find/search functions
- relaxed several of the regex comparisons for better cross-platform compatibility
Diffstat (limited to 'test/Errors')
-rw-r--r--test/Errors/execute-a-directory.py47
-rw-r--r--test/Errors/non-executable-file.py38
-rw-r--r--test/Errors/nonexistent-executable.py53
3 files changed, 54 insertions, 84 deletions
diff --git a/test/Errors/execute-a-directory.py b/test/Errors/execute-a-directory.py
index 1b679c6e..1d2036e3 100644
--- a/test/Errors/execute-a-directory.py
+++ b/test/Errors/execute-a-directory.py
@@ -53,63 +53,58 @@ Bad command or file name
"""
unrecognized = """\
-'%s' is not recognized as an internal or external command,
+'.+' is not recognized as an internal or external command,
operable program or batch file.
-scons: *** [%s] Error 1
+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
+scons: \*\*\* \[%s\] Error 1
"""
cannot_execute = """\
-%s: cannot execute
-scons: *** [%s] Error %s
-"""
-
-Permission_denied = """\
-%s: Permission denied
-scons: *** [%s] Error %s
+(sh: )*.+: cannot execute
+scons: \*\*\* \[%s\] Error %s
"""
permission_denied = """\
-%s: permission denied
-scons: *** [%s] Error %s
+.+: (p|P)ermission denied
+scons: \*\*\* \[%s\] Error %s
"""
is_a_directory = """\
-%s: is a directory
-scons: *** [%s] Error %s
+.+: (i|I)s a directory
+scons: \*\*\* \[%s\] Error %s
"""
-Is_a_directory = """\
-%s: Is a directory
-scons: *** [%s] Error %s
+konnte_nicht_gefunden_werden = """\
+Der Befehl ".+" ist entweder falsch geschrieben oder
+konnte nicht gefunden werden.
+scons: \*\*\* \[%s\] Error %s
"""
test.description_set("Incorrect STDERR:\n%s\n" % test.stderr())
if os.name == 'nt':
errs = [
bad_command,
- unrecognized % (test.workdir, 'f3'),
+ unrecognized % 'f3',
+ konnte_nicht_gefunden_werden % ('f3', 1),
unspecified % 'f3'
]
- test.fail_test(not test.stderr() in errs)
elif sys.platform.find('sunos') != -1:
errs = [
- cannot_execute % ('sh: %s' % test.workdir, 'f3', 1),
+ cannot_execute % ('f3', 1),
]
- test.fail_test(not test.stderr() in errs)
else:
errs = [
- cannot_execute % (not_executable, 'f3', 126),
- is_a_directory % (test.workdir, 'f3', 126),
- Is_a_directory % (test.workdir, 'f3', 126),
- Permission_denied % (test.workdir, 'f3', 126),
+ cannot_execute % ('f3', 126),
+ is_a_directory % ('f3', 126),
+ permission_denied % ('f3', 126),
]
- test.must_contain_any_line(test.stderr(), errs)
+
+test.must_contain_any_line(test.stderr(), errs, find=TestSCons.search_re)
test.pass_test()
diff --git a/test/Errors/non-executable-file.py b/test/Errors/non-executable-file.py
index db7c88a6..e1b8f4ef 100644
--- a/test/Errors/non-executable-file.py
+++ b/test/Errors/non-executable-file.py
@@ -42,30 +42,31 @@ Bad command or file name
"""
unrecognized = """\
-'%s' is not recognized as an internal or external command,
+'.+' is not recognized as an internal or external command,
operable program or batch file.
-scons: *** [%s] Error 1
+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
+scons: \*\*\* \[%s\] Error 1
"""
cannot_execute = """\
-%s: cannot execute
-scons: *** [%s] Error %s
+(sh: )*.+: cannot execute
+scons: \*\*\* \[%s\] Error %s
"""
-Permission_denied = """\
-%s: Permission denied
-scons: *** [%s] Error %s
+permission_denied = """\
+.+: (p|P)ermission denied
+scons: \*\*\* \[%s\] Error %s
"""
-permission_denied = """\
-%s: permission denied
-scons: *** [%s] Error %s
+konnte_nicht_gefunden_werden = """\
+Der Befehl ".+" ist entweder falsch geschrieben oder
+konnte nicht gefunden werden.
+scons: \*\*\* \[%s\] Error %s
"""
test.write('SConstruct', r"""
@@ -83,22 +84,21 @@ test.description_set("Incorrect STDERR:\n%s\n" % test.stderr())
if os.name == 'nt':
errs = [
bad_command,
- unrecognized % (not_executable, 'f1'),
+ unrecognized % 'f1',
+ konnte_nicht_gefunden_werden % ('f1', 1),
unspecified % 'f1'
]
- test.fail_test(not test.stderr() in errs)
elif sys.platform.find('sunos') != -1:
errs = [
- cannot_execute % ('sh: %s' % not_executable, 'f1', 1),
+ cannot_execute % ('f1', 1),
]
- test.fail_test(not test.stderr() in errs)
else:
errs = [
- cannot_execute % (not_executable, 'f1', 126),
- Permission_denied % (not_executable, 'f1', 126),
- permission_denied % (not_executable, 'f1', 126),
+ cannot_execute % ('f1', 126),
+ permission_denied % ('f1', 126),
]
- test.must_contain_any_line(test.stderr(), errs)
+
+test.must_contain_any_line(test.stderr(), errs, find=TestSCons.search_re)
test.pass_test()
diff --git a/test/Errors/nonexistent-executable.py b/test/Errors/nonexistent-executable.py
index b9deea12..acaaaeb1 100644
--- a/test/Errors/nonexistent-executable.py
+++ b/test/Errors/nonexistent-executable.py
@@ -46,58 +46,33 @@ test.run(arguments='.',
stderr = None,
status = 2)
-bad_command = """\
-Bad command or file name
-"""
-
-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
-"""
-
-not_found_1_space = """\
-sh: %s: not found
-scons: *** [%s] Error %s
-"""
-
-not_found_2_spaces = """\
-sh: %s: not found
-scons: *** [%s] Error %s
-"""
-
-No_such = """\
-%s: No such file or directory
-scons: *** [%s] Error %s
-"""
+bad_command = """Bad command or file name"""
+unrecognized = r"""'.+' is not recognized as an internal or external command,\s+operable program or batch file.\sscons: \*\*\* \[%s\] Error 1"""
+unspecified = r"""The name specified is not recognized as an\s+internal or external command, operable program or batch file.\s+scons: \*\*\* \[%s\] Error 1"""
+not_found_space = r"""sh: (\d: )*.+: \s*not found\s+scons: \*\*\* \[%s\] Error %s"""
+No_such = r""".+: No such file or directory\s+scons: \*\*\* \[%s\] Error %s"""
+konnte_nicht_gefunden_werden = r"""Der Befehl ".+" ist entweder falsch geschrieben oder\s+konnte nicht gefunden werden.\s+scons: \*\*\* \[%s\] Error %s"""
test.description_set("Incorrect STDERR:\n%s\n" % test.stderr())
if os.name == 'nt':
errs = [
bad_command,
- unrecognized % (no_such_file, 'f1'),
+ unrecognized % 'f1',
+ konnte_nicht_gefunden_werden % ('f1', 1),
unspecified % 'f1'
]
- test.fail_test(not test.stderr() in errs)
elif sys.platform.find('sunos') != -1:
errs = [
- not_found_1_space % (no_such_file, 'f1', 1),
+ not_found_space % ('f1', 1),
]
- test.fail_test(not test.stderr() in errs)
else:
errs = [
- not_found_1_space % (no_such_file, 'f1', 1),
- not_found_2_spaces % (no_such_file, 'f1', 1),
- not_found_1_space % (no_such_file, 'f1', 127),
- No_such % (no_such_file, 'f1', 127),
+ not_found_space % ('f1', 1),
+ not_found_space % ('f1', 127),
+ No_such % ('f1', 127),
]
- test.must_contain_any_line(test.stderr(), errs)
+
+test.must_contain_any_line(test.stderr(), errs, find=TestSCons.search_re)
test.pass_test()