summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorhayato@chromium.org <hayato@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-06 06:49:08 +0000
committerhayato@chromium.org <hayato@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-06 06:49:08 +0000
commitce256d15b4fd1758c78282d3d241f79d347602ea (patch)
treec51b64329cb86d927e69dc1c81e45ffcf7a313f3 /webkit
parent3d113de55bdfa9ec6cf9ae87dda5f264fca5b5fd (diff)
downloadchromium_src-ce256d15b4fd1758c78282d3d241f79d347602ea.zip
chromium_src-ce256d15b4fd1758c78282d3d241f79d347602ea.tar.gz
chromium_src-ce256d15b4fd1758c78282d3d241f79d347602ea.tar.bz2
Get rid of duplicated code in platform_util_xxx.py
TEST=none BUG=7199 Review URL: http://codereview.chromium.org/465117 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35615 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/tools/layout_tests/layout_package/platform_utils_linux.py23
-rw-r--r--webkit/tools/layout_tests/layout_package/platform_utils_mac.py33
2 files changed, 27 insertions, 29 deletions
diff --git a/webkit/tools/layout_tests/layout_package/platform_utils_linux.py b/webkit/tools/layout_tests/layout_package/platform_utils_linux.py
index a340dd2..b95d57e 100644
--- a/webkit/tools/layout_tests/layout_package/platform_utils_linux.py
+++ b/webkit/tools/layout_tests/layout_package/platform_utils_linux.py
@@ -78,8 +78,7 @@ def LigHTTPdPHPPath():
def WDiffPath():
"""Path to the WDiff executable, which we assume is already installed and
- in the user's $PATH.
- """
+ in the user's $PATH."""
return 'wdiff'
def ImageDiffPath(target):
@@ -134,12 +133,8 @@ def ShutDownHTTPServer(server_pid):
if server_pid is None:
# This isn't ideal, since it could conflict with web server processes not
# started by http_server.py, but good enough for now.
- null = open("/dev/null");
- subprocess.call(['killall', '-TERM', '-u', os.getenv('USER'), 'lighttpd'],
- stderr=null)
- subprocess.call(['killall', '-TERM', '-u', os.getenv('USER'), 'apache2'],
- stderr=null)
- null.close()
+ KillAllProcess('lighttpd')
+ KillAllProcess('apache2')
else:
try:
os.kill(server_pid, signal.SIGTERM)
@@ -157,11 +152,15 @@ def KillProcess(pid):
"""
os.kill(pid, signal.SIGKILL)
+def KillAllProcess(process_name):
+ null = open("/dev/null");
+ subprocess.call(['killall', '-TERM', '-u', os.getenv('USER'), process_name],
+ stderr=null)
+ null.close()
+
def KillAllTestShells():
- """Kills all instances of the test_shell binary currently running."""
- subprocess.Popen(('killall', '-TERM', 'test_shell'),
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE).wait()
+ """Kills all instances of the test_shell binary currently running."""
+ KillAllProcess('test_shell')
#
# Private helper functions
diff --git a/webkit/tools/layout_tests/layout_package/platform_utils_mac.py b/webkit/tools/layout_tests/layout_package/platform_utils_mac.py
index 7065a59..c375a18 100644
--- a/webkit/tools/layout_tests/layout_package/platform_utils_mac.py
+++ b/webkit/tools/layout_tests/layout_package/platform_utils_mac.py
@@ -52,7 +52,7 @@ def BaselineSearchPath(all_versions=False):
def WDiffPath():
"""Path to the WDiff executable, which we assume is already installed and
- in the user's $PATH."""
+ in the user's $PATH."""
return 'wdiff'
def ImageDiffPath(target):
@@ -111,18 +111,8 @@ def ShutDownHTTPServer(server_pid):
if server_pid is None:
# TODO(mmoss) This isn't ideal, since it could conflict with lighttpd
# processes not started by http_server.py, but good enough for now.
-
- # On 10.6, killall has a new constraint: -SIGNALNAME or
- # -SIGNALNUMBER must come first. Example problem:
- # $ killall -u $USER -TERM lighttpd
- # killall: illegal option -- T
- # Use of the earlier -TERM placement is just fine on 10.5.
- null = open("/dev/null");
- subprocess.call(['killall', '-TERM', '-u', os.getenv('USER'), 'lighttpd'],
- stderr=null)
- subprocess.call(['killall', '-TERM', '-u', os.getenv('USER'), 'httpd'],
- stderr=null)
- null.close()
+ KillAllProcess('lighttpd')
+ KillAllProcess('httpd')
else:
try:
os.kill(server_pid, signal.SIGTERM)
@@ -140,8 +130,17 @@ def KillProcess(pid):
"""
os.kill(pid, signal.SIGKILL)
+def KillAllProcess(process_name):
+ # On Mac OS X 10.6, killall has a new constraint: -SIGNALNAME or
+ # -SIGNALNUMBER must come first. Example problem:
+ # $ killall -u $USER -TERM lighttpd
+ # killall: illegal option -- T
+ # Use of the earlier -TERM placement is just fine on 10.5.
+ null = open("/dev/null");
+ subprocess.call(['killall', '-TERM', '-u', os.getenv('USER'), process_name],
+ stderr=null)
+ null.close()
+
def KillAllTestShells():
- """Kills all instances of the test_shell binary currently running."""
- subprocess.Popen(('killall', '-TERM', 'test_shell'),
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE).wait()
+ """Kills all instances of the test_shell binary currently running."""
+ KillAllProcess('TestShell')