| OLD | NEW |
| 1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
| 2 # Copyright (C) 2009 Daniel Bates (dbates@intudata.com). All rights reserved. | 2 # Copyright (C) 2009 Daniel Bates (dbates@intudata.com). All rights reserved. |
| 3 # | 3 # |
| 4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
| 6 # met: | 6 # met: |
| 7 # | 7 # |
| 8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
| 9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
| 10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 | 29 |
| 30 import os | 30 import os |
| 31 import errno | |
| 32 import signal | |
| 33 import subprocess | 31 import subprocess |
| 34 import sys | 32 import sys |
| 35 import unittest | 33 import unittest |
| 36 | 34 |
| 37 # Since we execute this script directly as part of the unit tests, we need to en
sure | 35 # Since we execute this script directly as part of the unit tests, we need to en
sure |
| 38 # that Tools/Scripts is in sys.path for the next imports to work correctly. | 36 # that Tools/Scripts is in sys.path for the next imports to work correctly. |
| 39 script_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.
path.abspath(__file__))))) | 37 script_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.
path.abspath(__file__))))) |
| 40 if script_dir not in sys.path: | 38 if script_dir not in sys.path: |
| 41 sys.path.append(script_dir) | 39 sys.path.append(script_dir) |
| 42 | 40 |
| 43 | |
| 44 from webkitpy.common.system.executive import Executive, ScriptError | 41 from webkitpy.common.system.executive import Executive, ScriptError |
| 45 from webkitpy.common.system.filesystem_mock import MockFileSystem | 42 from webkitpy.common.system.filesystem_mock import MockFileSystem |
| 46 | 43 |
| 47 | 44 |
| 48 class ScriptErrorTest(unittest.TestCase): | 45 class ScriptErrorTest(unittest.TestCase): |
| 49 | 46 |
| 50 def test_message_with_output(self): | 47 def test_message_with_output(self): |
| 51 error = ScriptError('My custom message!', '', -1) | 48 error = ScriptError('My custom message!', '', -1) |
| 52 self.assertEqual(error.message_with_output(), 'My custom message!') | 49 self.assertEqual(error.message_with_output(), 'My custom message!') |
| 53 error = ScriptError('My custom message!', '', -1, 'My output.') | 50 error = ScriptError('My custom message!', '', -1, 'My output.') |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 import msvcrt | 215 import msvcrt |
| 219 msvcrt.setmode(stdout.fileno(), os.O_BINARY) | 216 msvcrt.setmode(stdout.fileno(), os.O_BINARY) |
| 220 if cmd == '--cat': | 217 if cmd == '--cat': |
| 221 stdout.write(stdin.read()) | 218 stdout.write(stdin.read()) |
| 222 elif cmd == '--echo': | 219 elif cmd == '--echo': |
| 223 stdout.write(' '.join(args)) | 220 stdout.write(' '.join(args)) |
| 224 return 0 | 221 return 0 |
| 225 | 222 |
| 226 if __name__ == '__main__' and len(sys.argv) > 1 and sys.argv[1] in ('--cat', '--
echo'): | 223 if __name__ == '__main__' and len(sys.argv) > 1 and sys.argv[1] in ('--cat', '--
echo'): |
| 227 sys.exit(main(sys.platform, sys.stdin, sys.stdout, sys.argv[1], sys.argv[2:]
)) | 224 sys.exit(main(sys.platform, sys.stdin, sys.stdout, sys.argv[1], sys.argv[2:]
)) |
| OLD | NEW |