Skip to content

Commit

Permalink
Bug 1732376 - Add a --clean option to remove the raptor venv before r…
Browse files Browse the repository at this point in the history
…unning r=sparky,perftest-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D139830
  • Loading branch information
junngo committed Mar 16, 2022
1 parent e42e4d2 commit 9fd67f4
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .hgignore
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ tps_result\.json
^testing/raptor/raptor/tests/json/
^testing/raptor/webext/raptor/auto_gen_test_config.js

# Ignore condprofile build directory
^testing/condprofile/build

# Ignore browsertime output directory
^browsertime-results

Expand Down
16 changes: 16 additions & 0 deletions testing/mozharness/mozharness/mozilla/testing/raptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,18 @@ class Raptor(
"help": "Enable marionette tracing",
},
],
[
["--clean"],
{
"action": "store_true",
"dest": "clean",
"default": False,
"help": (
"Clean the python virtualenv (remove, and rebuild) for "
"Raptor before running tests."
),
},
],
]
+ testing_config_options
+ copy.deepcopy(code_coverage_config_options)
Expand Down Expand Up @@ -648,6 +660,7 @@ def __init__(self, **kwargs):
self.browsertime_video = False
self.enable_marionette_trace = self.config.get("enable_marionette_trace")
self.browser_cycles = self.config.get("browser_cycles")
self.clean = self.config.get("clean")

for (arg,), details in Raptor.browsertime_options:
# Allow overriding defaults on the `./mach raptor-test ...` command-line.
Expand Down Expand Up @@ -987,6 +1000,9 @@ def create_virtualenv(self, **kwargs):
# We need it in-path to import jsonschema later when validating output for perfherder.
_virtualenv_path = self.config.get("virtualenv_path")

if self.clean:
rmtree(_virtualenv_path)

if self.run_local and os.path.exists(_virtualenv_path):
self.info("Virtualenv already exists, skipping creation")
# ffmpeg exists outside of this virtual environment so
Expand Down
2 changes: 2 additions & 0 deletions testing/raptor/mach_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def init_variables(self, raptor_args, kwargs):
self.device_name = kwargs["device_name"]
self.enable_marionette_trace = kwargs["enable_marionette_trace"]
self.browsertime_visualmetrics = kwargs["browsertime_visualmetrics"]
self.clean = kwargs["clean"]

if Conditions.is_android(self) or kwargs["app"] in ANDROID_BROWSERS:
self.binary_path = None
Expand Down Expand Up @@ -178,6 +179,7 @@ def make_config(self):
"enable_marionette_trace": self.enable_marionette_trace,
"browsertime_visualmetrics": self.browsertime_visualmetrics,
"mozbuild_path": get_state_dir(),
"clean": self.clean,
}

sys.path.insert(0, os.path.join(self.topsrcdir, "tools", "browsertime"))
Expand Down
7 changes: 7 additions & 0 deletions testing/raptor/raptor/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,13 @@ def create_parser(mach_interface=False):
default=False,
help="Enable marionette tracing",
)
add_arg(
"--clean",
dest="clean",
action="store_true",
default=False,
help="Clean the python virtualenv (remove, and rebuild) for Raptor before running tests.",
)

add_logging_group(parser)
return parser
Expand Down

0 comments on commit 9fd67f4

Please sign in to comment.