This repository has been archived by the owner on Nov 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
/
wpt_run_step.py
89 lines (74 loc) · 3.06 KB
/
wpt_run_step.py
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
# Copyright 2018 The WPT Dashboard Project. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from buildbot.plugins import steps
from buildbot.plugins import util
class WptRunStep(steps.ShellCommand):
name = util.Interpolate(
'WPT Run ' +
'(%(prop:browser_name)s, %(prop:this_chunk)s of %(prop:total_chunks)s)'
)
def __init__(self, *args, **kwargs):
kwargs['name'] = self.name
kwargs['command'] = self.makeWptRunCommand
kwargs['logfiles'] = {
'sauce-connect-log': {
'filename': '/tmp/sc.log',
'follow': True
}
}
super(WptRunStep, self).__init__(*args, **kwargs)
@staticmethod
@util.renderer
def makeWptRunCommand(properties):
browser_id = None
browser_name = properties.getProperty('browser_name')
command = [
'./wpt', 'run',
'--install-fonts',
'--log-wptreport', properties.getProperty('log_wptreport'),
'--log-raw', properties.getProperty('log_raw'),
'--this-chunk', properties.getProperty('this_chunk'),
'--total-chunks', properties.getProperty('total_chunks')
]
if properties.getProperty('use_sauce_labs'):
if browser_name == 'edge':
sauce_browser_name = 'MicrosoftEdge'
else:
sauce_browser_name = browser_name
browser_id = util.Interpolate(
'sauce:%(kw:sauce_browser_name)s:%(prop:browser_version)s',
sauce_browser_name=sauce_browser_name
)
sauce_platform_id = util.Interpolate(
'%(prop:os_name)s %(prop:os_version)s'
)
command.extend([
'--sauce-platform', sauce_platform_id,
'--sauce-user', util.Interpolate('%(secret:sauce_labs_user)s'),
'--sauce-key', util.Interpolate('%(secret:sauce_labs_key)s'),
'--sauce-tunnel-id', properties.getProperty('workername'),
'--sauce-connect-binary', 'sc',
'--no-restart-on-unexpected',
'--run-by-dir', '3'
])
else:
command = ['xvfb-run', '--auto-servernum'] + command
command.extend([
'--binary', properties.getProperty('browser_binary')
])
browser_id = browser_name
if browser_name == 'firefox':
# temporary fix to allow WebRTC tests to call getUserMedia
command.extend([
'--setpref', 'media.navigator.streams.fake=true'
])
elif browser_name == 'chrome':
# This is intended as a temporary fix to allow the webrtc tests in
# Chrome to call getUserMedia without failing out.
command.extend([
'--binary-arg=--use-fake-ui-for-media-stream',
'--binary-arg=--use-fake-device-for-media-stream'
])
command.append(browser_id)
return command