def ReftestCommand(func): """Decorator that adds shared command arguments to reftest commands.""" debugger = CommandArgument('--debugger', metavar='DEBUGGER', help=DEBUGGER_HELP) func = debugger(func) flter = CommandArgument( '--filter', metavar='REGEX', help='A JS regular expression to match test URLs against, to select ' 'a subset of tests to run.') func = flter(func) path = CommandArgument( 'test_file', nargs='?', metavar='MANIFEST', help='Reftest manifest file, or a directory in which to select ' 'reftest.list. If omitted, the entire test suite is executed.') func = path(func) parallel = CommandArgument('--parallel', action='store_true', help='Run tests in parallel.') func = parallel(func) return func
def __call__(self, func): after = SubCommand.__call__(self, func) args = [ CommandArgument( '--root', '-r', default='taskcluster/ci', help="root of the taskgraph definition relative to topsrcdir"), CommandArgument('--quiet', '-q', action="store_true", help="suppress all logging output"), CommandArgument('--verbose', '-v', action="store_true", help="include debug-level logging output"), CommandArgument('--parameters', '-p', required=True, help="parameters file (.yml or .json; see " "`taskcluster/docs/parameters.rst`)`"), CommandArgument( '--no-optimize', dest="optimize", action="store_false", default="true", help="do not remove tasks from the graph that are found in the " "index (a.k.a. optimize the graph)"), ] for arg in args: after = arg(after) return after
def __call__(self, func): after = SubCommand.__call__(self, func) args = [ CommandArgument('--root', '-r', help="root of the taskgraph definition relative to topsrcdir"), CommandArgument('--quiet', '-q', action="store_true", help="suppress all logging output"), CommandArgument('--verbose', '-v', action="store_true", help="include debug-level logging output"), CommandArgument('--json', '-J', action="store_const", dest="format", const="json", help="Output task graph as a JSON object"), CommandArgument('--labels', '-L', action="store_const", dest="format", const="labels", help="Output the label for each task in the task graph (default)"), CommandArgument('--parameters', '-p', default="project=mozilla-central", help="parameters file (.yml or .json; see " "`taskcluster/docs/parameters.rst`)`"), CommandArgument('--no-optimize', dest="optimize", action="store_false", default="true", help="do not remove tasks from the graph that are found in the " "index (a.k.a. optimize the graph)"), CommandArgument('--tasks-regex', '--tasks', default=None, help="only return tasks with labels matching this regular " "expression."), CommandArgument('--target-kind', default=None, help="only return tasks that are of the given kind, " "or their dependencies."), CommandArgument('-F', '--fast', dest='fast', default=False, action='store_true', help="enable fast task generation for local debugging."), ] for arg in args: after = arg(after) return after
def __call__(self, func): after = SubCommand.__call__(self, func) args = [ CommandArgument('--tree', metavar='TREE', type=str, help='Firefox tree.'), CommandArgument('--job', metavar='JOB', choices=['android-api-11', 'android-x86'], help='Build job.'), ] for arg in args: after = arg(after) return after
def B2GCommand(func): """Decorator that adds shared command arguments to b2g mochitest commands.""" busybox = CommandArgument( '--busybox', default=None, help='Path to busybox binary to install on device') func = busybox(func) logdir = CommandArgument('--logdir', default=None, help='directory to store log files') func = logdir(func) sdcard = CommandArgument('--sdcard', default="10MB", help='Define size of sdcard: 1MB, 50MB...etc') func = sdcard(func) emulator_res = CommandArgument( '--emulator-res', default='800x1000', help='Emulator resolution of the format \'<width>x<height>\'') func = emulator_res(func) marionette = CommandArgument( '--marionette', default=None, help='host:port to use when connecting to Marionette') func = marionette(func) totalChunks = CommandArgument( '--total-chunks', dest='totalChunks', type=int, help='How many chunks to split the tests up into.') func = totalChunks(func) thisChunk = CommandArgument( '--this-chunk', dest='thisChunk', type=int, help='Which chunk to run between 1 and --total-chunks.') func = thisChunk(func) oop = CommandArgument('--enable-oop', action='store_true', dest='oop', help='Run tests in out-of-process mode.') func = oop(func) path = CommandArgument('test_file', default=None, nargs='?', metavar='TEST', help='Test to run. Can be specified as a single file, a ' \ 'directory, or omitted. If omitted, the entire test suite is ' \ 'executed.') func = path(func) return func
def B2GCommand(func): """Decorator that adds shared command arguments to b2g mochitest commands.""" busybox = CommandArgument( '--busybox', default=None, help='Path to busybox binary to install on device') func = busybox(func) logcatdir = CommandArgument('--logcat-dir', default=None, help='directory to store logcat dump files') func = logcatdir(func) profile = CommandArgument('--profile', default=None, help='for desktop testing, the path to the \ gaia profile to use') func = profile(func) geckopath = CommandArgument( '--gecko-path', default=None, help='the path to a gecko distribution that should \ be installed on the emulator prior to test') func = geckopath(func) nowindow = CommandArgument('--no-window', action='store_true', default=False, help='Pass --no-window to the emulator') func = nowindow(func) sdcard = CommandArgument('--sdcard', default="10MB", help='Define size of sdcard: 1MB, 50MB...etc') func = sdcard(func) emulator = CommandArgument( '--emulator', default='arm', help='Architecture of emulator to use: x86 or arm') func = emulator(func) marionette = CommandArgument( '--marionette', default=None, help='host:port to use when connecting to Marionette') func = marionette(func) path = CommandArgument('test_file', default=None, nargs='?', metavar='TEST', help='Test to run. Can be specified as a single file, a ' \ 'directory, or omitted. If omitted, the entire test suite is ' \ 'executed.') func = path(func) return func
def SyncStorageCommand(func): """Decorator that adds shared command arguments to services commands.""" port = CommandArgument('--port', metavar='PORT', type=int, default=DEFAULT_PORT, help='Port to run server on.') func = port(func) address = CommandArgument('--address', metavar='ADDRESS', default=DEFAULT_HOSTNAME, help='Hostname to bind server to.') func = address(func) return func
def __call__(self, func): after = SubCommand.__call__(self, func) args = [ CommandArgument('--tree', metavar='TREE', type=str, help='Firefox tree.'), CommandArgument('--job', metavar='JOB', choices=JOB_CHOICES, help='Build job.'), CommandArgument('--verbose', '-v', action='store_true', help='Print verbose output.'), ] for arg in args: after = arg(after) return after
def ReftestCommand(func): """Decorator that adds shared command arguments to reftest commands.""" debugger = CommandArgument('--debugger', metavar='DEBUGGER', help=DEBUGGER_HELP) func = debugger(func) flter = CommandArgument( '--filter', metavar='REGEX', help='A JS regular expression to match test URLs against, to select ' 'a subset of tests to run.') func = flter(func) path = CommandArgument( 'test_file', nargs='?', metavar='MANIFEST', help='Reftest manifest file, or a directory in which to select ' 'reftest.list. If omitted, the entire test suite is executed.') func = path(func) parallel = CommandArgument('--parallel', action='store_true', help='Run tests in parallel.') func = parallel(func) shuffle = CommandArgument('--shuffle', action='store_true', help='Run tests in random order.') func = shuffle(func) e10s = CommandArgument('--e10s', action='store_true', help='Use content processes.') func = e10s(func) extraPrefs = CommandArgument('--setpref', action='append', default=[], dest='extraPrefs', metavar='PREF=VALUE', help='Set prefs in the reftest profile.') func = extraPrefs(func) totalChunks = CommandArgument( '--total-chunks', help='How many chunks to split the tests up into.') func = totalChunks(func) thisChunk = CommandArgument( '--this-chunk', help='Which chunk to run between 1 and --total-chunks.') func = thisChunk(func) return func
def MochitestCommand(func): """Decorator that adds shared command arguments to mochitest commands.""" # This employs light Python magic. Keep in mind a decorator is just a # function that takes a function, does something with it, then returns a # (modified) function. Here, we chain decorators onto the passed in # function. debugger = CommandArgument( '--debugger', '-d', metavar='DEBUGGER', help='Debugger binary to run test in. Program name or path.') func = debugger(func) shuffle = CommandArgument('--shuffle', action='store_true', help='Shuffle execution order.') func = shuffle(func) keep_open = CommandArgument( '--keep-open', action='store_true', help='Keep the browser open after tests complete.') func = keep_open(func) rerun = CommandArgument( '--rerun-failures', action='store_true', help='Run only the tests that filed during the last test run.') func = rerun(func) autorun = CommandArgument( '--no-autorun', action='store_true', help='Do not starting running tests automatically.') func = autorun(func) repeat = CommandArgument('--repeat', type=int, default=0, help='Repeat the test the given number of times.') func = repeat(func) slow = CommandArgument('--slow', action='store_true', help='Delay execution between tests.') func = slow(func) path = CommandArgument('test_file', default=None, nargs='?', metavar='TEST', help='Test to run. Can be specified as a single file, a ' \ 'directory, or omitted. If omitted, the entire test suite is ' \ 'executed.') func = path(func) return func
def __call__(self, func): after = SubCommand.__call__(self, func) args = [ CommandArgument("--tree", metavar="TREE", type=str, help="Firefox tree."), CommandArgument("--job", metavar="JOB", choices=JOB_CHOICES, help="Build job."), CommandArgument("--verbose", "-v", action="store_true", help="Print verbose output."), ] for arg in args: after = arg(after) return after
def B2GCommand(func): """Decorator that adds shared command arguments to b2g mochitest commands.""" busybox = CommandArgument( '--busybox', default=None, help='Path to busybox binary to install on device') func = busybox(func) logcatdir = CommandArgument('--logcat-dir', default=None, help='directory to store logcat dump files') func = logcatdir(func) geckopath = CommandArgument( '--gecko-path', default=None, help='the path to a gecko distribution that should \ be installed on the emulator prior to test') func = geckopath(func) sdcard = CommandArgument('--sdcard', default="10MB", help='Define size of sdcard: 1MB, 50MB...etc') func = sdcard(func) emulator_res = CommandArgument( '--emulator-res', default='800x1000', help='Emulator resolution of the format \'<width>x<height>\'') func = emulator_res(func) emulator = CommandArgument( '--emulator', default='arm', help='Architecture of emulator to use: x86 or arm') func = emulator(func) marionette = CommandArgument( '--marionette', default=None, help='host:port to use when connecting to Marionette') func = marionette(func) path = CommandArgument('test_file', default=None, nargs='?', metavar='TEST', help='Test to run. Can be specified as a single file, a ' \ 'directory, or omitted. If omitted, the entire test suite is ' \ 'executed.') func = path(func) return func
def build_like_command_arguments(decorated_function): decorators = [ CommandArgument( '--target', '-t', default=None, help='Cross compile for given target platform', ), CommandArgument( '--media-stack', default=None, choices=["gstreamer", "dummy"], help='Which media stack to use', ), CommandArgument( '--android', default=None, action='store_true', help='Build for Android', ), CommandArgument( '--magicleap', default=None, action='store_true', help='Build for Magic Leap', ), CommandArgument( '--libsimpleservo', default=None, action='store_true', help= 'Build the libsimpleservo library instead of the servo executable', ), CommandArgument( '--features', default=None, help='Space-separated list of features to also build', nargs='+', ), CommandArgument( '--debug-mozjs', default=None, action='store_true', help='Enable debug assertions in mozjs', ), CommandArgument( '--with-debug-assertions', default=None, action='store_true', help='Enable debug assertions in release', ), CommandArgument( '--with-frame-pointer', default=None, action='store_true', help= 'Build with frame pointer enabled, used by the background hang monitor.', ), CommandArgument('--with-layout-2020', default=None, action='store_true'), CommandArgument('--with-layout-2013', default=None, action='store_true'), CommandArgument('--without-wgl', default=None, action='store_true'), ] for decorator in decorators: decorated_function = decorator(decorated_function) return decorated_function
def B2GCommand(func): """Decorator that adds shared command arguments to b2g mochitest commands.""" busybox = CommandArgument( '--busybox', default=None, help='Path to busybox binary to install on device') func = busybox(func) logdir = CommandArgument('--logdir', default=None, help='directory to store log files') func = logdir(func) profile = CommandArgument('--profile', default=None, help='for desktop testing, the path to the \ gaia profile to use') func = profile(func) geckopath = CommandArgument('--gecko-path', default=None, help='the path to a gecko distribution that should \ be installed on the emulator prior to test') func = geckopath(func) nowindow = CommandArgument( '--no-window', action='store_true', default=False, help='Pass --no-window to the emulator') func = nowindow(func) sdcard = CommandArgument('--sdcard', default="10MB", help='Define size of sdcard: 1MB, 50MB...etc') func = sdcard(func) marionette = CommandArgument( '--marionette', default=None, help='host:port to use when connecting to Marionette') func = marionette(func) chunk_total = CommandArgument( '--total-chunks', type=int, help='Total number of chunks to split tests into.') func = chunk_total(func) this_chunk = CommandArgument( '--this-chunk', type=int, help='If running tests by chunks, the number of the chunk to run.') func = this_chunk(func) path = CommandArgument( 'test_paths', default=None, nargs='*', metavar='TEST', help='Test to run. Can be specified as a single file, a ' 'directory, or omitted. If omitted, the entire test suite is ' 'executed.') func = path(func) repeat = CommandArgument('--repeat', type=int, default=0, help='Repeat the test the given number of times.') func = repeat(func) runUntilFailure = CommandArgument( "--run-until-failure", action='store_true', help='Run tests repeatedly and stops on the first time a test fails. ' 'Default cap is 30 runs, which can be overwritten ' 'with the --repeat parameter.') func = runUntilFailure(func) return func
def MochitestCommand(func): """Decorator that adds shared command arguments to mochitest commands.""" # This employs light Python magic. Keep in mind a decorator is just a # function that takes a function, does something with it, then returns a # (modified) function. Here, we chain decorators onto the passed in # function. debugger = CommandArgument( '--debugger', '-d', metavar='DEBUGGER', help='Debugger binary to run test in. Program name or path.') func = debugger(func) debugger_args = CommandArgument( '--debugger-args', metavar='DEBUGGER_ARGS', help='Arguments to pass to the debugger.') func = debugger_args(func) # Bug 933807 introduced JS_DISABLE_SLOW_SCRIPT_SIGNALS to avoid clever # segfaults induced by the slow-script-detecting logic for Ion/Odin JITted # code. If we don't pass this, the user will need to periodically type # "continue" to (safely) resume execution. There are ways to implement # automatic resuming; see the bug. slowscript = CommandArgument( '--slowscript', action='store_true', help='Do not set the JS_DISABLE_SLOW_SCRIPT_SIGNALS env variable; when not set, recoverable but misleading SIGSEGV instances may occur in Ion/Odin JIT code') func = slowscript(func) screenshot_on_fail = CommandArgument( '--screenshot-on-fail', action='store_true', help='Take screenshots on all test failures. Set $MOZ_UPLOAD_DIR to a directory for storing the screenshots.') func = screenshot_on_fail(func) shuffle = CommandArgument('--shuffle', action='store_true', help='Shuffle execution order.') func = shuffle(func) keep_open = CommandArgument( '--keep-open', action='store_const', dest='closure_behaviour', const='open', default='auto', help='Always keep the browser open after tests complete.') func = keep_open(func) autoclose = CommandArgument( '--auto-close', action='store_const', dest='closure_behaviour', const='close', default='auto', help='Always close the browser after tests complete.') func = autoclose(func) rerun = CommandArgument( '--rerun-failures', action='store_true', help='Run only the tests that failed during the last test run.') func = rerun(func) autorun = CommandArgument( '--no-autorun', action='store_true', help='Do not starting running tests automatically.') func = autorun(func) repeat = CommandArgument('--repeat', type=int, default=0, help='Repeat the test the given number of times.') func = repeat(func) runUntilFailure = CommandArgument( "--run-until-failure", action='store_true', help='Run tests repeatedly and stops on the first time a test fails. ' 'Default cap is 30 runs, which can be overwritten ' 'with the --repeat parameter.') func = runUntilFailure(func) slow = CommandArgument('--slow', action='store_true', help='Delay execution between tests.') func = slow(func) end_at = CommandArgument( '--end-at', type=str, help='Stop running the test sequence at this test.') func = end_at(func) start_at = CommandArgument( '--start-at', type=str, help='Start running the test sequence at this test.') func = start_at(func) chunk_dir = CommandArgument( '--chunk-by-dir', type=int, help='Group tests together in chunks by this many top directories.') func = chunk_dir(func) chunk_total = CommandArgument( '--total-chunks', type=int, help='Total number of chunks to split tests into.') func = chunk_total(func) this_chunk = CommandArgument( '--this-chunk', type=int, help='If running tests by chunks, the number of the chunk to run.') func = this_chunk(func) debug_on_failure = CommandArgument( '--debug-on-failure', action='store_true', help='Breaks execution and enters the JS debugger on a test failure. ' 'Should be used together with --jsdebugger.') func = debug_on_failure(func) setpref = CommandArgument('--setpref', default=[], action='append', metavar='PREF=VALUE', dest='extraPrefs', help='defines an extra user preference') func = setpref(func) jsdebugger = CommandArgument( '--jsdebugger', action='store_true', help='Start the browser JS debugger before running the test. Implies --no-autorun.') func = jsdebugger(func) e10s = CommandArgument( '--e10s', action='store_true', help='Run tests with electrolysis preferences and test filtering enabled.') func = e10s(func) strict_content_sandbox = CommandArgument( '--strict-content-sandbox', action='store_true', help='Run tests with a more strict content sandbox (Windows only).') func = strict_content_sandbox(func) this_chunk = CommandArgument( '--nested_oop', action='store_true', help='Run tests with nested oop preferences and test filtering enabled.') func = this_chunk(func) dmd = CommandArgument('--dmd', action='store_true', help='Run tests with DMD active.') func = dmd(func) dumpAboutMemory = CommandArgument( '--dump-about-memory-after-test', action='store_true', help='Dump an about:memory log after every test.') func = dumpAboutMemory(func) dumpDMD = CommandArgument('--dump-dmd-after-test', action='store_true', help='Dump a DMD log after every test.') func = dumpDMD(func) dumpOutputDirectory = CommandArgument( '--dump-output-directory', action='store', help='Specifies the directory in which to place dumped memory reports.') func = dumpOutputDirectory(func) path = CommandArgument( 'test_paths', default=None, nargs='*', metavar='TEST', help='Test to run. Can be specified as a single file, a ' 'directory, or omitted. If omitted, the entire test suite is ' 'executed.') func = path(func) install_extension = CommandArgument( '--install-extension', help='Install given extension before running selected tests. ' 'Parameter is a path to xpi file.') func = install_extension(func) quiet = CommandArgument( '--quiet', default=False, action='store_true', help='Do not print test log lines unless a failure occurs.') func = quiet(func) setenv = CommandArgument( '--setenv', default=[], action='append', metavar='NAME=VALUE', dest='environment', help="Sets the given variable in the application's environment") func = setenv(func) runbydir = CommandArgument( '--run-by-dir', default=False, action='store_true', dest='runByDir', help='Run each directory in a single browser instance with a fresh profile.') func = runbydir(func) bisect_chunk = CommandArgument( '--bisect-chunk', type=str, dest='bisectChunk', help='Specify the failing test name to find the previous tests that may be causing the failure.') func = bisect_chunk(func) test_media = CommandArgument( '--use-test-media-devices', default=False, action='store_true', dest='useTestMediaDevices', help='Use test media device drivers for media testing.') func = test_media(func) app_override = CommandArgument( '--app-override', default=None, action='store', help="Override the default binary used to run tests with the path you provide, e.g. " " --app-override /usr/bin/firefox . " "If you have run ./mach package beforehand, you can specify 'dist' to " "run tests against the distribution bundle's binary.") func = app_override(func) timeout = CommandArgument( '--timeout', default=None, help='The per-test timeout time in seconds (default: 60 seconds)') func = timeout(func) max_timeouts = CommandArgument('--max-timeouts', default=None, help='The maximum number of timeouts permitted before halting testing') func = max_timeouts(func) return func
def MochitestCommand(func): """Decorator that adds shared command arguments to mochitest commands.""" # This employs light Python magic. Keep in mind a decorator is just a # function that takes a function, does something with it, then returns a # (modified) function. Here, we chain decorators onto the passed in # function. debugger = CommandArgument( '--debugger', '-d', metavar='DEBUGGER', help='Debugger binary to run test in. Program name or path.') func = debugger(func) debugger_args = CommandArgument('--debugger-args', metavar='DEBUGGER_ARGS', help='Arguments to pass to the debugger.') func = debugger_args(func) shuffle = CommandArgument('--shuffle', action='store_true', help='Shuffle execution order.') func = shuffle(func) keep_open = CommandArgument( '--keep-open', action='store_true', help='Keep the browser open after tests complete.') func = keep_open(func) rerun = CommandArgument( '--rerun-failures', action='store_true', help='Run only the tests that failed during the last test run.') func = rerun(func) autorun = CommandArgument( '--no-autorun', action='store_true', help='Do not starting running tests automatically.') func = autorun(func) repeat = CommandArgument('--repeat', type=int, default=0, help='Repeat the test the given number of times.') func = repeat(func) runUntilFailure = CommandArgument("--run-until-failure", action='store_true', help='Run a test repeatedly and stops on the first time the test fails. ' \ 'Only available when running a single test. Default cap is 30 runs, ' \ 'which can be overwritten with the --repeat parameter.') func = runUntilFailure(func) slow = CommandArgument('--slow', action='store_true', help='Delay execution between tests.') func = slow(func) chunk_dir = CommandArgument( '--chunk-by-dir', type=int, help='Group tests together in chunks by this many top directories.') func = chunk_dir(func) chunk_total = CommandArgument( '--total-chunks', type=int, help='Total number of chunks to split tests into.') func = chunk_total(func) this_chunk = CommandArgument( '--this-chunk', type=int, help='If running tests by chunks, the number of the chunk to run.') func = this_chunk(func) jsdebugger = CommandArgument( '--jsdebugger', action='store_true', help= 'Start the browser JS debugger before running the test. Implies --no-autorun.' ) func = jsdebugger(func) path = CommandArgument('test_file', default=None, nargs='?', metavar='TEST', help='Test to run. Can be specified as a single file, a ' \ 'directory, or omitted. If omitted, the entire test suite is ' \ 'executed.') func = path(func) return func
def __call__(self, func): after = SubCommand.__call__(self, func) args = [ CommandArgument( "--root", "-r", help="root of the taskgraph definition relative to topsrcdir", ), CommandArgument("--quiet", "-q", action="store_true", help="suppress all logging output"), CommandArgument( "--verbose", "-v", action="store_true", help="include debug-level logging output", ), CommandArgument( "--json", "-J", action="store_const", dest="format", const="json", help="Output task graph as a JSON object", ), CommandArgument( "--labels", "-L", action="store_const", dest="format", const="labels", help= "Output the label for each task in the task graph (default)", ), CommandArgument( "--parameters", "-p", default="project=mozilla-central", help="parameters file (.yml or .json; see " "`taskcluster/docs/parameters.rst`)`", ), CommandArgument( "--no-optimize", dest="optimize", action="store_false", default="true", help="do not remove tasks from the graph that are found in the " "index (a.k.a. optimize the graph)", ), CommandArgument( "--tasks-regex", "--tasks", default=None, help="only return tasks with labels matching this regular " "expression.", ), CommandArgument( "--target-kind", default=None, help="only return tasks that are of the given kind, " "or their dependencies.", ), CommandArgument( "-F", "--fast", dest="fast", default=False, action="store_true", help="enable fast task generation for local debugging.", ), CommandArgument( "-o", "--output-file", default=None, help="file path to store generated output.", ), CommandArgument( "--diff", const="default", nargs="?", default=None, help= "Generate and diff the current taskgraph against another revision. " "Without args the base revision will be used. A revision specifier such as " "the hash or `.~1` (hg) or `HEAD~1` (git) can be used as well.", ), ] for arg in args: after = arg(after) return after
def TestPathArg(func): test_paths = CommandArgument('test_paths', nargs='*', metavar='TEST', default=None, help='Test to run. Can be a single test file or a directory of tests to ' '(run recursively). If omitted, the entire suite is run.') return test_paths(func)
def MochitestCommand(func): """Decorator that adds shared command arguments to mochitest commands.""" # This employs light Python magic. Keep in mind a decorator is just a # function that takes a function, does something with it, then returns a # (modified) function. Here, we chain decorators onto the passed in # function. debugger = CommandArgument( '--debugger', '-d', metavar='DEBUGGER', help='Debugger binary to run test in. Program name or path.') func = debugger(func) debugger_args = CommandArgument('--debugger-args', metavar='DEBUGGER_ARGS', help='Arguments to pass to the debugger.') func = debugger_args(func) # Bug 933807 introduced JS_DISABLE_SLOW_SCRIPT_SIGNALS to avoid clever # segfaults induced by the slow-script-detecting logic for Ion/Odin JITted # code. If we don't pass this, the user will need to periodically type # "continue" to (safely) resume execution. There are ways to implement # automatic resuming; see the bug. slowscript = CommandArgument( '--slowscript', action='store_true', help= 'Do not set the JS_DISABLE_SLOW_SCRIPT_SIGNALS env variable; when not set, recoverable but misleading SIGSEGV instances may occur in Ion/Odin JIT code' ) func = slowscript(func) shuffle = CommandArgument('--shuffle', action='store_true', help='Shuffle execution order.') func = shuffle(func) keep_open = CommandArgument( '--keep-open', action='store_true', help='Keep the browser open after tests complete.') func = keep_open(func) rerun = CommandArgument( '--rerun-failures', action='store_true', help='Run only the tests that failed during the last test run.') func = rerun(func) autorun = CommandArgument( '--no-autorun', action='store_true', help='Do not starting running tests automatically.') func = autorun(func) repeat = CommandArgument('--repeat', type=int, default=0, help='Repeat the test the given number of times.') func = repeat(func) runUntilFailure = CommandArgument("--run-until-failure", action='store_true', help='Run tests repeatedly and stops on the first time a test fails. ' \ 'Default cap is 30 runs, which can be overwritten ' \ 'with the --repeat parameter.') func = runUntilFailure(func) slow = CommandArgument('--slow', action='store_true', help='Delay execution between tests.') func = slow(func) end_at = CommandArgument( '--end-at', type=str, help='Stop running the test sequence at this test.') func = end_at(func) start_at = CommandArgument( '--start-at', type=str, help='Start running the test sequence at this test.') func = start_at(func) chunk_dir = CommandArgument( '--chunk-by-dir', type=int, help='Group tests together in chunks by this many top directories.') func = chunk_dir(func) chunk_total = CommandArgument( '--total-chunks', type=int, help='Total number of chunks to split tests into.') func = chunk_total(func) this_chunk = CommandArgument( '--this-chunk', type=int, help='If running tests by chunks, the number of the chunk to run.') func = this_chunk(func) hide_subtests = CommandArgument( '--hide-subtests', action='store_true', help= 'If specified, will only log subtest results on failure or timeout.') func = hide_subtests(func) debug_on_failure = CommandArgument('--debug-on-failure', action='store_true', help='Breaks execution and enters the JS debugger on a test failure. ' \ 'Should be used together with --jsdebugger.') func = debug_on_failure(func) jsdebugger = CommandArgument( '--jsdebugger', action='store_true', help= 'Start the browser JS debugger before running the test. Implies --no-autorun.' ) func = jsdebugger(func) this_chunk = CommandArgument( '--e10s', action='store_true', help= 'Run tests with electrolysis preferences and test filtering enabled.') func = this_chunk(func) dmd = CommandArgument('--dmd', action='store_true', help='Run tests with DMD active.') func = dmd(func) dumpAboutMemory = CommandArgument( '--dump-about-memory-after-test', action='store_true', help='Dump an about:memory log after every test.') func = dumpAboutMemory(func) dumpDMD = CommandArgument('--dump-dmd-after-test', action='store_true', help='Dump a DMD log after every test.') func = dumpDMD(func) dumpOutputDirectory = CommandArgument( '--dump-output-directory', action='store', help='Specifies the directory in which to place dumped memory reports.' ) func = dumpOutputDirectory(func) path = CommandArgument('test_paths', default=None, nargs='*', metavar='TEST', help='Test to run. Can be specified as a single file, a ' \ 'directory, or omitted. If omitted, the entire test suite is ' \ 'executed.') func = path(func) install_extension = CommandArgument('--install-extension', help='Install given extension before running selected tests. ' \ 'Parameter is a path to xpi file.') func = install_extension(func) quiet = CommandArgument( '--quiet', default=False, action='store_true', help='Do not print test log lines unless a failure occurs.') func = quiet(func) return func
def B2GCommand(func): """Decorator that adds shared command arguments to b2g mochitest commands.""" busybox = CommandArgument( '--busybox', default=None, help='Path to busybox binary to install on device') func = busybox(func) logcatdir = CommandArgument('--logcat-dir', default=None, help='directory to store logcat dump files') func = logcatdir(func) profile = CommandArgument('--profile', default=None, help='for desktop testing, the path to the \ gaia profile to use') func = profile(func) geckopath = CommandArgument( '--gecko-path', default=None, help='the path to a gecko distribution that should \ be installed on the emulator prior to test') func = geckopath(func) nowindow = CommandArgument('--no-window', action='store_true', default=False, help='Pass --no-window to the emulator') func = nowindow(func) sdcard = CommandArgument('--sdcard', default="10MB", help='Define size of sdcard: 1MB, 50MB...etc') func = sdcard(func) emulator = CommandArgument( '--emulator', default='arm', help='Architecture of emulator to use: x86 or arm') func = emulator(func) marionette = CommandArgument( '--marionette', default=None, help='host:port to use when connecting to Marionette') func = marionette(func) chunk_total = CommandArgument( '--total-chunks', type=int, help='Total number of chunks to split tests into.') func = chunk_total(func) this_chunk = CommandArgument( '--this-chunk', type=int, help='If running tests by chunks, the number of the chunk to run.') func = this_chunk(func) hide_subtests = CommandArgument( '--hide-subtests', action='store_true', help= 'If specified, will only log subtest results on failure or timeout.') func = hide_subtests(func) path = CommandArgument('test_paths', default=None, nargs='*', metavar='TEST', help='Test to run. Can be specified as a single file, a ' \ 'directory, or omitted. If omitted, the entire test suite is ' \ 'executed.') func = path(func) return func
def MochitestCommand(func): """Decorator that adds shared command arguments to mochitest commands.""" # This employs light Python magic. Keep in mind a decorator is just a # function that takes a function, does something with it, then returns a # (modified) function. Here, we chain decorators onto the passed in # function. debugger = CommandArgument( '--debugger', '-d', metavar='DEBUGGER', help='Debugger binary to run test in. Program name or path.') func = debugger(func) debugger_args = CommandArgument('--debugger-args', metavar='DEBUGGER_ARGS', help='Arguments to pass to the debugger.') func = debugger_args(func) shuffle = CommandArgument('--shuffle', action='store_true', help='Shuffle execution order.') func = shuffle(func) keep_open = CommandArgument( '--keep-open', action='store_true', help='Keep the browser open after tests complete.') func = keep_open(func) rerun = CommandArgument( '--rerun-failures', action='store_true', help='Run only the tests that failed during the last test run.') func = rerun(func) autorun = CommandArgument( '--no-autorun', action='store_true', help='Do not starting running tests automatically.') func = autorun(func) repeat = CommandArgument('--repeat', type=int, default=0, help='Repeat the test the given number of times.') func = repeat(func) runUntilFailure = CommandArgument("--run-until-failure", action='store_true', help='Run tests repeatedly and stops on the first time a test fails. ' \ 'Default cap is 30 runs, which can be overwritten ' \ 'with the --repeat parameter.') func = runUntilFailure(func) slow = CommandArgument('--slow', action='store_true', help='Delay execution between tests.') func = slow(func) end_at = CommandArgument( '--end-at', type=str, help='Stop running the test sequence at this test.') func = end_at(func) start_at = CommandArgument( '--start-at', type=str, help='Start running the test sequence at this test.') func = start_at(func) chunk_dir = CommandArgument( '--chunk-by-dir', type=int, help='Group tests together in chunks by this many top directories.') func = chunk_dir(func) chunk_total = CommandArgument( '--total-chunks', type=int, help='Total number of chunks to split tests into.') func = chunk_total(func) this_chunk = CommandArgument( '--this-chunk', type=int, help='If running tests by chunks, the number of the chunk to run.') func = this_chunk(func) hide_subtests = CommandArgument( '--hide-subtests', action='store_true', help= 'If specified, will only log subtest results on failure or timeout.') func = hide_subtests(func) debug_on_failure = CommandArgument('--debug-on-failure', action='store_true', help='Breaks execution and enters the JS debugger on a test failure. ' \ 'Should be used together with --jsdebugger.') func = debug_on_failure(func) jsdebugger = CommandArgument( '--jsdebugger', action='store_true', help= 'Start the browser JS debugger before running the test. Implies --no-autorun.' ) func = jsdebugger(func) this_chunk = CommandArgument( '--e10s', action='store_true', help= 'Run tests with electrolysis preferences and test filtering enabled.') func = this_chunk(func) dmd = CommandArgument('--dmd', action='store_true', help='Run tests with DMD active.') func = dmd(func) dumpAboutMemory = CommandArgument( '--dump-about-memory-after-test', action='store_true', help='Dump an about:memory log after every test.') func = dumpAboutMemory(func) dumpDMD = CommandArgument('--dump-dmd-after-test', action='store_true', help='Dump a DMD log after every test.') func = dumpDMD(func) dumpOutputDirectory = CommandArgument( '--dump-output-directory', action='store', help='Specifies the directory in which to place dumped memory reports.' ) func = dumpOutputDirectory(func) path = CommandArgument('test_file', default=None, nargs='?', metavar='TEST', help='Test to run. Can be specified as a single file, a ' \ 'directory, or omitted. If omitted, the entire test suite is ' \ 'executed.') func = path(func) return func