| 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 a python script under an isolate | 6 """Runs a python script under an isolate |
| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 rest_args.pop(index) | 43 rest_args.pop(index) |
| 44 break | 44 break |
| 45 index += 1 | 45 index += 1 |
| 46 | 46 |
| 47 ret = common.run_command([sys.executable] + rest_args) | 47 ret = common.run_command([sys.executable] + rest_args) |
| 48 with open(args.isolated_script_test_output, 'w') as fp: | 48 with open(args.isolated_script_test_output, 'w') as fp: |
| 49 json.dump({'valid': True, | 49 json.dump({'valid': True, |
| 50 'failures': ['failed'] if ret else []}, fp) | 50 'failures': ['failed'] if ret else []}, fp) |
| 51 return ret | 51 return ret |
| 52 | 52 |
| 53 |
| 54 # This is not really a "script test" so does not need to manually add |
| 55 # any additional compile targets. |
| 53 def main_compile_targets(args): | 56 def main_compile_targets(args): |
| 54 json.dump(['devtools_closure_compile'], args.output) | 57 json.dump([''], args.output) |
| 55 | 58 |
| 56 | 59 |
| 57 if __name__ == '__main__': | 60 if __name__ == '__main__': |
| 58 # Conform minimally to the protocol defined by ScriptTest. | 61 # Conform minimally to the protocol defined by ScriptTest. |
| 59 if 'compile_targets' in sys.argv: | 62 if 'compile_targets' in sys.argv: |
| 60 funcs = { | 63 funcs = { |
| 61 'run': None, | 64 'run': None, |
| 62 'compile_targets': main_compile_targets, | 65 'compile_targets': main_compile_targets, |
| 63 } | 66 } |
| 64 sys.exit(common.run_script(sys.argv[1:], funcs)) | 67 sys.exit(common.run_script(sys.argv[1:], funcs)) |
| 65 sys.exit(main()) | 68 sys.exit(main()) |
| OLD | NEW |