Bug 1949205 - Create artifacts directory if it doesn't exist. r=perftest-reviewers,afinder

This patch ensures that the artifacts directory gets created if it doesn't exist when running mach perftest locally. It also adds a check for the existence of the output directory during mochitest gecko profiling. At the same time, the aritfacts folder is added to the hg/git ignore files.

Differential Revision: https://phabricator.services.mozilla.com/D238791
This commit is contained in:
Greg Mierzwinski
2025-02-27 13:59:41 +00:00
parent 34d9cc421e
commit edef7ed5a0
4 changed files with 16 additions and 3 deletions

3
.gitignore vendored
View File

@@ -359,3 +359,6 @@ media/libvpx/config/**/config.log
# Ignore generated files resulting from building the minidump analyzer tests.
toolkit/crashreporter/minidump-analyzer/analyzer-test/target/
# Ignore mozperftest artifacts folder
/artifacts/

View File

@@ -359,3 +359,6 @@ toolkit/themes/shared/design-system/node_modules/
# Ignore generated files resulting from building the minidump analyzer tests.
^toolkit/crashreporter/minidump-analyzer/analyzer-test/target/
# Ignore mozperftest artifacts folder
^artifacts/

View File

@@ -3,6 +3,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import json
import os
import pathlib
import sys
from functools import partial
@@ -88,6 +89,10 @@ def run_perftest(command_context, **kwargs):
print("\nSorry no support yet for multiple local perftest")
return
# Make sure the default artifacts directory exists
default_artifact_location = pathlib.Path(command_context.topsrcdir, "artifacts")
default_artifact_location.mkdir(parents=True, exist_ok=True)
sel = "\n".join(kwargs["tests"])
print("\nGood job! Best selection.\n%s" % sel)
# if the script is xpcshell, we can force the flavor here

View File

@@ -156,9 +156,11 @@ class Mochitest(Layer):
# Setup where the profile gets saved to so it doesn't get deleted
profile_path = os.getenv("MOZ_PROFILER_SHUTDOWN")
if not profile_path:
profile_path = (
Path(self.get_arg("output")) / "profile_mochitest.json"
)
output_dir = Path(self.get_arg("output"))
if not output_dir.is_absolute():
output_dir = Path(self.topsrcdir, output_dir)
output_dir.resolve().mkdir(parents=True, exist_ok=True)
profile_path = output_dir / "profile_mochitest.json"
os.environ["MOZ_PROFILER_SHUTDOWN"] = str(profile_path)
self.info(f"Profile will be saved to: {profile_path}")