OLD | NEW |
---|---|
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Functions to setup xvfb, which is used by the linux machines. | 5 """Functions to setup xvfb, which is used by the linux machines. |
6 """ | 6 """ |
7 | 7 |
8 import os | 8 import os |
9 import platform | 9 import platform |
10 import signal | 10 import signal |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 if server_dir and os.path.exists(server_dir): | 65 if server_dir and os.path.exists(server_dir): |
66 cmd = os.path.join(server_dir, 'Xvfb.' + platform.architecture()[0]) | 66 cmd = os.path.join(server_dir, 'Xvfb.' + platform.architecture()[0]) |
67 if not os.path.exists(cmd): | 67 if not os.path.exists(cmd): |
68 cmd = os.path.join(server_dir, 'Xvfb') | 68 cmd = os.path.join(server_dir, 'Xvfb') |
69 if not os.path.exists(cmd): | 69 if not os.path.exists(cmd): |
70 print 'No Xvfb found in designated server path:', server_dir | 70 print 'No Xvfb found in designated server path:', server_dir |
71 raise Exception('No virtual server') | 71 raise Exception('No virtual server') |
72 | 72 |
73 # Start a virtual X server that we run the tests in. This makes it so we can | 73 # Start a virtual X server that we run the tests in. This makes it so we can |
74 # run the tests even if we didn't start the tests from an X session. | 74 # run the tests even if we didn't start the tests from an X session. |
75 proc = subprocess.Popen([cmd, display, '-screen', '0', '1024x768x24', '-ac'], | 75 proc = subprocess.Popen([cmd, display, '-screen', '0', '1024x768x24', '-ac', |
76 '-dpi', '96'], | |
pfeifer
2015/04/24 14:59:52
With HiDPI becoming more popular, it's conceivable
| |
76 stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | 77 stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
77 xvfb_pid_filename = _XvfbPidFilename(slave_build_name) | 78 xvfb_pid_filename = _XvfbPidFilename(slave_build_name) |
78 open(xvfb_pid_filename, 'w').write(str(proc.pid)) | 79 open(xvfb_pid_filename, 'w').write(str(proc.pid)) |
79 | 80 |
80 # Verify that Xvfb has started by using xdisplaycheck. | 81 # Verify that Xvfb has started by using xdisplaycheck. |
81 if xdisplaycheck_path and os.path.exists(xdisplaycheck_path): | 82 if xdisplaycheck_path and os.path.exists(xdisplaycheck_path): |
82 print 'Verifying Xvfb has started...' | 83 print 'Verifying Xvfb has started...' |
83 checkstarttime = time.time() | 84 checkstarttime = time.time() |
84 xdisplayproc = subprocess.Popen([xdisplaycheck_path], | 85 xdisplayproc = subprocess.Popen([xdisplaycheck_path], |
85 stdout=subprocess.PIPE, | 86 stdout=subprocess.PIPE, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 if os.path.exists(xvfb_pid_filename): | 129 if os.path.exists(xvfb_pid_filename): |
129 xvfb_pid = int(open(xvfb_pid_filename).read()) | 130 xvfb_pid = int(open(xvfb_pid_filename).read()) |
130 print 'Stopping Xvfb with pid %d ...' % xvfb_pid | 131 print 'Stopping Xvfb with pid %d ...' % xvfb_pid |
131 # If the process doesn't exist, we raise an exception that we can ignore. | 132 # If the process doesn't exist, we raise an exception that we can ignore. |
132 try: | 133 try: |
133 os.kill(xvfb_pid, signal.SIGKILL) | 134 os.kill(xvfb_pid, signal.SIGKILL) |
134 except OSError: | 135 except OSError: |
135 print '... killing failed, presuming unnecessary.' | 136 print '... killing failed, presuming unnecessary.' |
136 os.remove(xvfb_pid_filename) | 137 os.remove(xvfb_pid_filename) |
137 print 'Xvfb pid file removed' | 138 print 'Xvfb pid file removed' |
OLD | NEW |