Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: tools/ipc_fuzzer/play_testcase.py

Issue 18254010: IPC fuzzer child process component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/ipc_fuzzer/ipc_fuzzer_main.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/ipc_fuzzer/play_testcase.py
diff --git a/tools/ipc_fuzzer/play_testcase.py b/tools/ipc_fuzzer/play_testcase.py
new file mode 100755
index 0000000000000000000000000000000000000000..19dc4ce274cc16700385967abeef0cf0700b18fe
--- /dev/null
+++ b/tools/ipc_fuzzer/play_testcase.py
@@ -0,0 +1,85 @@
+#!/usr/bin/env python
+# Copyright (c) 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Wrapper around chrome.
+
+Replaces all the child processes (renderer, GPU, plugins and utility) with the
+IPC fuzzer. The fuzzer will then play back a specified testcase.
+
+Depends on ipc_fuzzer being available on the same directory as chrome.
+"""
+
+import os
+import platform
+import subprocess
+import sys
+
+def main():
+ if len(sys.argv) <= 1:
+ print 'Usage: play_testcase.py [chrome_flag...] testcase'
+ return 1
+
+ script_path = os.path.realpath(__file__)
+ ipc_fuzzer_dir = os.path.dirname(script_path)
+ out_dir = os.path.abspath(os.path.join(ipc_fuzzer_dir, os.pardir,
+ os.pardir, 'out'));
+ build_dir = ''
+ chrome_path = ''
+ chrome_binary = 'chrome'
+
+ for build in ['Debug', 'Release']:
+ try_build = os.path.join(out_dir, build)
+ try_chrome = os.path.join(try_build, chrome_binary)
+ if os.path.exists(try_chrome):
+ build_dir = try_build
+ chrome_path = try_chrome
+
+ if not chrome_path:
+ print 'chrome executable not found.'
+ return 1
+
+ fuzzer_path = os.path.join(build_dir, 'ipc_fuzzer')
+ if not os.path.exists(fuzzer_path):
+ print fuzzer_path + ' not found.'
+ print ('Please use enable_ipc_fuzzer=1 GYP define and '
+ 'build ipc_fuzzer target.')
+ return 1
+
+ prefixes = {
+ '--renderer-cmd-prefix',
+ '--gpu-launcher',
+ '--plugin-launcher',
+ '--ppapi-plugin-launcher',
+ '--utility-cmd-prefix',
+ }
+
+ args = [
+ chrome_path,
+ '--ipc-fuzzer-testcase=' + sys.argv[-1],
+ '--no-sandbox',
+ ]
+
+ launchers = {}
+ for prefix in prefixes:
+ launchers[prefix] = fuzzer_path
+
+ for arg in sys.argv[1:-1]:
+ if arg.find('=') != -1:
+ switch, value = arg.split('=', 1)
+ if switch in prefixes:
+ launchers[switch] = value + ' ' + launchers[switch]
+ continue
+ args.append(arg)
+
+ for switch, value in launchers.items():
+ args.append(switch + '=' + value)
+
+ print args
+
+ return subprocess.call(args)
+
+
+if __name__ == "__main__":
+ sys.exit(main())
« no previous file with comments | « tools/ipc_fuzzer/ipc_fuzzer_main.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698