summaryrefslogtreecommitdiffstats
path: root/WebKitTools/BuildSlaveSupport/build.webkit.org-config/webkit/steps.py
blob: c1933a3c7b8eb2dc4b3015f99f8cca3c508eb25d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
from webkit.basesteps import ShellCommand, SVN, Test, Compile, UploadCommand
from buildbot.status.builder import SUCCESS, FAILURE, WARNINGS

class CheckOutSource(SVN):
    svnurl = "http://svn.webkit.org/repository/webkit/trunk"
    mode = "update"
    def __init__(self, *args, **kwargs):
        SVN.__init__(self, svnurl=self.svnurl, mode=self.mode, *args, **kwargs)

class SetConfiguration(ShellCommand):
    command = ["./WebKitTools/Scripts/set-webkit-configuration"]
    
    def __init__(self, *args, **kwargs):
        configuration = kwargs.pop('configuration')
        self.command = self.command + ['--' + configuration]
        self.name = "set-configuration-%s" % (configuration,  )
        self.description = ["set configuration %s" % (configuration, )]
        self.descriptionDone = ["set configuration %s" % (configuration, )]
        ShellCommand.__init__(self, *args, **kwargs)


class LayoutTest(Test):
    name = "layout-test"
    description = ["layout-tests running"]
    descriptionDone = ["layout-tests"]
    command = ["./WebKitTools/Scripts/run-webkit-tests", "--no-launch-safari", "--no-new-test-results", "--results-directory", "layout-test-results"]

    def commandComplete(self, cmd):
        Test.commandComplete(self, cmd)
        
        logText = cmd.logs['stdio'].getText()
        incorrectLayoutLines = [line for line in logText.splitlines() if line.find('had incorrect layout') >= 0 or (line.find('test case') >= 0 and line.find(' crashed') >= 0)]
        if incorrectLayoutLines:
            self.incorrectLayoutLines = incorrectLayoutLines
        else:
            self.incorrectLayoutLines = None

    def getText(self, cmd, results):
        return self.getText2(cmd, results)

    def getText2(self, cmd, results):
        if results != SUCCESS and self.incorrectLayoutLines:
            return self.incorrectLayoutLines

        return [self.name]


class JavaScriptCoreTest(Test):
    name = "jscore-test"
    description = ["jscore-tests running"]
    descriptionDone = ["jscore-tests"]
    command = ["./WebKitTools/Scripts/run-javascriptcore-tests"]
    logfiles = {'results': 'JavaScriptCore/tests/mozilla/actual.html'}

    def commandComplete(self, cmd):
        Test.commandComplete(self, cmd)

        logText = cmd.logs['stdio'].getText()
        statusLines = [line for line in logText.splitlines() if line.find('regression') >= 0 and line.find(' found.') >= 0]
        if statusLines and statusLines[0].split()[0] != '0':
            self.regressionLine = statusLines[0]
        else:
            self.regressionLine = None

    def evaluateCommand(self, cmd):
        if cmd.rc != 0:
            return FAILURE

        if self.regressionLine:
            return FAILURE

        return SUCCESS

    def getText(self, cmd, results):
        return self.getText2(cmd, results)

    def getText2(self, cmd, results):
        if results != SUCCESS and self.regressionLine:
            return [self.name, self.regressionLine]

        return [self.name]

class PixelLayoutTest(LayoutTest):
    name = "pixel-layout-test"
    description = ["pixel-layout-tests running"]
    descriptionDone = ["pixel-layout-tests"]
    command = LayoutTest.command + ["--pixel"]

    
class LeakTest(Test):
    name = "leak-test"
    description = ["leak-tests running"]
    descriptionDone = ["leak-tests"]
    command = ["./WebKitTools/Scripts/run-webkit-tests", "--no-launch-safari", "--leaks", "--results-directory", "layout-test-results"]

    def commandComplete(self, cmd):
        Test.commandComplete(self, cmd)

        logText = cmd.logs['stdio'].getText()
        lines = logText.splitlines()
        self.totalLeakLines = [line for line in lines if line.find('total leaks found!') >= 0]
        self.totalLeakLines += [line for line in lines if line.find('LEAK: ') >= 0]
        self.totalLeakLines = [' '.join(x.split()[1:]) for x in self.totalLeakLines]
        self.totalLeakLines += [line for line in lines if line.find('test case') >= 0 and line.find('crashed') >= 0]


    def evaluateCommand(self, cmd):
        if cmd.rc != 0:
            return FAILURE

        if self.totalLeakLines:
            return FAILURE

        return SUCCESS

    def getText(self, cmd, results):
        return self.getText2(cmd, results)

    def getText2(self, cmd, results):
        if results != SUCCESS and self.totalLeakLines:
            return self.totalLeakLines
        return [self.name]


