updated copyright and added csv results output to bench.py
[scons.git] / test / Errors / nonexistent-executable.py
blobacaaaeb1a1ea862468f4c84542e64e353ea670dd
1 #!/usr/bin/env python
3 # __COPYRIGHT__
5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
27 import os
28 import sys
30 import TestSCons
32 test = TestSCons.TestSCons()
34 no_such_file = test.workpath("no_such_file")
36 test.write("f1.in", "\n")
38 test.write('SConstruct', r"""
39 bld = Builder(action = '%s $SOURCES $TARGET')
40 env = Environment(BUILDERS = { 'bld' : bld })
41 env.bld(target = 'f1', source = 'f1.in')
42 """ % no_such_file.replace('\\', '\\\\'))
44 test.run(arguments='.',
45 stdout = test.wrap_stdout("%s f1.in f1\n" % no_such_file, error=1),
46 stderr = None,
47 status = 2)
49 bad_command = """Bad command or file name"""
50 unrecognized = r"""'.+' is not recognized as an internal or external command,\s+operable program or batch file.\sscons: \*\*\* \[%s\] Error 1"""
51 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"""
52 not_found_space = r"""sh: (\d: )*.+: \s*not found\s+scons: \*\*\* \[%s\] Error %s"""
53 No_such = r""".+: No such file or directory\s+scons: \*\*\* \[%s\] Error %s"""
54 konnte_nicht_gefunden_werden = r"""Der Befehl ".+" ist entweder falsch geschrieben oder\s+konnte nicht gefunden werden.\s+scons: \*\*\* \[%s\] Error %s"""
56 test.description_set("Incorrect STDERR:\n%s\n" % test.stderr())
57 if os.name == 'nt':
58 errs = [
59 bad_command,
60 unrecognized % 'f1',
61 konnte_nicht_gefunden_werden % ('f1', 1),
62 unspecified % 'f1'
64 elif sys.platform.find('sunos') != -1:
65 errs = [
66 not_found_space % ('f1', 1),
68 else:
69 errs = [
70 not_found_space % ('f1', 1),
71 not_found_space % ('f1', 127),
72 No_such % ('f1', 127),
75 test.must_contain_any_line(test.stderr(), errs, find=TestSCons.search_re)
77 test.pass_test()
79 # Local Variables:
80 # tab-width:4
81 # indent-tabs-mode:nil
82 # End:
83 # vim: set expandtab tabstop=4 shiftwidth=4: