| 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 # |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 '-z', dump_path, | 126 '-z', dump_path, |
| 127 '-c', command + ';q' | 127 '-c', command + ';q' |
| 128 ]) | 128 ]) |
| 129 | 129 |
| 130 def Check(self, pattern, message, re_flags=0): | 130 def Check(self, pattern, message, re_flags=0): |
| 131 match_obj = re.search(pattern, self.out, re_flags) | 131 match_obj = re.search(pattern, self.out, re_flags) |
| 132 if match_obj: | 132 if match_obj: |
| 133 # Matched. Consume up to end of match. | 133 # Matched. Consume up to end of match. |
| 134 self.out = self.out[match_obj.end(0):] | 134 self.out = self.out[match_obj.end(0):] |
| 135 print 'ok - %s' % message | 135 print 'ok - %s' % message |
| 136 sys.stdout.flush() |
| 136 else: | 137 else: |
| 137 print >>sys.stderr, '-' * 80 | 138 print >>sys.stderr, '-' * 80 |
| 138 print >>sys.stderr, 'FAILED - %s' % message | 139 print >>sys.stderr, 'FAILED - %s' % message |
| 139 print >>sys.stderr, '-' * 80 | 140 print >>sys.stderr, '-' * 80 |
| 140 print >>sys.stderr, 'did not match:\n %s' % pattern | 141 print >>sys.stderr, 'did not match:\n %s' % pattern |
| 141 print >>sys.stderr, '-' * 80 | 142 print >>sys.stderr, '-' * 80 |
| 142 print >>sys.stderr, 'remaining output was:\n %s' % self.out | 143 print >>sys.stderr, 'remaining output was:\n %s' % self.out |
| 143 print >>sys.stderr, '-' * 80 | 144 print >>sys.stderr, '-' * 80 |
| 145 sys.stderr.flush() |
| 144 sys.exit(1) | 146 sys.exit(1) |
| 145 | 147 |
| 146 | 148 |
| 147 def RunTests(cdb_path, dump_path, pipe_name): | 149 def RunTests(cdb_path, dump_path, pipe_name): |
| 148 """Runs various tests in sequence. Runs a new cdb instance on the dump for | 150 """Runs various tests in sequence. Runs a new cdb instance on the dump for |
| 149 each block of tests to reduce the chances that output from one command is | 151 each block of tests to reduce the chances that output from one command is |
| 150 confused for output from another. | 152 confused for output from another. |
| 151 """ | 153 """ |
| 152 out = CdbRun(cdb_path, dump_path, '.ecxr') | 154 out = CdbRun(cdb_path, dump_path, '.ecxr') |
| 153 out.Check('This dump file has an exception of interest stored in it', | 155 out.Check('This dump file has an exception of interest stored in it', |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 211 |
| 210 RunTests(cdb_path, dump_path, pipe_name) | 212 RunTests(cdb_path, dump_path, pipe_name) |
| 211 | 213 |
| 212 return 0 | 214 return 0 |
| 213 finally: | 215 finally: |
| 214 CleanUpTempDirs() | 216 CleanUpTempDirs() |
| 215 | 217 |
| 216 | 218 |
| 217 if __name__ == '__main__': | 219 if __name__ == '__main__': |
| 218 sys.exit(main(sys.argv[1:])) | 220 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |