diff options
author | aedla@chromium.org <aedla@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-21 13:58:34 +0000 |
---|---|---|
committer | aedla@chromium.org <aedla@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-21 13:58:34 +0000 |
commit | fbc550f47462f47af6cd0a4cff72c50501811263 (patch) | |
tree | 27ffdc3e174cd2f9e5700394708eb7b4bbb21c4a /tools/ipc_fuzzer | |
parent | 40c3026c83a3416284dcbad95d6683459e770a22 (diff) | |
download | chromium_src-fbc550f47462f47af6cd0a4cff72c50501811263.zip chromium_src-fbc550f47462f47af6cd0a4cff72c50501811263.tar.gz chromium_src-fbc550f47462f47af6cd0a4cff72c50501811263.tar.bz2 |
IPC fuzzer: play_testcase.py tweaks.
1. Add --gdb-browser to run the browser process inside gdb.
2. Any additional arguments after testcase are passed to chrome.
3. Re-runnable chrome command printout.
BUG=260848
Review URL: https://codereview.chromium.org/141483003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@246034 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/ipc_fuzzer')
-rwxr-xr-x | tools/ipc_fuzzer/play_testcase.py | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/tools/ipc_fuzzer/play_testcase.py b/tools/ipc_fuzzer/play_testcase.py index a639b3a..bec0754 100755 --- a/tools/ipc_fuzzer/play_testcase.py +++ b/tools/ipc_fuzzer/play_testcase.py @@ -24,10 +24,15 @@ def main(): help='ouput directory under src/ directory') parser.add_argument('--build-type', dest='build_type', default='Release', help='Debug vs. Release build') - parser.add_argument('--chrome-flags', dest='chrome_flags', - help='comma-separated additional flags to pass to chrome') - parser.add_argument('testcase'); - parsed = parser.parse_args(); + parser.add_argument('--gdb-browser', dest='gdb_browser', default=False, + action='store_true', + help='run browser process inside gdb') + parser.add_argument('testcase', + help='IPC file to be replayed') + parser.add_argument('chrome_args', + nargs=argparse.REMAINDER, + help='any additional arguments are passed to chrome') + args = parser.parse_args() chrome_binary = 'chrome' fuzzer_binary = 'ipc_fuzzer_replay' @@ -35,8 +40,8 @@ def main(): script_path = os.path.realpath(__file__) ipc_fuzzer_dir = os.path.dirname(script_path) src_dir = os.path.abspath(os.path.join(ipc_fuzzer_dir, os.pardir, os.pardir)) - out_dir = os.path.join(src_dir, parsed.out_dir); - build_dir = os.path.join(out_dir, parsed.build_type) + out_dir = os.path.join(src_dir, args.out_dir) + build_dir = os.path.join(out_dir, args.build_type) chrome_path = os.path.join(build_dir, chrome_binary) if not os.path.exists(chrome_path): @@ -58,32 +63,35 @@ def main(): '--utility-cmd-prefix', } - args = [ + chrome_command = [ chrome_path, - '--ipc-fuzzer-testcase=' + sys.argv[-1], + '--ipc-fuzzer-testcase=' + args.testcase, '--no-sandbox', '--disable-kill-after-bad-ipc', ] + if args.gdb_browser: + chrome_command = ['gdb', '--args'] + chrome_command + launchers = {} for prefix in prefixes: launchers[prefix] = fuzzer_path - if parsed.chrome_flags: - for arg in parsed.chrome_flags.split(','): - if arg.find('=') != -1: - switch, value = arg.split('=', 1) - if switch in prefixes: - launchers[switch] = value + ' ' + launchers[switch] - continue - args.append(arg) + for arg in args.chrome_args: + if arg.find('=') != -1: + switch, value = arg.split('=', 1) + if switch in prefixes: + launchers[switch] = value + ' ' + launchers[switch] + continue + chrome_command.append(arg) for switch, value in launchers.items(): - args.append(switch + '=' + value) + chrome_command.append(switch + '=' + value) - print args + command_line = ' '.join(['\'' + arg + '\'' for arg in chrome_command]) + print 'Executing: ' + command_line - return subprocess.call(args) + return subprocess.call(chrome_command) if __name__ == "__main__": |