| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 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 """Runs an isolate bundled Telemetry benchmark. | 6 """Runs an isolate bundled Telemetry benchmark. |
| 7 | 7 |
| 8 This script attempts to emulate the contract of gtest-style tests | 8 This script attempts to emulate the contract of gtest-style tests |
| 9 invoked via recipes. The main contract is that the caller passes the | 9 invoked via recipes. The main contract is that the caller passes the |
| 10 argument: | 10 argument: |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 failures.append(results['pages'][str(value['page_id'])]['name']) | 73 failures.append(results['pages'][str(value['page_id'])]['name']) |
| 74 valid = bool(rc == 0 or failures) | 74 valid = bool(rc == 0 or failures) |
| 75 except Exception: | 75 except Exception: |
| 76 traceback.print_exc() | 76 traceback.print_exc() |
| 77 valid = False | 77 valid = False |
| 78 finally: | 78 finally: |
| 79 shutil.rmtree(tempfile_dir) | 79 shutil.rmtree(tempfile_dir) |
| 80 | 80 |
| 81 if not valid and not failures: | 81 if not valid and not failures: |
| 82 failures = ['(entire test suite)'] | 82 failures = ['(entire test suite)'] |
| 83 if rc == 0: |
| 84 rc = 1 # Signal an abnormal exit. |
| 85 |
| 83 json.dump({ | 86 json.dump({ |
| 84 'valid': valid, | 87 'valid': valid, |
| 85 'failures': failures, | 88 'failures': failures, |
| 86 }, args.isolated_script_test_output) | 89 }, args.isolated_script_test_output) |
| 87 return rc | 90 return rc |
| 88 | 91 |
| 89 finally: | 92 finally: |
| 90 xvfb.kill(xvfb_proc) | 93 xvfb.kill(xvfb_proc) |
| 91 xvfb.kill(openbox_proc) | 94 xvfb.kill(openbox_proc) |
| 92 | 95 |
| 93 | 96 |
| 94 # This is not really a "script test" so does not need to manually add | 97 # This is not really a "script test" so does not need to manually add |
| 95 # any additional compile targets. | 98 # any additional compile targets. |
| 96 def main_compile_targets(args): | 99 def main_compile_targets(args): |
| 97 json.dump([], args.output) | 100 json.dump([], args.output) |
| 98 | 101 |
| 99 | 102 |
| 100 if __name__ == '__main__': | 103 if __name__ == '__main__': |
| 101 # Conform minimally to the protocol defined by ScriptTest. | 104 # Conform minimally to the protocol defined by ScriptTest. |
| 102 if 'compile_targets' in sys.argv: | 105 if 'compile_targets' in sys.argv: |
| 103 funcs = { | 106 funcs = { |
| 104 'run': None, | 107 'run': None, |
| 105 'compile_targets': main_compile_targets, | 108 'compile_targets': main_compile_targets, |
| 106 } | 109 } |
| 107 sys.exit(common.run_script(sys.argv[1:], funcs)) | 110 sys.exit(common.run_script(sys.argv[1:], funcs)) |
| 108 sys.exit(main()) | 111 sys.exit(main()) |
| OLD | NEW |