Skip to content

Commit

Permalink
Bug 1949205 - Create artifacts directory if it doesn't exist. r=perft…
Browse files Browse the repository at this point in the history
…est-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
  • Loading branch information
Greg Mierzwinski committed Feb 27, 2025
1 parent e9a2346 commit de842a4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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/
3 changes: 3 additions & 0 deletions .hgignore
Original file line number Diff line number Diff line change
Expand Up @@ -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/
5 changes: 5 additions & 0 deletions python/mozperftest/mozperftest/mach_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -88,6 +89,10 @@ def full_path(selection):
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
Expand Down
8 changes: 5 additions & 3 deletions python/mozperftest/mozperftest/test/mochitest.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,11 @@ def _enable_gecko_profiling(self):
# 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}")

Expand Down

0 comments on commit de842a4

Please sign in to comment.