OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright 2015 The Crashpad Authors. All rights reserved. | 3 # Copyright 2015 The Crashpad Authors. All rights reserved. |
4 # | 4 # |
5 # Licensed under the Apache License, Version 2.0 (the "License"); | 5 # Licensed under the Apache License, Version 2.0 (the "License"); |
6 # you may not use this file except in compliance with the License. | 6 # you may not use this file except in compliance with the License. |
7 # You may obtain a copy of the License at | 7 # You may obtain a copy of the License at |
8 # | 8 # |
9 # http://www.apache.org/licenses/LICENSE-2.0 | 9 # http://www.apache.org/licenses/LICENSE-2.0 |
10 # | 10 # |
11 # Unless required by applicable law or agreed to in writing, software | 11 # Unless required by applicable law or agreed to in writing, software |
12 # distributed under the License is distributed on an "AS IS" BASIS, | 12 # distributed under the License is distributed on an "AS IS" BASIS, |
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
14 # See the License for the specific language governing permissions and | 14 # See the License for the specific language governing permissions and |
15 # limitations under the License. | 15 # limitations under the License. |
16 | 16 |
17 import os | 17 import os |
18 import platform | 18 import platform |
19 import random | 19 import random |
20 import re | 20 import re |
21 import subprocess | 21 import subprocess |
22 import sys | 22 import sys |
23 import tempfile | 23 import tempfile |
| 24 import time |
24 | 25 |
25 g_temp_dirs = [] | 26 g_temp_dirs = [] |
26 | 27 |
27 | 28 |
28 def MakeTempDir(): | 29 def MakeTempDir(): |
29 global g_temp_dirs | 30 global g_temp_dirs |
30 new_dir = tempfile.mkdtemp() | 31 new_dir = tempfile.mkdtemp() |
31 g_temp_dirs.append(new_dir) | 32 g_temp_dirs.append(new_dir) |
32 return new_dir | 33 return new_dir |
33 | 34 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 print 'could not initialize report database' | 95 print 'could not initialize report database' |
95 return None | 96 return None |
96 | 97 |
97 if pipe_name is not None: | 98 if pipe_name is not None: |
98 handler = subprocess.Popen([ | 99 handler = subprocess.Popen([ |
99 os.path.join(out_dir, 'crashpad_handler.exe'), | 100 os.path.join(out_dir, 'crashpad_handler.exe'), |
100 '--pipe-name=' + pipe_name, | 101 '--pipe-name=' + pipe_name, |
101 '--database=' + test_database | 102 '--database=' + test_database |
102 ]) | 103 ]) |
103 | 104 |
| 105 # Wait until the server is ready. |
| 106 printed = False |
| 107 while not os.path.exists(pipe_name): |
| 108 if not printed: |
| 109 print 'Waiting for crashpad_handler to be ready...' |
| 110 printed = True |
| 111 time.sleep(0.1) |
| 112 |
104 subprocess.call([os.path.join(out_dir, executable_name), pipe_name]) | 113 subprocess.call([os.path.join(out_dir, executable_name), pipe_name]) |
105 else: | 114 else: |
106 subprocess.call([os.path.join(out_dir, executable_name), | 115 subprocess.call([os.path.join(out_dir, executable_name), |
107 os.path.join(out_dir, 'crashpad_handler.exe'), | 116 os.path.join(out_dir, 'crashpad_handler.exe'), |
108 test_database]) | 117 test_database]) |
109 | 118 |
110 out = subprocess.check_output([ | 119 out = subprocess.check_output([ |
111 os.path.join(out_dir, 'crashpad_database_util.exe'), | 120 os.path.join(out_dir, 'crashpad_database_util.exe'), |
112 '--database=' + test_database, | 121 '--database=' + test_database, |
113 '--show-completed-reports', | 122 '--show-completed-reports', |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 z7_dump_path, | 304 z7_dump_path, |
296 pipe_name) | 305 pipe_name) |
297 | 306 |
298 return 0 | 307 return 0 |
299 finally: | 308 finally: |
300 CleanUpTempDirs() | 309 CleanUpTempDirs() |
301 | 310 |
302 | 311 |
303 if __name__ == '__main__': | 312 if __name__ == '__main__': |
304 sys.exit(main(sys.argv[1:])) | 313 sys.exit(main(sys.argv[1:])) |
OLD | NEW |