class UploadLayoutResults(UploadCommand, ShellCommand):
    name = "upload-results"
    description = ["uploading results"]
    descriptionDone = ["uploaded-results"]
    command = "echo Disabled for now"

    def __init__(self, *args, **kwargs):
        ShellCommand.__init__(self, *args, **kwargs)

    def setBuild(self, build):
        ShellCommand.setBuild(self, build)
        self.initializeForUpload()

        self.command = '''\
        if [[ -d layout-test-results ]]; then \
            find layout-test-results -type d -print0 | xargs -0 chmod ug+rx; \
            find layout-test-results -type f -print0 | xargs -0 chmod ug+r; \
            rsync -rlvzP --rsync-path="/home/buildresults/bin/rsync" layout-test-results/ %s && rm -rf layout-test-results; \
        fi; \
        CRASH_LOG=~/Library/Logs/CrashReporter/DumpRenderTree*.crash*; \
        if [[ -f $(ls -1 $CRASH_LOG | head -n 1 ) ]]; then \
            chmod ug+r $CRASH_LOG; \
            rsync -rlvzP --rsync-path="/home/buildresults/bin/rsync" $CRASH_LOG %s && rm -rf $CRASH_LOG; \
        fi;''' % (self.getRemotePath(), self.getRemotePath())

        self.addFactoryArguments(command=self.command)


class CompileWebKit(Compile):
    command = ["./WebKitTools/Scripts/build-webkit", "--no-color"]
    env = {'WEBKITSUPPORTLIBRARIESZIPDIR': 'C:\\cygwin\\home\\buildbot'}
    def __init__(self, *args, **kwargs):
        configuration = kwargs.pop('configuration')
        
        self.name = "compile-" + configuration
        self.description = ["compiling " + configuration]
        self.descriptionDone = ["compiled " + configuration]

        Compile.__init__(self, *args, **kwargs)


class CompileWebKitNoSVG(CompileWebKit):
    command = 'rm -rf WebKitBuild && ./WebKitTools/Scripts/build-webkit --no-svg --no-color'

class CompileWebKitGtk(CompileWebKit):
    command = CompileWebKit.command + ['--gtk']

class JavaScriptCoreTestGtk(JavaScriptCoreTest):
    command = JavaScriptCoreTest.command + ['--gtk']

class InstallWin32Dependencies(ShellCommand):
    description = ["installing Windows dependencies"]
    descriptionDone = ["installed Windows dependencies"]
    command = ["WebKitTools/Scripts/update-webkit-auxiliary-libs"]


# class UploadDiskImage(UploadCommand, ShellCommand):
#     description = ["uploading disk image"]
#     descriptionDone = ["uploaded disk image"]
#     name = "upload-disk-image"

#     def __init__(self, *args, **kwargs):
#         UploadCommand.__init__(self, *args, **kwargs)
#         self.command = 'umask 002 && ./WebKitTools/BuildSlaveSupport/build-launcher-app && ./WebKitTools/BuildSlaveSupport/build-launcher-dmg --upload-to-host %s' % (self.getRemotePath(), )
#         ShellCommand.__init__(self, *args, **kwargs)

class GenerateCoverageData(Compile):
    command = ["./WebKitTools/Scripts/generate-coverage-data"]
    description = ["generating coverage data"]
    descriptionDone = ["generated coverage data"]


class UploadCoverageData(UploadCommand, ShellCommand):
    name = "upload-coverage-data"
    description = ["uploading coverage data"]
    descriptionDone = ["uploaded-coverage-data"]
    command = "echo Disabled for now"

    def __init__(self, *args, **kwargs):
        ShellCommand.__init__(self, *args, **kwargs)

    def setBuild(self, build):
        ShellCommand.setBuild(self, build)
        self.initializeForUpload()
        
        self.command = '''\
        if [[ -d WebKitBuild/Coverage/html ]]; then \
            find WebKitBuild/Coverage/html -type d -print0 | xargs -0 chmod ug+rx; \
            find WebKitBuild/Coverage/html -type f -print0 | xargs -0 chmod ug+r; \
            rsync -rlvzP --rsync-path="/home/buildresults/bin/rsync" WebKitBuild/Coverage/html/ %s && rm -rf WebKitBuild/Coverage/html; \
        fi;''' % (self.getRemotePath(), )

        self.addFactoryArguments(command=self.command)

    def getURLPath(self):
        return "/results/code-coverage/"