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) |
74 | 77 |
75 | 78 |
76 if __name__ == '__main__': | 79 if __name__ == '__main__': |
77 parser = argparse.ArgumentParser() | 80 parser = argparse.ArgumentParser() |
78 | 81 |
79 parser.add_argument( | 82 parser.add_argument( |
80 '-a', | 83 '-a', |
81 '--app', | 84 '--app', |
82 help='Compiled .app to run.', | 85 help='Compiled .app to run.', |
83 metavar='app', | 86 metavar='app', |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 parser.error( | 146 parser.error( |
144 'must specify all or none of -i/--iossim, -p/--platform, -v/--version') | 147 'must specify all or none of -i/--iossim, -p/--platform, -v/--version') |
145 | 148 |
146 args_json = json.loads(args.args_json) | 149 args_json = json.loads(args.args_json) |
147 args.env_var = args.env_var or [] | 150 args.env_var = args.env_var or [] |
148 args.env_var.extend(args_json.get('env_var', [])) | 151 args.env_var.extend(args_json.get('env_var', [])) |
149 args.xctest = args_json.get('xctest', args.xctest) | 152 args.xctest = args_json.get('xctest', args.xctest) |
150 test_args.extend(args_json.get('test_args', [])) | 153 test_args.extend(args_json.get('test_args', [])) |
151 | 154 |
152 sys.exit(main(args, test_args)) | 155 sys.exit(main(args, test_args)) |
OLD | NEW |