OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Runs the test with xvfb on linux. Runs the test normally on other platforms. | 6 """Runs the test with xvfb on linux. Runs the test normally on other platforms. |
7 | 7 |
8 For simplicity in gyp targets, this script just runs the test normal on | 8 For simplicity in gyp targets, this script just runs the test normal on |
9 non-linux platforms. | 9 non-linux platforms. |
10 """ | 10 """ |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 | 58 |
59 def wait_for_xvfb(xdisplaycheck, env): | 59 def wait_for_xvfb(xdisplaycheck, env): |
60 """Waits for xvfb to be fully initialized by using xdisplaycheck.""" | 60 """Waits for xvfb to be fully initialized by using xdisplaycheck.""" |
61 try: | 61 try: |
62 subprocess.check_call( | 62 subprocess.check_call( |
63 [xdisplaycheck], | 63 [xdisplaycheck], |
64 stdout=subprocess.PIPE, | 64 stdout=subprocess.PIPE, |
65 stderr=subprocess.STDOUT, | 65 stderr=subprocess.STDOUT, |
66 env=env) | 66 env=env) |
| 67 except OSError: |
| 68 print >> sys.stderr, 'Failed to load %s with cwd=%s' % ( |
| 69 xdisplaycheck, os.getcwd()) |
| 70 return False |
67 except subprocess.CalledProcessError: | 71 except subprocess.CalledProcessError: |
68 print >> sys.stderr, 'Xvfb failed to load properly.' | 72 print >> sys.stderr, ( |
| 73 'Xvfb failed to load properly while trying to run %s' % xdisplaycheck) |
69 return False | 74 return False |
70 return True | 75 return True |
71 | 76 |
72 | 77 |
73 def run_executable(cmd, build_dir, env): | 78 def run_executable(cmd, build_dir, env): |
74 """Runs an executable within a xvfb buffer on linux or normally on other | 79 """Runs an executable within a xvfb buffer on linux or normally on other |
75 platforms. | 80 platforms. |
76 | 81 |
77 Requires that both xvfb and icewm are installed on linux. | 82 Requires that both xvfb and icewm are installed on linux. |
78 """ | 83 """ |
(...skipping 20 matching lines...) Expand all Loading... |
99 def main(): | 104 def main(): |
100 if len(sys.argv) < 3: | 105 if len(sys.argv) < 3: |
101 print >> sys.stderr, ( | 106 print >> sys.stderr, ( |
102 'Usage: xvfb.py [path to build_dir] [command args...]') | 107 'Usage: xvfb.py [path to build_dir] [command args...]') |
103 return 2 | 108 return 2 |
104 return run_executable(sys.argv[2:], sys.argv[1], os.environ.copy()) | 109 return run_executable(sys.argv[2:], sys.argv[1], os.environ.copy()) |
105 | 110 |
106 | 111 |
107 if __name__ == "__main__": | 112 if __name__ == "__main__": |
108 sys.exit(main()) | 113 sys.exit(main()) |
OLD | NEW |