| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 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 """Wrapper around chrome. | 6 """Wrapper around chrome. |
| 7 | 7 |
| 8 Replaces all the child processes (renderer, GPU, plugins and utility) with the | 8 Replaces all the child processes (renderer, GPU, plugins and utility) with the |
| 9 IPC fuzzer. The fuzzer will then play back a specified testcase. | 9 IPC fuzzer. The fuzzer will then play back a specified testcase. |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 try_build = os.path.join(out_dir, build) | 33 try_build = os.path.join(out_dir, build) |
| 34 try_chrome = os.path.join(try_build, chrome_binary) | 34 try_chrome = os.path.join(try_build, chrome_binary) |
| 35 if os.path.exists(try_chrome): | 35 if os.path.exists(try_chrome): |
| 36 build_dir = try_build | 36 build_dir = try_build |
| 37 chrome_path = try_chrome | 37 chrome_path = try_chrome |
| 38 | 38 |
| 39 if not chrome_path: | 39 if not chrome_path: |
| 40 print 'chrome executable not found.' | 40 print 'chrome executable not found.' |
| 41 return 1 | 41 return 1 |
| 42 | 42 |
| 43 fuzzer_path = os.path.join(build_dir, 'ipc_fuzzer') | 43 fuzzer_path = os.path.join(build_dir, 'ipc_fuzzer_replay') |
| 44 if not os.path.exists(fuzzer_path): | 44 if not os.path.exists(fuzzer_path): |
| 45 print fuzzer_path + ' not found.' | 45 print fuzzer_path + ' not found.' |
| 46 print ('Please use enable_ipc_fuzzer=1 GYP define and ' | 46 print ('Please use enable_ipc_fuzzer=1 GYP define and ' |
| 47 'build ipc_fuzzer target.') | 47 'build ipc_fuzzer target.') |
| 48 return 1 | 48 return 1 |
| 49 | 49 |
| 50 prefixes = { | 50 prefixes = { |
| 51 '--renderer-cmd-prefix', | 51 '--renderer-cmd-prefix', |
| 52 '--gpu-launcher', | 52 '--gpu-launcher', |
| 53 '--plugin-launcher', | 53 '--plugin-launcher', |
| 54 '--ppapi-plugin-launcher', | 54 '--ppapi-plugin-launcher', |
| 55 '--utility-cmd-prefix', | 55 '--utility-cmd-prefix', |
| 56 } | 56 } |
| 57 | 57 |
| 58 args = [ | 58 args = [ |
| 59 chrome_path, | 59 chrome_path, |
| 60 '--ipc-fuzzer-testcase=' + sys.argv[-1], | 60 '--ipc-fuzzer-testcase=' + sys.argv[-1], |
| 61 '--no-sandbox', | 61 '--no-sandbox', |
| 62 '--disable-kill-after-bad-ipc', |
| 62 ] | 63 ] |
| 63 | 64 |
| 64 launchers = {} | 65 launchers = {} |
| 65 for prefix in prefixes: | 66 for prefix in prefixes: |
| 66 launchers[prefix] = fuzzer_path | 67 launchers[prefix] = fuzzer_path |
| 67 | 68 |
| 68 for arg in sys.argv[1:-1]: | 69 for arg in sys.argv[1:-1]: |
| 69 if arg.find('=') != -1: | 70 if arg.find('=') != -1: |
| 70 switch, value = arg.split('=', 1) | 71 switch, value = arg.split('=', 1) |
| 71 if switch in prefixes: | 72 if switch in prefixes: |
| 72 launchers[switch] = value + ' ' + launchers[switch] | 73 launchers[switch] = value + ' ' + launchers[switch] |
| 73 continue | 74 continue |
| 74 args.append(arg) | 75 args.append(arg) |
| 75 | 76 |
| 76 for switch, value in launchers.items(): | 77 for switch, value in launchers.items(): |
| 77 args.append(switch + '=' + value) | 78 args.append(switch + '=' + value) |
| 78 | 79 |
| 79 print args | 80 print args |
| 80 | 81 |
| 81 return subprocess.call(args) | 82 return subprocess.call(args) |
| 82 | 83 |
| 83 | 84 |
| 84 if __name__ == "__main__": | 85 if __name__ == "__main__": |
| 85 sys.exit(main()) | 86 sys.exit(main()) |
| OLD | NEW |