Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(405)

Side by Side Diff: Tools/Scripts/webkitpy/common/system/executive.py

Issue 1154373005: Introduce WPTServe for running W3C Blink Layout tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add executable bit to pass permchecks. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Tools/Scripts/webkitpy/layout_tests/controllers/manager.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2009, Google Inc. All rights reserved. 1 # Copyright (c) 2009, Google Inc. All rights reserved.
2 # Copyright (c) 2009 Apple Inc. All rights reserved. 2 # Copyright (c) 2009 Apple Inc. 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 def command_name(self): 79 def command_name(self):
80 command_path = self.script_args 80 command_path = self.script_args
81 if type(command_path) is list: 81 if type(command_path) is list:
82 command_path = command_path[0] 82 command_path = command_path[0]
83 return os.path.basename(command_path) 83 return os.path.basename(command_path)
84 84
85 85
86 class Executive(object): 86 class Executive(object):
87 PIPE = subprocess.PIPE 87 PIPE = subprocess.PIPE
88 STDOUT = subprocess.STDOUT 88 STDOUT = subprocess.STDOUT
89 DEVNULL = open(os.devnull, 'wb')
89 90
90 def _should_close_fds(self): 91 def _should_close_fds(self):
91 # We need to pass close_fds=True to work around Python bug #2320 92 # We need to pass close_fds=True to work around Python bug #2320
92 # (otherwise we can hang when we kill DumpRenderTree when we are running 93 # (otherwise we can hang when we kill DumpRenderTree when we are running
93 # multiple threads). See http://bugs.python.org/issue2320 . 94 # multiple threads). See http://bugs.python.org/issue2320 .
94 # Note that close_fds isn't supported on Windows, but this bug only 95 # Note that close_fds isn't supported on Windows, but this bug only
95 # shows up on Mac and Linux. 96 # shows up on Mac and Linux.
96 return sys.platform not in ('win32', 'cygwin') 97 return sys.platform not in ('win32', 'cygwin')
97 98
98 def _run_command_with_teed_output(self, args, teed_output, **kwargs): 99 def _run_command_with_teed_output(self, args, teed_output, **kwargs):
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 if not self._should_encode_child_process_arguments(): 417 if not self._should_encode_child_process_arguments():
417 return argument 418 return argument
418 return argument.encode(self._child_process_encoding()) 419 return argument.encode(self._child_process_encoding())
419 420
420 def _stringify_args(self, args): 421 def _stringify_args(self, args):
421 # Popen will throw an exception if args are non-strings (like int()) 422 # Popen will throw an exception if args are non-strings (like int())
422 string_args = map(unicode, args) 423 string_args = map(unicode, args)
423 # The Windows implementation of Popen cannot handle unicode strings. :( 424 # The Windows implementation of Popen cannot handle unicode strings. :(
424 return map(self._encode_argument_if_needed, string_args) 425 return map(self._encode_argument_if_needed, string_args)
425 426
426 # The only required arugment to popen is named "args", the rest are optional keyword arguments. 427 # The only required argument to popen is named "args", the rest are optional keyword arguments.
427 def popen(self, args, **kwargs): 428 def popen(self, args, **kwargs):
428 # FIXME: We should always be stringifying the args, but callers who pass shell=True 429 # FIXME: We should always be stringifying the args, but callers who pass shell=True
429 # expect that the exact bytes passed will get passed to the shell (even if they're wrongly encoded). 430 # expect that the exact bytes passed will get passed to the shell (even if they're wrongly encoded).
430 # shell=True is wrong for many other reasons, and we should remove this 431 # shell=True is wrong for many other reasons, and we should remove this
431 # hack as soon as we can fix all callers to not use shell=True. 432 # hack as soon as we can fix all callers to not use shell=True.
432 if kwargs.get('shell') == True: 433 if kwargs.get('shell') == True:
433 string_args = args 434 string_args = args
434 else: 435 else:
435 string_args = self._stringify_args(args) 436 string_args = self._stringify_args(args)
436 return subprocess.Popen(string_args, **kwargs) 437 return subprocess.Popen(string_args, **kwargs)
(...skipping 16 matching lines...) Expand all
453 pool.close() 454 pool.close()
454 pool.join() 455 pool.join()
455 456
456 457
457 def _run_command_thunk(cmd_line_and_cwd): 458 def _run_command_thunk(cmd_line_and_cwd):
458 # Note that this needs to be a bare module (and hence Picklable) method to w ork with multiprocessing.Pool. 459 # Note that this needs to be a bare module (and hence Picklable) method to w ork with multiprocessing.Pool.
459 (cmd_line, cwd) = cmd_line_and_cwd 460 (cmd_line, cwd) = cmd_line_and_cwd
460 proc = subprocess.Popen(cmd_line, cwd=cwd, stdout=subprocess.PIPE, stderr=su bprocess.PIPE) 461 proc = subprocess.Popen(cmd_line, cwd=cwd, stdout=subprocess.PIPE, stderr=su bprocess.PIPE)
461 stdout, stderr = proc.communicate() 462 stdout, stderr = proc.communicate()
462 return (proc.returncode, stdout, stderr) 463 return (proc.returncode, stdout, stderr)
OLDNEW
« no previous file with comments | « no previous file | Tools/Scripts/webkitpy/layout_tests/controllers/manager.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698