Permalink
Browse files

Bug 747515 - Add option to add extra fennec preferences when running …

…captures
  • Loading branch information...
1 parent b76b259 commit a4b0f00034d27c66d07f458b5161fb8213904640 @wlach wlach committed Oct 4, 2012
Showing with 42 additions and 8 deletions.
  1. +27 −6 bin/get-metric-for-build.py
  2. +12 −1 bin/runtest.py
  3. +3 −1 src/eideticker/eideticker/runner.py
@@ -59,7 +59,7 @@ def get_build_for_date(date):
def run_test(device, outputdir, outputfile, test, url_params, num_runs,
startup_test, no_capture, get_internal_checkerboard_stats,
apk=None, appname = None, appdate = None, enable_profiling=False,
- dmtype="adb", host=None, port=None):
+ extra_prefs="{}", dmtype="adb", host=None, port=None):
if apk:
appinfo = eideticker.get_fennec_appinfo(apk)
appname = appinfo['appname']
@@ -85,7 +85,8 @@ def run_test(device, outputdir, outputfile, test, url_params, num_runs,
profile_file = os.path.join(PROFILE_DIR,
"profile-%s-%s.zip" % (appname, curtime))
- args = ["runtest.py", "--url-params", url_params, appname, test]
+ args = ["runtest.py", "--url-params", url_params,
+ "--extra-prefs", extra_prefs, appname, test]
if get_internal_checkerboard_stats:
checkerboard_logfile = tempfile.NamedTemporaryFile()
args.extend(["--checkerboard-log-file", checkerboard_logfile.name])
@@ -220,6 +221,10 @@ def main(args=sys.argv[1:]):
parser.add_option("--url-params", action="store",
dest="url_params", default="",
help="additional url parameters for test")
+ parser.add_option("--extra-prefs", action="store", dest="extra_prefs",
+ default="{}",
+ help="Extra profile preference for Firefox browsers. " \
+ "Must be passed in as a JSON dictionary")
parser.add_option("--use-apks", action="store_true", dest="use_apks",
help="use and install android APKs as part of test (instead of specifying appnames)")
parser.add_option("--date", action="store", dest="date",
@@ -237,6 +242,15 @@ def main(args=sys.argv[1:]):
if len(args) == 0:
parser.error("Must specify at least one argument: the path to the test")
+ try:
+ # we only need to validate extra_prefs, as we'll just be passing it down
+ # to runtest
+ json.loads(options.extra_prefs)
+ except ValueError:
+ parser.error("Error processing extra preferences: not valid JSON!")
+ raise
+
+
dates = []
appnames = []
apks = []
@@ -274,8 +288,11 @@ def main(args=sys.argv[1:]):
options.num_runs,
options.startup_test,
options.no_capture,
- options.get_internal_checkerboard_stats, appname=appname,
- enable_profiling=options.enable_profiling, **devicePrefs)
+ options.get_internal_checkerboard_stats,
+ appname=appname,
+ enable_profiling=options.enable_profiling,
+ extra_prefs=extra_prefs,
+ **devicePrefs)
elif apks:
for apk in apks:
run_test(device, options.outputdir,
@@ -285,7 +302,9 @@ def main(args=sys.argv[1:]):
options.startup_test,
options.no_capture,
options.get_internal_checkerboard_stats, apk=apk,
- enable_profiling=options.enable_profiling, **devicePrefs)
+ enable_profiling=options.enable_profiling,
+ extra_prefs=extra_prefs,
+ **devicePrefs)
else:
for date in dates:
apk = get_build_for_date(date)
@@ -297,7 +316,9 @@ def main(args=sys.argv[1:]):
options.no_capture,
options.get_internal_checkerboard_stats, apk=apk,
appdate=date,
- enable_profiling=options.enable_profiling, **devicePrefs)
+ enable_profiling=options.enable_profiling,
+ extra_prefs=extra_prefs,
+ **devicePrefs)
main()
View
@@ -128,6 +128,10 @@ def main(args=sys.argv[1:]):
parser.add_option("--b2g", action="store_true",
dest="b2g", default=False,
help="Run in B2G environment. You do not need to pass an appname")
+ parser.add_option("--extra-prefs", action="store", dest="extra_prefs",
+ default="{}",
+ help="Extra profile preference for Firefox browsers. " \
+ "Must be passed in as a JSON dictionary")
parser.add_option("--profile-file", action="store",
type="string", dest = "profile_file",
help="Collect a performance profile using the built in profiler.")
@@ -145,6 +149,13 @@ def main(args=sys.argv[1:]):
sys.exit(1)
(appname, testpath) = args
+
+ try:
+ extra_prefs = json.loads(options.extra_prefs)
+ except ValueError:
+ parser.error("Error processing extra preferences: not valid JSON!")
+ raise
+
# Tests must be in src/tests/... unless it is a startup test and the
# path is about:home (indicating we want to measure startup to the
# home screen)
@@ -264,7 +275,7 @@ def main(args=sys.argv[1:]):
if options.b2g:
runner = eideticker.B2GRunner(device, url, EIDETICKER_TEMP_DIR)
else:
- runner = eideticker.BrowserRunner(device, appname, url)
+ runner = eideticker.BrowserRunner(device, appname, url, extra_prefs=extra_prefs)
temp_profile_file_name = None
if options.profile_file:
@@ -102,10 +102,11 @@ class BrowserRunner(object):
remote_profile_dir = None
intent = "android.intent.action.VIEW"
- def __init__(self, dm, appname, url):
+ def __init__(self, dm, appname, url, extra_prefs={}):
self.dm = dm
self.appname = appname
self.url = url
+ self.extra_prefs = extra_prefs
activity_mappings = {
'com.android.browser': '.BrowserActivity',
@@ -187,6 +188,7 @@ def start(self, profile_file=None):
preferences = { 'gfx.show_checkerboard_pattern': False,
'browser.firstrun.show.uidiscovery': False,
'toolkit.telemetry.prompted': 2 }
+ preferences.update(self.extra_prefs)
# Add frame counter to correlate video capture with profile
if self.is_profiling:

0 comments on commit a4b0f00

Please sign in to comment.