~ubuntu-branches/ubuntu/raring/qtwebkit-source/raring-proposed

« back to all changes in this revision

Viewing changes to Tools/BuildSlaveSupport/kill-old-processes

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-02-18 14:24:18 UTC
  • Revision ID: package-import@ubuntu.com-20130218142418-eon0jmjg3nj438uy
Tags: upstream-2.3
ImportĀ upstreamĀ versionĀ 2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
# Copyright (C) 2010 Apple Inc.  All rights reserved.
 
3
# Copyright (C) 2011 Google Inc.  All rights reserved.
 
4
#
 
5
# Redistribution and use in source and binary forms, with or without
 
6
# modification, are permitted provided that the following conditions
 
7
# are met:
 
8
#
 
9
# 1.  Redistributions of source code must retain the above copyright
 
10
#     notice, this list of conditions and the following disclaimer.
 
11
# 2.  Redistributions in binary form must reproduce the above copyright
 
12
#     notice, this list of conditions and the following disclaimer in the
 
13
#     documentation and/or other materials provided with the distribution.
 
14
#
 
15
# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 
16
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 
17
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 
18
# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 
19
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 
20
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
21
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 
22
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
23
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 
24
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
25
 
 
26
import os, sys
 
27
 
 
28
 
 
29
def main():
 
30
    tasksToKillWin = [
 
31
        "cl.exe",
 
32
        "devenv.com",
 
33
        "devenv.exe",
 
34
        "DumpRenderTree.exe",
 
35
        "DumpRenderTree_debug.exe",
 
36
        "httpd.exe",
 
37
        "imagediff.exe",
 
38
        "imagediff_debug.exe",
 
39
        "jsc.exe",
 
40
        "jsc_debug.exe",
 
41
        "LightTPD.exe",
 
42
        "link.exe",
 
43
        "midl.exe",
 
44
        "perl.exe",
 
45
        "Safari.exe",
 
46
        "svn.exe",
 
47
        "testapi.exe",
 
48
        "testapi_debug.exe",
 
49
        "VcBuildHelper.exe",
 
50
        "wdiff.exe",
 
51
        "WebKit2WebProcess.exe",
 
52
        "WebKit2WebProcess_debug.exe",
 
53
        "WebKitTestRunner.exe",
 
54
        "WebKitTestRunner_debug.exe",
 
55
    ]
 
56
 
 
57
    tasksToKillMac = [
 
58
        "apache2",
 
59
        "cc1plus",
 
60
        "cc1objplus",
 
61
        "clang",
 
62
        "clang\+\+",
 
63
        "gcc-4.2",
 
64
        "httpd",
 
65
        "i686-apple-darwin10-gcc-4.2.1",
 
66
        "jsc",
 
67
        "make",
 
68
        "pboard", # FIXME: https://bugs.webkit.org/show_bug.cgi?id=81012
 
69
        "per5.12",
 
70
        "perl",
 
71
        "Problem Reporter",
 
72
        "ruby",
 
73
        "Safari Web Content",
 
74
        "Safari",
 
75
        "svn",
 
76
        "DumpRenderTree",
 
77
        "TestWebKitAPI Web Content",
 
78
        "TestWebKitAPI",
 
79
        "WebKitPluginAgen", # FIXME: Why no 't'?
 
80
        "WebKitTestRunner Web Content",
 
81
        "WebKitTestRunner",
 
82
        "WebProcess",
 
83
        "xcodebuild",
 
84
    ]
 
85
 
 
86
    taskToKillUnix = [
 
87
        "apache2",
 
88
        "cc1plus",
 
89
        "DumpRenderTree",
 
90
        "gold",
 
91
        "httpd",
 
92
        "ld",
 
93
        "make",
 
94
        "ruby",
 
95
        "svn",
 
96
        "webkit_unit_tests",
 
97
        "WebKitTestRunner",
 
98
        "Xvfb",
 
99
    ]
 
100
 
 
101
    if sys.platform == 'darwin':
 
102
        for task in tasksToKillMac:
 
103
            os.system("killall -9 -v -m " + task)
 
104
        # Kill all instances of python executing run-webkit-tests
 
105
        os.system("ps aux | grep -P '.+/Python .+(run_webkit_tests|run-webkit-tests)' | grep -v grep | awk '{print $2}' | xargs kill")
 
106
    elif sys.platform == 'cygwin' or sys.platform == 'win32':
 
107
        for task in tasksToKillWin:
 
108
            os.system("taskkill /t /f /im " + task)
 
109
    elif sys.platform.startswith('linux'):
 
110
        for task in taskToKillUnix:
 
111
            os.system("killall -9 -v " + task)
 
112
        os.system("ps aux | grep -P '.+/python .+(run_webkit_tests|run-webkit-tests)' | grep -v grep | awk '{print $2}' | xargs kill")
 
113
    else:
 
114
        sys.exit()
 
115
        # FIXME: Should we return an exit code based on how the kills went?
 
116
 
 
117
 
 
118
if __name__ == '__main__':
 
119
    sys.exit(main())