# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/.
import argparse import logging import os import sys
import mozinfo import six from mach.decorators import Command, CommandArgument, CommandArgumentGroup from mozbuild.base import BinaryNotFoundException from mozbuild.base import MachCommandConditions as conditions
def setup_awsy_argument_parser(): from marionette_harness.runtests import MarionetteArguments from mozlog.structured import commandline
command_context.log(
logging.ERROR, "awsy",
{"directory": page_load_test_dir, "exception": exc}, "Failed to unzip `tp5n.zip` into " "`{directory}` with `{exception}`." + troubleshoot,
) raise exc
# If '--preferences' was not specified supply our default set. ifnot kwargs["prefs_files"]:
kwargs["prefs_files"] = [os.path.join(awsy_source_dir, "conf", "prefs.json")]
# Setup DMD env vars if necessary. if kwargs["dmd"]:
bin_dir = os.path.dirname(binary)
if"DMD"notin os.environ:
os.environ["DMD"] = "1"
# Work around a startup crash with DMD on windows if mozinfo.os == "win":
kwargs["pref"] = "security.sandbox.content.level:0"
command_context.log(
logging.WARNING, "awsy",
{}, "Forcing 'security.sandbox.content.level' = 0 because DMD is enabled.",
) elif mozinfo.os == "mac": # On mac binary is in MacOS and dmd.py is in Resources, ie: # Name.app/Contents/MacOS/libdmd.dylib # Name.app/Contents/Resources/dmd.py
bin_dir = os.path.join(bin_dir, "../Resources/")
# Also add the bin dir to the python path so we can use dmd.py if bin_dir notin sys.path:
sys.path.append(bin_dir)
for k, v in six.iteritems(kwargs):
setattr(args, k, v)
@Command( "awsy-test",
category="testing",
description="Run Are We Slim Yet (AWSY) memory usage testing using marionette.",
parser=setup_awsy_argument_parser,
)
@CommandArgumentGroup("AWSY")
@CommandArgument( "--web-root",
group="AWSY",
action="store",
type=str,
dest="webRootDir",
help="Path to web server root directory. If not specified, " "defaults to topobjdir/_tests/awsy/html.",
)
@CommandArgument( "--page-manifest",
group="AWSY",
action="store",
type=str,
dest="pageManifest",
help="Path to page manifest text file containing a list " "of urls to test. The urls must be served from localhost. If not " "specified, defaults to page_load_test/tp5n/tp5n.manifest under " "the web root.",
)
@CommandArgument( "--results",
group="AWSY",
action="store",
type=str,
dest="resultsDir",
help="Path to results directory. If not specified, defaults " "to the parent directory of the web root.",
)
@CommandArgument( "--quick",
group="AWSY",
action="store_true",
dest="quick",
default=False,
help="Set --entities=3, --iterations=1, --per-tab-pause=1, " "--settle-wait-time=1 for a quick test. Overrides any explicit " "argument settings.",
)
@CommandArgument( "--entities",
group="AWSY",
action="store",
type=int,
dest="entities",
help="Number of urls to load. Defaults to the total number of urls.",
)
@CommandArgument( "--max-tabs",
group="AWSY",
action="store",
type=int,
dest="maxTabs",
help="Maximum number of tabs to open. Defaults to %s." % MAX_TABS,
)
@CommandArgument( "--iterations",
group="AWSY",
action="store",
type=int,
dest="iterations",
help="Number of times to run through the test suite. " "Defaults to %s." % ITERATIONS,
)
@CommandArgument( "--per-tab-pause",
group="AWSY",
action="store",
type=int,
dest="perTabPause",
help="Seconds to wait in between opening tabs. Defaults to %s." % PER_TAB_PAUSE,
)
@CommandArgument( "--settle-wait-time",
group="AWSY",
action="store",
type=int,
dest="settleWaitTime",
help="Seconds to wait for things to settled down. " "Defaults to %s." % SETTLE_WAIT_TIME,
)
@CommandArgument( "--dmd",
group="AWSY",
action="store_true",
dest="dmd",
default=False,
help="Enable DMD during testing. Requires a DMD-enabled build.",
)
@CommandArgument( "--tp5",
group="AWSY",
action="store_true",
dest="tp5",
default=False,
help="Use the tp5 pageset during testing.",
)
@CommandArgument( "--base",
group="AWSY",
action="store_true",
dest="base",
default=False,
help="Run base memory usage tests.",
) def run_awsy_test(command_context, tests, **kwargs): """mach awsy-test runs the in-tree version of the Are We Slim Yet
(AWSY) tests.
awsy-test is implemented as a marionette test and marionette
test arguments also apply although they are not necessary
since reasonable defaults will be chosen.
The AWSY specific arguments can be found in the Command
Arguments for AWSY section below.
awsy-test will automatically download the tp5n.zip talos
pageset from tooltool and install it under
topobjdir/_tests/awsy/html. You can specify your own page set
by specifying --web-root and --page-manifest.
The results of the test will be placed in the results
directory specified by the --results argument.
On Windows, you may experience problems due to path length
errors when extracting the tp5n.zip file containing the
test pages or when attempting to write checkpoints to the
results directory. In that case, you should specify both
the --web-root and --results arguments pointing to a location with a short path. For example:
Note that the double backslashes are required. """
kwargs["logger_name"] = "Awsy Tests" if"test_objects"in kwargs:
tests = [] for obj in kwargs["test_objects"]:
tests.append(obj["file_relpath"]) del kwargs["test_objects"]
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.