| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 """Removes ViewHostMsg_Close and alike from testcases. These messages are an | 6 """Removes ViewHostMsg_Close and alike from testcases. These messages are an |
| 7 annoyance for corpus distillation. They cause the browser to exit, so no | 7 annoyance for corpus distillation. They cause the browser to exit, so no |
| 8 further messages are processed. On the other hand, ViewHostMsg_Close is useful | 8 further messages are processed. On the other hand, ViewHostMsg_Close is useful |
| 9 for fuzzing - many found bugs are related to a renderer disappearing. So the | 9 for fuzzing - many found bugs are related to a renderer disappearing. So the |
| 10 fuzzer should be crafting random ViewHostMsg_Close messages. | 10 fuzzer should be crafting random ViewHostMsg_Close messages. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 help='ouput directory under src/ directory') | 30 help='ouput directory under src/ directory') |
| 31 parser.add_argument('--build-type', dest='build_type', default='Release', | 31 parser.add_argument('--build-type', dest='build_type', default='Release', |
| 32 help='Debug vs. Release build') | 32 help='Debug vs. Release build') |
| 33 parser.add_argument('testcase_dir', | 33 parser.add_argument('testcase_dir', |
| 34 help='Directory containing testcases') | 34 help='Directory containing testcases') |
| 35 parsed = parser.parse_args() | 35 parsed = parser.parse_args() |
| 36 | 36 |
| 37 message_util_binary = 'ipc_message_util' | 37 message_util_binary = 'ipc_message_util' |
| 38 | 38 |
| 39 script_path = os.path.realpath(__file__) | 39 script_path = os.path.realpath(__file__) |
| 40 ipc_fuzzer_dir = os.path.dirname(script_path) | 40 ipc_fuzzer_dir = os.path.join(os.path.dirname(script_path), os.pardir) |
| 41 src_dir = os.path.abspath(os.path.join(ipc_fuzzer_dir, os.pardir, os.pardir)) | 41 src_dir = os.path.abspath(os.path.join(ipc_fuzzer_dir, os.pardir, os.pardir)) |
| 42 out_dir = os.path.join(src_dir, parsed.out_dir); | 42 out_dir = os.path.join(src_dir, parsed.out_dir); |
| 43 build_dir = os.path.join(out_dir, parsed.build_type) | 43 build_dir = os.path.join(out_dir, parsed.build_type) |
| 44 | 44 |
| 45 message_util_path = os.path.join(build_dir, message_util_binary) | 45 message_util_path = os.path.join(build_dir, message_util_binary) |
| 46 if not os.path.exists(message_util_path): | 46 if not os.path.exists(message_util_path): |
| 47 print 'ipc_message_util executable not found at ', message_util_path | 47 print 'ipc_message_util executable not found at ', message_util_path |
| 48 return 1 | 48 return 1 |
| 49 | 49 |
| 50 filter_command = [ | 50 filter_command = [ |
| (...skipping 15 matching lines...) Expand all Loading... |
| 66 filter_command[-2] = testcase_path | 66 filter_command[-2] = testcase_path |
| 67 filter_command[-1] = filtered_path | 67 filter_command[-1] = filtered_path |
| 68 subprocess.call(filter_command) | 68 subprocess.call(filter_command) |
| 69 shutil.move(filtered_path, testcase_path) | 69 shutil.move(filtered_path, testcase_path) |
| 70 | 70 |
| 71 return 0 | 71 return 0 |
| 72 | 72 |
| 73 | 73 |
| 74 if __name__ == "__main__": | 74 if __name__ == "__main__": |
| 75 sys.exit(main()) | 75 sys.exit(main()) |
| OLD | NEW |