| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright 2016 The Chromium Authors. All rights reserved. | 2 # Copyright 2016 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 """Run a test. | 6 """Run a test. |
| 7 | 7 |
| 8 Sample usage: | 8 Sample usage: |
| 9 ./run.py \ | 9 ./run.py \ |
| 10 -a src/xcodebuild/Release-iphoneos/base_unittests.app \ | 10 -a src/xcodebuild/Release-iphoneos/base_unittests.app \ |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 # test_runner.Launch returns 0 on success, 1 on failure, so return 2 | 64 # test_runner.Launch returns 0 on success, 1 on failure, so return 2 |
| 65 # on exception to distinguish between a test failure, and a failure | 65 # on exception to distinguish between a test failure, and a failure |
| 66 # to launch the test at all. | 66 # to launch the test at all. |
| 67 return 2 | 67 return 2 |
| 68 finally: | 68 finally: |
| 69 if tr: | 69 if tr: |
| 70 summary['logs'] = tr.logs | 70 summary['logs'] = tr.logs |
| 71 | 71 |
| 72 with open(os.path.join(args.out_dir, 'summary.json'), 'w') as f: | 72 with open(os.path.join(args.out_dir, 'summary.json'), 'w') as f: |
| 73 json.dump(summary, f) | 73 json.dump(summary, f) |
| 74 if tr: |
| 75 with open(os.path.join(args.out_dir, 'full_results.json'), 'w') as f: |
| 76 json.dump(tr.test_results, f) |
| 77 |
| 74 | 78 |
| 75 | 79 |
| 76 if __name__ == '__main__': | 80 if __name__ == '__main__': |
| 77 parser = argparse.ArgumentParser() | 81 parser = argparse.ArgumentParser() |
| 78 | 82 |
| 79 parser.add_argument( | 83 parser.add_argument( |
| 80 '-a', | 84 '-a', |
| 81 '--app', | 85 '--app', |
| 82 help='Compiled .app to run.', | 86 help='Compiled .app to run.', |
| 83 metavar='app', | 87 metavar='app', |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 parser.error( | 147 parser.error( |
| 144 'must specify all or none of -i/--iossim, -p/--platform, -v/--version') | 148 'must specify all or none of -i/--iossim, -p/--platform, -v/--version') |
| 145 | 149 |
| 146 args_json = json.loads(args.args_json) | 150 args_json = json.loads(args.args_json) |
| 147 args.env_var = args.env_var or [] | 151 args.env_var = args.env_var or [] |
| 148 args.env_var.extend(args_json.get('env_var', [])) | 152 args.env_var.extend(args_json.get('env_var', [])) |
| 149 args.xctest = args_json.get('xctest', args.xctest) | 153 args.xctest = args_json.get('xctest', args.xctest) |
| 150 test_args.extend(args_json.get('test_args', [])) | 154 test_args.extend(args_json.get('test_args', [])) |
| 151 | 155 |
| 152 sys.exit(main(args, test_args)) | 156 sys.exit(main(args, test_args)) |
| OLD | NEW |