| OLD | NEW |
| 1 # Copyright 2012 the V8 project authors. All rights reserved. | 1 # Copyright 2012 the V8 project authors. All rights reserved. |
| 2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
| 3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
| 4 # met: | 4 # met: |
| 5 # | 5 # |
| 6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
| 7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
| 9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
| 10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 prev_error_mode = SEM_INVALID_VALUE | 43 prev_error_mode = SEM_INVALID_VALUE |
| 44 try: | 44 try: |
| 45 import ctypes | 45 import ctypes |
| 46 prev_error_mode = \ | 46 prev_error_mode = \ |
| 47 ctypes.windll.kernel32.SetErrorMode(mode) #@UndefinedVariable | 47 ctypes.windll.kernel32.SetErrorMode(mode) #@UndefinedVariable |
| 48 except ImportError: | 48 except ImportError: |
| 49 pass | 49 pass |
| 50 return prev_error_mode | 50 return prev_error_mode |
| 51 | 51 |
| 52 | 52 |
| 53 def RunProcess(verbose, timeout, args, additional_env, **rest): | 53 def RunProcess(verbose, timeout, args, **rest): |
| 54 if verbose: print "#", " ".join(args) | 54 if verbose: print "#", " ".join(args) |
| 55 popen_args = args | 55 popen_args = args |
| 56 prev_error_mode = SEM_INVALID_VALUE | 56 prev_error_mode = SEM_INVALID_VALUE |
| 57 if utils.IsWindows(): | 57 if utils.IsWindows(): |
| 58 popen_args = subprocess.list2cmdline(args) | 58 popen_args = subprocess.list2cmdline(args) |
| 59 # Try to change the error mode to avoid dialogs on fatal errors. Don't | 59 # Try to change the error mode to avoid dialogs on fatal errors. Don't |
| 60 # touch any existing error mode flags by merging the existing error mode. | 60 # touch any existing error mode flags by merging the existing error mode. |
| 61 # See http://blogs.msdn.com/oldnewthing/archive/2004/07/27/198410.aspx. | 61 # See http://blogs.msdn.com/oldnewthing/archive/2004/07/27/198410.aspx. |
| 62 error_mode = SEM_NOGPFAULTERRORBOX | 62 error_mode = SEM_NOGPFAULTERRORBOX |
| 63 prev_error_mode = Win32SetErrorMode(error_mode) | 63 prev_error_mode = Win32SetErrorMode(error_mode) |
| 64 Win32SetErrorMode(error_mode | prev_error_mode) | 64 Win32SetErrorMode(error_mode | prev_error_mode) |
| 65 | 65 |
| 66 env = os.environ.copy() | 66 env = os.environ.copy() |
| 67 env.update(additional_env) | |
| 68 # GTest shard information is read by the V8 tests runner. Make sure it | 67 # GTest shard information is read by the V8 tests runner. Make sure it |
| 69 # doesn't leak into the execution of gtests we're wrapping. Those might | 68 # doesn't leak into the execution of gtests we're wrapping. Those might |
| 70 # otherwise apply a second level of sharding and as a result skip tests. | 69 # otherwise apply a second level of sharding and as a result skip tests. |
| 71 env.pop('GTEST_TOTAL_SHARDS', None) | 70 env.pop('GTEST_TOTAL_SHARDS', None) |
| 72 env.pop('GTEST_SHARD_INDEX', None) | 71 env.pop('GTEST_SHARD_INDEX', None) |
| 73 | 72 |
| 74 try: | 73 try: |
| 75 process = subprocess.Popen( | 74 process = subprocess.Popen( |
| 76 args=popen_args, | 75 args=popen_args, |
| 77 stdout=subprocess.PIPE, | 76 stdout=subprocess.PIPE, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 119 |
| 121 return output.Output( | 120 return output.Output( |
| 122 process.returncode, | 121 process.returncode, |
| 123 timeout_result[0], | 122 timeout_result[0], |
| 124 stdout.decode('utf-8', 'replace').encode('utf-8'), | 123 stdout.decode('utf-8', 'replace').encode('utf-8'), |
| 125 stderr.decode('utf-8', 'replace').encode('utf-8'), | 124 stderr.decode('utf-8', 'replace').encode('utf-8'), |
| 126 process.pid, | 125 process.pid, |
| 127 ) | 126 ) |
| 128 | 127 |
| 129 | 128 |
| 130 def Execute(args, verbose=False, timeout=None, env=None): | 129 def Execute(args, verbose=False, timeout=None): |
| 131 args = [ c for c in args if c != "" ] | 130 args = [ c for c in args if c != "" ] |
| 132 return RunProcess(verbose, timeout, args, env or {}) | 131 return RunProcess(verbose, timeout, args=args) |
| OLD | NEW |