mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-08 05:52:32 +00:00
Bug 1522604 - Use Raptor's custom logger class r=davehunt
Used custom logger for testing.raptor.raptor files to mention log level in messages Differential Revision: https://phabricator.services.mozilla.com/D32985 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
fceda518ee
commit
11334f29e9
@ -8,11 +8,10 @@ import os
|
||||
import shutil
|
||||
import socket
|
||||
|
||||
from mozlog import get_proxy_logger
|
||||
|
||||
from logger.logger import RaptorLogger
|
||||
from wptserve import server, handlers
|
||||
|
||||
LOG = get_proxy_logger(component="raptor-benchmark")
|
||||
LOG = RaptorLogger(component='raptor-benchmark')
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
|
||||
|
@ -14,9 +14,9 @@ import socket
|
||||
import threading
|
||||
import time
|
||||
|
||||
from mozlog import get_proxy_logger
|
||||
from logger.logger import RaptorLogger
|
||||
|
||||
LOG = get_proxy_logger(component='raptor-control-server')
|
||||
LOG = RaptorLogger(component='raptor-control-server')
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
|
@ -13,12 +13,12 @@ import tempfile
|
||||
import zipfile
|
||||
|
||||
import mozfile
|
||||
from mozlog import get_proxy_logger
|
||||
|
||||
from logger.logger import RaptorLogger
|
||||
from profiler import symbolication, profiling
|
||||
|
||||
here = os.path.dirname(os.path.realpath(__file__))
|
||||
LOG = get_proxy_logger()
|
||||
LOG = RaptorLogger(component='raptor-gecko-profile')
|
||||
|
||||
|
||||
class GeckoProfile(object):
|
||||
|
@ -5,12 +5,12 @@ from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
|
||||
from mozlog import get_proxy_logger
|
||||
from logger.logger import RaptorLogger
|
||||
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
webext_dir = os.path.join(os.path.dirname(here), 'webext', 'raptor')
|
||||
LOG = get_proxy_logger(component="raptor-gen-test-config")
|
||||
LOG = RaptorLogger(component='raptor-gen-test-config')
|
||||
|
||||
|
||||
def gen_test_config(browser, test, cs_port, post_startup_delay,
|
||||
|
@ -6,14 +6,14 @@ from __future__ import absolute_import
|
||||
import json
|
||||
import os
|
||||
|
||||
from logger.logger import RaptorLogger
|
||||
from manifestparser import TestManifest
|
||||
from mozlog import get_proxy_logger
|
||||
from utils import transform_platform
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
raptor_ini = os.path.join(here, 'raptor.ini')
|
||||
tests_dir = os.path.join(here, 'tests')
|
||||
LOG = get_proxy_logger(component="raptor-manifest")
|
||||
LOG = RaptorLogger(component='raptor-manifest')
|
||||
|
||||
LIVE_SITE_TIMEOUT_MULTIPLIER = 1.2
|
||||
|
||||
@ -93,7 +93,7 @@ def validate_test_ini(test_details):
|
||||
if setting == "page-cycles" and test_details.get('browser_cycles') is not None:
|
||||
continue
|
||||
valid_settings = False
|
||||
LOG.error("ERROR: setting '%s' is required but not found in %s"
|
||||
LOG.error("setting '%s' is required but not found in %s"
|
||||
% (setting, test_details['manifest']))
|
||||
|
||||
test_details.setdefault("page_timeout", 30000)
|
||||
@ -103,7 +103,7 @@ def validate_test_ini(test_details):
|
||||
for setting in playback_settings:
|
||||
if test_details.get(setting) is None:
|
||||
valid_settings = False
|
||||
LOG.error("ERROR: setting '%s' is required but not found in %s"
|
||||
LOG.error("setting '%s' is required but not found in %s"
|
||||
% (setting, test_details['manifest']))
|
||||
|
||||
# if 'alert-on' is specified, we need to make sure that the value given is valid
|
||||
@ -117,7 +117,7 @@ def validate_test_ini(test_details):
|
||||
# now make sure each alert_on value provided is valid
|
||||
for alert_on_value in test_details['alert_on']:
|
||||
if alert_on_value not in test_details['measure']:
|
||||
LOG.error("ERROR: The 'alert_on' value of '%s' is not valid because "
|
||||
LOG.error("The 'alert_on' value of '%s' is not valid because "
|
||||
"it doesn't exist in the 'measure' test setting!"
|
||||
% alert_on_value)
|
||||
valid_settings = False
|
||||
|
@ -13,9 +13,9 @@ import filters
|
||||
import json
|
||||
import os
|
||||
|
||||
from mozlog import get_proxy_logger
|
||||
from logger.logger import RaptorLogger
|
||||
|
||||
LOG = get_proxy_logger(component="raptor-output")
|
||||
LOG = RaptorLogger(component='raptor-output')
|
||||
|
||||
|
||||
class Output(object):
|
||||
@ -43,7 +43,7 @@ class Output(object):
|
||||
|
||||
# check if we actually have any results
|
||||
if len(self.results) == 0:
|
||||
LOG.error("error: no raptor test results found for %s" %
|
||||
LOG.error("no raptor test results found for %s" %
|
||||
', '.join(test_names))
|
||||
return
|
||||
|
||||
@ -822,7 +822,7 @@ class Output(object):
|
||||
screenshot_path = os.path.join(os.getcwd(), 'screenshots.html')
|
||||
|
||||
if self.summarized_results == {}:
|
||||
LOG.error("error: no summarized raptor results found for %s" %
|
||||
LOG.error("no summarized raptor results found for %s" %
|
||||
', '.join(test_names))
|
||||
else:
|
||||
with open(results_path, 'w') as f:
|
||||
@ -871,7 +871,7 @@ class Output(object):
|
||||
from the actual Raptor test that was ran when the supporting data was gathered.
|
||||
'''
|
||||
if len(self.summarized_supporting_data) == 0:
|
||||
LOG.error("error: no summarized supporting data found for %s" %
|
||||
LOG.error("no summarized supporting data found for %s" %
|
||||
', '.join(test_names))
|
||||
return False
|
||||
|
||||
|
@ -7,10 +7,10 @@ from __future__ import absolute_import
|
||||
|
||||
import json
|
||||
|
||||
from mozlog import get_proxy_logger
|
||||
from logger.logger import RaptorLogger
|
||||
|
||||
|
||||
LOG = get_proxy_logger(component='raptor-output-handler')
|
||||
LOG = RaptorLogger(component='raptor-output-handler')
|
||||
|
||||
|
||||
class OutputHandler(object):
|
||||
|
@ -7,11 +7,16 @@ from __future__ import absolute_import
|
||||
import os
|
||||
import re
|
||||
|
||||
from logger.logger import RaptorLogger
|
||||
|
||||
|
||||
LOG = RaptorLogger(component='raptor-power')
|
||||
|
||||
|
||||
def init_android_power_test(raptor):
|
||||
upload_dir = os.getenv("MOZ_UPLOAD_DIR")
|
||||
if not upload_dir:
|
||||
raptor.log.critical(
|
||||
LOG.critical(
|
||||
"% power test ignored; MOZ_UPLOAD_DIR unset" % raptor.config["app"]
|
||||
)
|
||||
return
|
||||
@ -85,7 +90,7 @@ def init_android_power_test(raptor):
|
||||
def finish_android_power_test(raptor, test_name):
|
||||
upload_dir = os.getenv("MOZ_UPLOAD_DIR")
|
||||
if not upload_dir:
|
||||
raptor.log.critical(
|
||||
LOG.critical(
|
||||
"% power test ignored because MOZ_UPLOAD_DIR was not set" % test_name
|
||||
)
|
||||
return
|
||||
@ -181,7 +186,7 @@ def finish_android_power_test(raptor, test_name):
|
||||
screen = full_screen if screen == 0 else screen
|
||||
wifi = full_wifi if wifi is None else wifi
|
||||
|
||||
raptor.log.info(
|
||||
LOG.info(
|
||||
"power data for uid: %s, cpu: %s, wifi: %s, screen: %s, proportional: %s"
|
||||
% (uid, cpu, wifi, screen, proportional)
|
||||
)
|
||||
@ -200,13 +205,12 @@ def finish_android_power_test(raptor, test_name):
|
||||
},
|
||||
}
|
||||
|
||||
# Only submit proportional measurement on Android 8+
|
||||
LOG.info("submitting power data via control server directly")
|
||||
if major_android_version >= 8:
|
||||
power_data['values']['proportional'] = float(proportional)
|
||||
|
||||
raptor.log.info("submitting power data via control server directly")
|
||||
raptor.control_server.submit_supporting_data(power_data)
|
||||
|
||||
# Generate power bugreport zip
|
||||
raptor.log.info("generating power bugreport zip")
|
||||
LOG.info("generating power bugreport zip")
|
||||
raptor.device.command_output(["bugreport", upload_dir])
|
||||
|
@ -19,8 +19,9 @@ import requests
|
||||
|
||||
import mozcrash
|
||||
import mozinfo
|
||||
from logger.logger import RaptorLogger
|
||||
from mozdevice import ADBDevice
|
||||
from mozlog import commandline, get_default_logger
|
||||
from mozlog import commandline
|
||||
from mozprofile import create_profile
|
||||
from mozproxy import get_playback
|
||||
from mozrunner import runners
|
||||
@ -59,6 +60,9 @@ from results import RaptorResultsHandler
|
||||
from utils import view_gecko_profile
|
||||
|
||||
|
||||
LOG = RaptorLogger(component='raptor-main')
|
||||
|
||||
|
||||
class SignalHandler:
|
||||
|
||||
def __init__(self):
|
||||
@ -106,7 +110,6 @@ class Raptor(object):
|
||||
}
|
||||
|
||||
self.raptor_venv = os.path.join(os.getcwd(), 'raptor-venv')
|
||||
self.log = get_default_logger(component='raptor-main')
|
||||
self.control_server = None
|
||||
self.playback = None
|
||||
self.benchmark = None
|
||||
@ -124,10 +127,10 @@ class Raptor(object):
|
||||
# if running debug-mode reduce the pause after browser startup
|
||||
if self.debug_mode:
|
||||
self.post_startup_delay = min(self.post_startup_delay, 3000)
|
||||
self.log.info("debug-mode enabled, reducing post-browser startup pause to %d ms"
|
||||
% self.post_startup_delay)
|
||||
LOG.info("debug-mode enabled, reducing post-browser startup pause to %d ms"
|
||||
% self.post_startup_delay)
|
||||
|
||||
self.log.info("main raptor init, config is: %s" % str(self.config))
|
||||
LOG.info("main raptor init, config is: %s" % str(self.config))
|
||||
|
||||
# create results holder
|
||||
self.results_handler = RaptorResultsHandler()
|
||||
@ -147,9 +150,9 @@ class Raptor(object):
|
||||
raise NotImplementedError
|
||||
|
||||
def run_test_setup(self, test):
|
||||
self.log.info("starting raptor test: %s" % test['name'])
|
||||
self.log.info("test settings: %s" % str(test))
|
||||
self.log.info("raptor config: %s" % str(self.config))
|
||||
LOG.info("starting raptor test: %s" % test['name'])
|
||||
LOG.info("test settings: %s" % str(test))
|
||||
LOG.info("raptor config: %s" % str(self.config))
|
||||
|
||||
if test.get('type') == "benchmark":
|
||||
self.serve_benchmark_source(test)
|
||||
@ -211,7 +214,7 @@ class Raptor(object):
|
||||
if not self.debug_mode:
|
||||
elapsed_time += 1
|
||||
if elapsed_time > (timeout) - 5: # stop 5 seconds early
|
||||
self.log.info("application timed out after {} seconds".format(timeout))
|
||||
LOG.info("application timed out after {} seconds".format(timeout))
|
||||
self.control_server.wait_for_quit()
|
||||
break
|
||||
|
||||
@ -227,12 +230,12 @@ class Raptor(object):
|
||||
if self.config['gecko_profile'] is True:
|
||||
self.gecko_profiler.symbolicate()
|
||||
# clean up the temp gecko profiling folders
|
||||
self.log.info("cleaning up after gecko profiling")
|
||||
LOG.info("cleaning up after gecko profiling")
|
||||
self.gecko_profiler.clean()
|
||||
|
||||
def set_browser_test_prefs(self, raw_prefs):
|
||||
# add test specific preferences
|
||||
self.log.info("setting test-specific Firefox preferences")
|
||||
LOG.info("setting test-specific Firefox preferences")
|
||||
self.profile.set_preferences(json.loads(raw_prefs))
|
||||
|
||||
def build_browser_profile(self):
|
||||
@ -244,7 +247,7 @@ class Raptor(object):
|
||||
|
||||
for profile in base_profiles:
|
||||
path = os.path.join(self.profile_data_dir, profile)
|
||||
self.log.info("Merging profile: {}".format(path))
|
||||
LOG.info("Merging profile: {}".format(path))
|
||||
self.profile.merge(path)
|
||||
|
||||
# add profile dir to our config
|
||||
@ -280,7 +283,7 @@ class Raptor(object):
|
||||
continue
|
||||
self.config[key] = os.path.join(playback_dir, self.config[key])
|
||||
|
||||
self.log.info("test uses playback tool: %s " % self.config['playback_tool'])
|
||||
LOG.info("test uses playback tool: %s " % self.config['playback_tool'])
|
||||
|
||||
def serve_benchmark_source(self, test):
|
||||
# benchmark-type tests require the benchmark test to be served out
|
||||
@ -293,7 +296,7 @@ class Raptor(object):
|
||||
# note: for chrome the addon is just a list of paths that ultimately are added
|
||||
# to the chromium command line '--load-extension' argument
|
||||
self.raptor_webext = os.path.join(webext_dir, 'raptor')
|
||||
self.log.info("installing webext %s" % self.raptor_webext)
|
||||
LOG.info("installing webext %s" % self.raptor_webext)
|
||||
self.profile.addons.install(self.raptor_webext)
|
||||
|
||||
# on firefox we can get an addon id; chrome addon actually is just cmd line arg
|
||||
@ -304,7 +307,7 @@ class Raptor(object):
|
||||
|
||||
def remove_raptor_webext(self):
|
||||
# remove the raptor webext; as it must be reloaded with each subtest anyway
|
||||
self.log.info("removing webext %s" % self.raptor_webext)
|
||||
LOG.info("removing webext %s" % self.raptor_webext)
|
||||
if self.config['app'] in ['firefox', 'geckoview', 'fennec', 'refbrow', 'fenix']:
|
||||
self.profile.addons.remove_addon(self.webext_id)
|
||||
|
||||
@ -379,10 +382,10 @@ class Raptor(object):
|
||||
userjsfile.writelines(prefs)
|
||||
|
||||
def _init_gecko_profiling(self, test):
|
||||
self.log.info("initializing gecko profiler")
|
||||
LOG.info("initializing gecko profiler")
|
||||
upload_dir = os.getenv('MOZ_UPLOAD_DIR')
|
||||
if not upload_dir:
|
||||
self.log.critical("Profiling ignored because MOZ_UPLOAD_DIR was not set")
|
||||
LOG.critical("Profiling ignored because MOZ_UPLOAD_DIR was not set")
|
||||
else:
|
||||
self.gecko_profiler = GeckoProfile(upload_dir,
|
||||
self.config,
|
||||
@ -411,7 +414,7 @@ class Raptor(object):
|
||||
self.control_server_wait_clear('all')
|
||||
|
||||
self.control_server.stop()
|
||||
self.log.info("finished")
|
||||
LOG.info("finished")
|
||||
|
||||
def control_server_wait_set(self, state):
|
||||
response = requests.post("http://127.0.0.1:%s/" % self.control_server.port,
|
||||
@ -445,7 +448,7 @@ class RaptorDesktop(Raptor):
|
||||
super(RaptorDesktop, self).__init__(*args, **kwargs)
|
||||
|
||||
# create the desktop browser runner
|
||||
self.log.info("creating browser runner using mozrunner")
|
||||
LOG.info("creating browser runner using mozrunner")
|
||||
self.output_handler = OutputHandler()
|
||||
process_args = {
|
||||
'processOutputLine': [self.output_handler],
|
||||
@ -495,13 +498,13 @@ class RaptorDesktop(Raptor):
|
||||
|
||||
The default will be to run in warm mode; unless 'cold = true' is set in the test INI.
|
||||
'''
|
||||
self.log.info("test %s is running in cold mode; browser WILL be restarted between "
|
||||
"page cycles" % test['name'])
|
||||
LOG.info("test %s is running in cold mode; browser WILL be restarted between "
|
||||
"page cycles" % test['name'])
|
||||
|
||||
for test['browser_cycle'] in range(1, test['expected_browser_cycles'] + 1):
|
||||
|
||||
self.log.info("begin browser cycle %d of %d for test %s"
|
||||
% (test['browser_cycle'], test['expected_browser_cycles'], test['name']))
|
||||
LOG.info("begin browser cycle %d of %d for test %s"
|
||||
% (test['browser_cycle'], test['expected_browser_cycles'], test['name']))
|
||||
|
||||
self.run_test_setup(test)
|
||||
|
||||
@ -559,7 +562,7 @@ class RaptorDesktop(Raptor):
|
||||
else:
|
||||
# in debug mode, and running locally, leave the browser running
|
||||
if self.config['run_local']:
|
||||
self.log.info("* debug-mode enabled - please shutdown the browser manually...")
|
||||
LOG.info("* debug-mode enabled - please shutdown the browser manually...")
|
||||
self.runner.wait(timeout=None)
|
||||
|
||||
super(RaptorDesktop, self).run_test_teardown()
|
||||
@ -582,16 +585,16 @@ class RaptorDesktopFirefox(RaptorDesktop):
|
||||
# For Firefox we need to set MOZ_DISABLE_NONLOCAL_CONNECTIONS=1 env var before startup
|
||||
# when testing release builds from mozilla-beta/release. This is because of restrictions
|
||||
# on release builds that require webextensions to be signed unless this env var is set
|
||||
self.log.info("setting MOZ_DISABLE_NONLOCAL_CONNECTIONS=1")
|
||||
LOG.info("setting MOZ_DISABLE_NONLOCAL_CONNECTIONS=1")
|
||||
os.environ['MOZ_DISABLE_NONLOCAL_CONNECTIONS'] = "1"
|
||||
|
||||
def enable_non_local_connections(self):
|
||||
# pageload tests need to be able to access non-local connections via mitmproxy
|
||||
self.log.info("setting MOZ_DISABLE_NONLOCAL_CONNECTIONS=0")
|
||||
LOG.info("setting MOZ_DISABLE_NONLOCAL_CONNECTIONS=0")
|
||||
os.environ['MOZ_DISABLE_NONLOCAL_CONNECTIONS'] = "0"
|
||||
|
||||
def launch_desktop_browser(self, test):
|
||||
self.log.info("starting %s" % self.config['app'])
|
||||
LOG.info("starting %s" % self.config['app'])
|
||||
if self.config['is_release_build']:
|
||||
self.disable_non_local_connections()
|
||||
|
||||
@ -630,7 +633,7 @@ class RaptorDesktopChrome(RaptorDesktop):
|
||||
self.runner.cmdargs.extend(chrome_args)
|
||||
|
||||
def launch_desktop_browser(self, test):
|
||||
self.log.info("starting %s" % self.config['app'])
|
||||
LOG.info("starting %s" % self.config['app'])
|
||||
# some chromium-specfic cmd line opts required
|
||||
self.runner.cmdargs.extend(['--use-mock-keychain', '--no-default-browser-check'])
|
||||
|
||||
@ -645,7 +648,7 @@ class RaptorDesktopChrome(RaptorDesktop):
|
||||
|
||||
def set_browser_test_prefs(self, raw_prefs):
|
||||
# add test-specific preferences
|
||||
self.log.info("preferences were configured for the test, however \
|
||||
LOG.info("preferences were configured for the test, however \
|
||||
we currently do not install them on non-Firefox browsers.")
|
||||
|
||||
|
||||
@ -669,15 +672,15 @@ class RaptorAndroid(Raptor):
|
||||
def set_reverse_ports(self, is_benchmark=False):
|
||||
# Make services running on the host available to the device
|
||||
if self.config['host'] in ('localhost', '127.0.0.1'):
|
||||
self.log.info("making the raptor control server port available to device")
|
||||
LOG.info("making the raptor control server port available to device")
|
||||
self.set_reverse_port(self.control_server.port)
|
||||
|
||||
if self.config['host'] in ('localhost', '127.0.0.1'):
|
||||
self.log.info("making the raptor playback server port available to device")
|
||||
LOG.info("making the raptor playback server port available to device")
|
||||
self.set_reverse_port(8080)
|
||||
|
||||
if is_benchmark and self.config['host'] in ('localhost', '127.0.0.1'):
|
||||
self.log.info("making the raptor benchmarks server port available to device")
|
||||
LOG.info("making the raptor benchmarks server port available to device")
|
||||
self.set_reverse_port(self.benchmark_port)
|
||||
|
||||
def setup_adb_device(self):
|
||||
@ -685,7 +688,7 @@ class RaptorAndroid(Raptor):
|
||||
self.device = ADBDevice(verbose=True)
|
||||
self.tune_performance()
|
||||
|
||||
self.log.info("creating remote root folder for raptor: %s" % self.remote_test_root)
|
||||
LOG.info("creating remote root folder for raptor: %s" % self.remote_test_root)
|
||||
self.device.rm(self.remote_test_root, force=True, recursive=True)
|
||||
self.device.mkdir(self.remote_test_root)
|
||||
self.device.chmod(self.remote_test_root, recursive=True, root=True)
|
||||
@ -697,10 +700,10 @@ class RaptorAndroid(Raptor):
|
||||
|
||||
For more information, see https://bugzilla.mozilla.org/show_bug.cgi?id=1547135.
|
||||
"""
|
||||
self.log.info("tuning android device performance")
|
||||
LOG.info("tuning android device performance")
|
||||
self.set_svc_power_stayon()
|
||||
if (self.device._have_su or self.device._have_android_su):
|
||||
self.log.info("executing additional tuning commands requiring root")
|
||||
LOG.info("executing additional tuning commands requiring root")
|
||||
device_name = self.device.shell_output('getprop ro.product.model')
|
||||
# all commands require root shell from here on
|
||||
self.set_scheduler()
|
||||
@ -710,22 +713,22 @@ class RaptorAndroid(Raptor):
|
||||
self.set_gpu_performance_parameters(device_name)
|
||||
self.set_kernel_performance_parameters()
|
||||
self.device.clear_logcat()
|
||||
self.log.info("android device performance tuning complete")
|
||||
LOG.info("android device performance tuning complete")
|
||||
|
||||
def _set_value_and_check_exitcode(self, file_name, value, root=False):
|
||||
self.log.info('setting {} to {}'.format(file_name, value))
|
||||
LOG.info('setting {} to {}'.format(file_name, value))
|
||||
process = self.device.shell(' '.join(['echo', str(value), '>', str(file_name)]), root=root)
|
||||
if process.exitcode == 0:
|
||||
self.log.info('successfully set {} to {}'.format(file_name, value))
|
||||
LOG.info('successfully set {} to {}'.format(file_name, value))
|
||||
else:
|
||||
self.log.warning('command failed with exitcode {}'.format(str(process.exitcode)))
|
||||
LOG.warning('command failed with exitcode {}'.format(str(process.exitcode)))
|
||||
|
||||
def set_svc_power_stayon(self):
|
||||
self.log.info('set device to stay awake on usb')
|
||||
LOG.info('set device to stay awake on usb')
|
||||
self.device.shell('svc power stayon usb')
|
||||
|
||||
def set_scheduler(self):
|
||||
self.log.info('setting scheduler to noop')
|
||||
LOG.info('setting scheduler to noop')
|
||||
scheduler_location = '/sys/block/sda/queue/scheduler'
|
||||
|
||||
self._set_value_and_check_exitcode(scheduler_location, 'noop')
|
||||
@ -737,18 +740,18 @@ class RaptorAndroid(Raptor):
|
||||
'thermald',
|
||||
]
|
||||
for service in services:
|
||||
self.log.info(' '.join(['turning off service:', service]))
|
||||
LOG.info(' '.join(['turning off service:', service]))
|
||||
self.device.shell(' '.join(['stop', service]), root=True)
|
||||
|
||||
services_list_output = self.device.shell_output('service list')
|
||||
for service in services:
|
||||
if service not in services_list_output:
|
||||
self.log.info(' '.join(['successfully terminated:', service]))
|
||||
LOG.info(' '.join(['successfully terminated:', service]))
|
||||
else:
|
||||
self.log.warning(' '.join(['failed to terminate:', service]))
|
||||
LOG.warning(' '.join(['failed to terminate:', service]))
|
||||
|
||||
def disable_animations(self):
|
||||
self.log.info('disabling animations')
|
||||
LOG.info('disabling animations')
|
||||
commands = {
|
||||
'animator_duration_scale': 0.0,
|
||||
'transition_animation_scale': 0.0,
|
||||
@ -757,12 +760,12 @@ class RaptorAndroid(Raptor):
|
||||
|
||||
for key, value in commands.items():
|
||||
command = ' '.join(['settings', 'put', 'global', key, str(value)])
|
||||
self.log.info('setting {} to {}'.format(key, value))
|
||||
LOG.info('setting {} to {}'.format(key, value))
|
||||
self.device.shell(command)
|
||||
|
||||
def restore_animations(self):
|
||||
# animation settings are not restored to default by reboot
|
||||
self.log.info('restoring animations')
|
||||
LOG.info('restoring animations')
|
||||
commands = {
|
||||
'animator_duration_scale': 1.0,
|
||||
'transition_animation_scale': 1.0,
|
||||
@ -774,7 +777,7 @@ class RaptorAndroid(Raptor):
|
||||
self.device.shell(command)
|
||||
|
||||
def set_virtual_memory_parameters(self):
|
||||
self.log.info('setting virtual memory parameters')
|
||||
LOG.info('setting virtual memory parameters')
|
||||
commands = {
|
||||
'/proc/sys/vm/swappiness': 0,
|
||||
'/proc/sys/vm/dirty_ratio': 85,
|
||||
@ -785,7 +788,7 @@ class RaptorAndroid(Raptor):
|
||||
self._set_value_and_check_exitcode(key, value, root=True)
|
||||
|
||||
def set_cpu_performance_parameters(self, device_name):
|
||||
self.log.info('setting cpu performance parameters')
|
||||
LOG.info('setting cpu performance parameters')
|
||||
commands = {}
|
||||
|
||||
if device_name == 'Pixel 2':
|
||||
@ -817,7 +820,7 @@ class RaptorAndroid(Raptor):
|
||||
self._set_value_and_check_exitcode(key, value, root=True)
|
||||
|
||||
def set_gpu_performance_parameters(self, device_name):
|
||||
self.log.info('setting gpu performance parameters')
|
||||
LOG.info('setting gpu performance parameters')
|
||||
commands = {
|
||||
'/sys/class/kgsl/kgsl-3d0/bus_split': '0',
|
||||
'/sys/class/kgsl/kgsl-3d0/force_bus_on': '1',
|
||||
@ -853,7 +856,7 @@ class RaptorAndroid(Raptor):
|
||||
self._set_value_and_check_exitcode(key, value, root=True)
|
||||
|
||||
def set_kernel_performance_parameters(self):
|
||||
self.log.info('setting kernel performance parameters')
|
||||
LOG.info('setting kernel performance parameters')
|
||||
commands = {
|
||||
'/sys/kernel/debug/msm-bus-dbg/shell-client/update_request': '1',
|
||||
'/sys/kernel/debug/msm-bus-dbg/shell-client/mas': '1',
|
||||
@ -868,11 +871,11 @@ class RaptorAndroid(Raptor):
|
||||
|
||||
# Merge in the android profile
|
||||
path = os.path.join(self.profile_data_dir, 'raptor-android')
|
||||
self.log.info("Merging profile: {}".format(path))
|
||||
LOG.info("Merging profile: {}".format(path))
|
||||
self.profile.merge(path)
|
||||
|
||||
def clear_app_data(self):
|
||||
self.log.info("clearing %s app data" % self.config['binary'])
|
||||
LOG.info("clearing %s app data" % self.config['binary'])
|
||||
self.device.shell("pm clear %s" % self.config['binary'])
|
||||
|
||||
def copy_profile_to_device(self):
|
||||
@ -881,21 +884,21 @@ class RaptorAndroid(Raptor):
|
||||
raise Exception('%s is not installed' % self.config['binary'])
|
||||
|
||||
try:
|
||||
self.log.info("copying profile to device: %s" % self.remote_profile)
|
||||
LOG.info("copying profile to device: %s" % self.remote_profile)
|
||||
self.device.rm(self.remote_profile, force=True, recursive=True)
|
||||
# self.device.mkdir(self.remote_profile)
|
||||
self.device.push(self.profile.profile, self.remote_profile)
|
||||
self.device.chmod(self.remote_profile, recursive=True, root=True)
|
||||
|
||||
except Exception:
|
||||
self.log.error("Unable to copy profile to device.")
|
||||
LOG.error("Unable to copy profile to device.")
|
||||
raise
|
||||
|
||||
def turn_on_android_app_proxy(self):
|
||||
# for geckoview/android pageload playback we can't use a policy to turn on the
|
||||
# proxy; we need to set prefs instead; note that the 'host' may be different
|
||||
# than '127.0.0.1' so we must set the prefs accordingly
|
||||
self.log.info("setting profile prefs to turn on the android app proxy")
|
||||
LOG.info("setting profile prefs to turn on the android app proxy")
|
||||
proxy_prefs = {}
|
||||
proxy_prefs["network.proxy.type"] = 1
|
||||
proxy_prefs["network.proxy.http"] = self.config['host']
|
||||
@ -906,7 +909,7 @@ class RaptorAndroid(Raptor):
|
||||
self.profile.set_preferences(proxy_prefs)
|
||||
|
||||
def launch_firefox_android_app(self, test_name):
|
||||
self.log.info("starting %s" % self.config['app'])
|
||||
LOG.info("starting %s" % self.config['app'])
|
||||
|
||||
extra_args = ["-profile", self.remote_profile,
|
||||
"--es", "env0", "LOG_VERBOSE=1",
|
||||
@ -944,8 +947,8 @@ class RaptorAndroid(Raptor):
|
||||
raise Exception("Error launching %s. App did not start properly!" %
|
||||
self.config['binary'])
|
||||
except Exception as e:
|
||||
self.log.error("Exception launching %s" % self.config['binary'])
|
||||
self.log.error("Exception: %s %s" % (type(e).__name__, str(e)))
|
||||
LOG.error("Exception launching %s" % self.config['binary'])
|
||||
LOG.error("Exception: %s %s" % (type(e).__name__, str(e)))
|
||||
if self.config['power_test']:
|
||||
finish_android_power_test(self, test_name)
|
||||
raise
|
||||
@ -961,10 +964,10 @@ class RaptorAndroid(Raptor):
|
||||
_source = os.path.join(source_dir, next_file)
|
||||
_dest = os.path.join(target_dir, next_file)
|
||||
if os.path.exists(_source):
|
||||
self.log.info("copying %s to %s" % (_source, _dest))
|
||||
LOG.info("copying %s to %s" % (_source, _dest))
|
||||
shutil.copyfile(_source, _dest)
|
||||
else:
|
||||
self.log.critical("unable to find ssl cert db file: %s" % _source)
|
||||
LOG.critical("unable to find ssl cert db file: %s" % _source)
|
||||
|
||||
def run_tests(self, tests, test_names):
|
||||
self.setup_adb_device()
|
||||
@ -978,7 +981,7 @@ class RaptorAndroid(Raptor):
|
||||
self.set_reverse_ports(is_benchmark=is_benchmark)
|
||||
|
||||
def run_test_teardown(self):
|
||||
self.log.info('removing reverse socket connections')
|
||||
LOG.info('removing reverse socket connections')
|
||||
self.device.remove_socket_connections('reverse')
|
||||
|
||||
super(RaptorAndroid, self).run_test_teardown()
|
||||
@ -1025,16 +1028,16 @@ class RaptorAndroid(Raptor):
|
||||
|
||||
The default will be to run in warm mode; unless 'cold = true' is set in the test INI.
|
||||
'''
|
||||
self.log.info("test %s is running in cold mode; browser WILL be restarted between "
|
||||
"page cycles" % test['name'])
|
||||
LOG.info("test %s is running in cold mode; browser WILL be restarted between "
|
||||
"page cycles" % test['name'])
|
||||
|
||||
if self.config['power_test']:
|
||||
init_android_power_test(self)
|
||||
|
||||
for test['browser_cycle'] in range(1, test['expected_browser_cycles'] + 1):
|
||||
|
||||
self.log.info("begin browser cycle %d of %d for test %s"
|
||||
% (test['browser_cycle'], test['expected_browser_cycles'], test['name']))
|
||||
LOG.info("begin browser cycle %d of %d for test %s"
|
||||
% (test['browser_cycle'], test['expected_browser_cycles'], test['name']))
|
||||
|
||||
self.run_test_setup(test)
|
||||
|
||||
@ -1048,7 +1051,7 @@ class RaptorAndroid(Raptor):
|
||||
# an ssl cert db has now been created in the profile; copy it out so we
|
||||
# can use the same cert db in future test cycles / browser restarts
|
||||
local_cert_db_dir = tempfile.mkdtemp()
|
||||
self.log.info("backing up browser ssl cert db that was created via certutil")
|
||||
LOG.info("backing up browser ssl cert db that was created via certutil")
|
||||
self.copy_cert_db(self.config['local_profile_dir'], local_cert_db_dir)
|
||||
|
||||
if self.config['host'] not in ('localhost', '127.0.0.1'):
|
||||
@ -1065,7 +1068,7 @@ class RaptorAndroid(Raptor):
|
||||
if test.get('playback') is not None:
|
||||
# get cert db from previous cycle profile and copy into new clean profile
|
||||
# this saves us from having to start playback again / recreate cert db etc.
|
||||
self.log.info("copying existing ssl cert db into new browser profile")
|
||||
LOG.info("copying existing ssl cert db into new browser profile")
|
||||
self.copy_cert_db(local_cert_db_dir, self.config['local_profile_dir'])
|
||||
|
||||
self.run_test_setup(test)
|
||||
@ -1085,7 +1088,7 @@ class RaptorAndroid(Raptor):
|
||||
|
||||
# in debug mode, and running locally, leave the browser running
|
||||
if self.debug_mode and self.config['run_local']:
|
||||
self.log.info("* debug-mode enabled - please shutdown the browser manually...")
|
||||
LOG.info("* debug-mode enabled - please shutdown the browser manually...")
|
||||
self.runner.wait(timeout=None)
|
||||
|
||||
# break test execution if a exception is present
|
||||
@ -1093,8 +1096,8 @@ class RaptorAndroid(Raptor):
|
||||
break
|
||||
|
||||
def run_test_warm(self, test, timeout=None):
|
||||
self.log.info("test %s is running in warm mode; browser will NOT be restarted between "
|
||||
"page cycles" % test['name'])
|
||||
LOG.info("test %s is running in warm mode; browser will NOT be restarted between "
|
||||
"page cycles" % test['name'])
|
||||
if self.config['power_test']:
|
||||
init_android_power_test(self)
|
||||
|
||||
@ -1122,7 +1125,7 @@ class RaptorAndroid(Raptor):
|
||||
|
||||
# in debug mode, and running locally, leave the browser running
|
||||
if self.debug_mode and self.config['run_local']:
|
||||
self.log.info("* debug-mode enabled - please shutdown the browser manually...")
|
||||
LOG.info("* debug-mode enabled - please shutdown the browser manually...")
|
||||
self.runner.wait(timeout=None)
|
||||
|
||||
def check_for_crashes(self):
|
||||
@ -1138,18 +1141,18 @@ class RaptorAndroid(Raptor):
|
||||
dump_dir = tempfile.mkdtemp()
|
||||
remote_dir = posixpath.join(self.remote_profile, 'minidumps')
|
||||
if not self.device.is_dir(remote_dir):
|
||||
self.log.error("No crash directory (%s) found on remote device" % remote_dir)
|
||||
LOG.error("No crash directory (%s) found on remote device" % remote_dir)
|
||||
return
|
||||
self.device.pull(remote_dir, dump_dir)
|
||||
mozcrash.log_crashes(self.log, dump_dir, self.config['symbols_path'])
|
||||
mozcrash.log_crashes(LOG, dump_dir, self.config['symbols_path'])
|
||||
finally:
|
||||
try:
|
||||
shutil.rmtree(dump_dir)
|
||||
except Exception:
|
||||
self.log.warning("unable to remove directory: %s" % dump_dir)
|
||||
LOG.warning("unable to remove directory: %s" % dump_dir)
|
||||
|
||||
def clean_up(self):
|
||||
self.log.info("removing test folder for raptor: %s" % self.remote_test_root)
|
||||
LOG.info("removing test folder for raptor: %s" % self.remote_test_root)
|
||||
self.device.rm(self.remote_test_root, force=True, recursive=True)
|
||||
|
||||
super(RaptorAndroid, self).clean_up()
|
||||
@ -1158,7 +1161,6 @@ class RaptorAndroid(Raptor):
|
||||
def main(args=sys.argv[1:]):
|
||||
args = parse_args()
|
||||
commandline.setup_logging('raptor', args, {'tbpl': sys.stdout})
|
||||
LOG = get_default_logger(component='raptor-main')
|
||||
|
||||
LOG.info("raptor-start")
|
||||
|
||||
|
@ -6,10 +6,10 @@
|
||||
# received from the raptor control server
|
||||
from __future__ import absolute_import
|
||||
|
||||
from mozlog import get_proxy_logger
|
||||
from logger.logger import RaptorLogger
|
||||
from output import Output
|
||||
|
||||
LOG = get_proxy_logger(component='results-handler')
|
||||
LOG = RaptorLogger(component='raptor-results-handler')
|
||||
|
||||
|
||||
class RaptorResultsHandler():
|
||||
|
@ -10,9 +10,9 @@ import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
from mozlog import get_proxy_logger, get_default_logger
|
||||
from logger.logger import RaptorLogger
|
||||
|
||||
LOG = get_proxy_logger(component="raptor-utils")
|
||||
LOG = RaptorLogger(component='raptor-utils')
|
||||
here = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
external_tools_path = os.environ.get('EXTERNALTOOLSPATH', None)
|
||||
@ -50,30 +50,31 @@ def transform_platform(str_to_transform, config_platform, config_processor=None)
|
||||
|
||||
def view_gecko_profile(ffox_bin):
|
||||
# automatically load the latest talos gecko-profile archive in profiler.firefox.com
|
||||
LOG = get_default_logger(component='raptor-view-gecko-profile')
|
||||
LOG_GECKO = RaptorLogger(component='raptor-view-gecko-profile')
|
||||
|
||||
if sys.platform.startswith('win') and not ffox_bin.endswith(".exe"):
|
||||
ffox_bin = ffox_bin + ".exe"
|
||||
|
||||
if not os.path.exists(ffox_bin):
|
||||
LOG.info("unable to find Firefox bin, cannot launch view-gecko-profile")
|
||||
LOG_GECKO.info("unable to find Firefox bin, cannot launch view-gecko-profile")
|
||||
return
|
||||
|
||||
profile_zip = os.environ.get('RAPTOR_LATEST_GECKO_PROFILE_ARCHIVE', None)
|
||||
if profile_zip is None or not os.path.exists(profile_zip):
|
||||
LOG.info("No local talos gecko profiles were found so not launching profiler.firefox.com")
|
||||
LOG_GECKO.info("No local talos gecko profiles were found so not "
|
||||
"launching profiler.firefox.com")
|
||||
return
|
||||
|
||||
# need the view-gecko-profile tool, it's in repo/testing/tools
|
||||
repo_dir = os.environ.get('MOZ_DEVELOPER_REPO_DIR', None)
|
||||
if repo_dir is None:
|
||||
LOG.info("unable to find MOZ_DEVELOPER_REPO_DIR, can't launch view-gecko-profile")
|
||||
LOG_GECKO.info("unable to find MOZ_DEVELOPER_REPO_DIR, can't launch view-gecko-profile")
|
||||
return
|
||||
|
||||
view_gp = os.path.join(repo_dir, 'testing', 'tools',
|
||||
'view_gecko_profile', 'view_gecko_profile.py')
|
||||
if not os.path.exists(view_gp):
|
||||
LOG.info("unable to find the view-gecko-profile tool, cannot launch it")
|
||||
LOG_GECKO.info("unable to find the view-gecko-profile tool, cannot launch it")
|
||||
return
|
||||
|
||||
command = ['python',
|
||||
@ -81,8 +82,8 @@ def view_gecko_profile(ffox_bin):
|
||||
'-b', ffox_bin,
|
||||
'-p', profile_zip]
|
||||
|
||||
LOG.info('Auto-loading this profile in perfhtml.io: %s' % profile_zip)
|
||||
LOG.info(command)
|
||||
LOG_GECKO.info('Auto-loading this profile in perfhtml.io: %s' % profile_zip)
|
||||
LOG_GECKO.info(command)
|
||||
|
||||
# if the view-gecko-profile tool fails to launch for some reason, we don't
|
||||
# want to crash talos! just dump error and finsh up talos as usual
|
||||
@ -92,12 +93,12 @@ def view_gecko_profile(ffox_bin):
|
||||
stderr=subprocess.PIPE)
|
||||
# that will leave it running in own instance and let talos finish up
|
||||
except Exception as e:
|
||||
LOG.info("failed to launch view-gecko-profile tool, exeption: %s" % e)
|
||||
LOG_GECKO.info("failed to launch view-gecko-profile tool, exeption: %s" % e)
|
||||
return
|
||||
|
||||
time.sleep(5)
|
||||
ret = view_profile.poll()
|
||||
if ret is None:
|
||||
LOG.info("view-gecko-profile successfully started as pid %d" % view_profile.pid)
|
||||
LOG_GECKO.info("view-gecko-profile successfully started as pid %d" % view_profile.pid)
|
||||
else:
|
||||
LOG.error('view-gecko-profile process failed to start, poll returned: %s' % ret)
|
||||
LOG_GECKO.error('view-gecko-profile process failed to start, poll returned: %s' % ret)
|
||||
|
Loading…
Reference in New Issue
Block a user