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 while not os.path.exists(pipe_name): | |
107 print 'Waiting for crashpad_handler to be ready...' | |
Mark Mentovai
2015/11/06 23:32:35
Only print this the first time. If crashpad_handle
scottmg
2015/11/06 23:53:40
Done.
| |
108 time.sleep(0.1) | |
109 | |
104 subprocess.call([os.path.join(out_dir, executable_name), pipe_name]) | 110 subprocess.call([os.path.join(out_dir, executable_name), pipe_name]) |
105 else: | 111 else: |
106 subprocess.call([os.path.join(out_dir, executable_name), | 112 subprocess.call([os.path.join(out_dir, executable_name), |
107 os.path.join(out_dir, 'crashpad_handler.exe'), | 113 os.path.join(out_dir, 'crashpad_handler.exe'), |
108 test_database]) | 114 test_database]) |
109 | 115 |
110 out = subprocess.check_output([ | 116 out = subprocess.check_output([ |
111 os.path.join(out_dir, 'crashpad_database_util.exe'), | 117 os.path.join(out_dir, 'crashpad_database_util.exe'), |
112 '--database=' + test_database, | 118 '--database=' + test_database, |
113 '--show-completed-reports', | 119 '--show-completed-reports', |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
295 z7_dump_path, | 301 z7_dump_path, |
296 pipe_name) | 302 pipe_name) |
297 | 303 |
298 return 0 | 304 return 0 |
299 finally: | 305 finally: |
300 CleanUpTempDirs() | 306 CleanUpTempDirs() |
301 | 307 |
302 | 308 |
303 if __name__ == '__main__': | 309 if __name__ == '__main__': |
304 sys.exit(main(sys.argv[1:])) | 310 sys.exit(main(sys.argv[1:])) |
OLD | NEW |