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) e10s = CommandArgument('--e10s', action='store_true', help='Use content processes.') func = e10s(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) 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) 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 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) 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) 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 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) 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', help='How many chunks to split the tests up into.') func = totalChunks(func) thisChunk = CommandArgument( '--this-chunk', dest='thisChunk', 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 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 ReftestCommand(func): """Decorator that adds shared command arguments to reftest commands.""" debugger = CommandArgument("--debugger", metavar="DEBUGGER", help=DEBUGGER_HELP) func = debugger(func) debugger_args = CommandArgument( "--debugger-args", metavar="DEBUGGER_ARGS", help="Arguments to pass to the debugger." ) func = debugger_args(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 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 B2GCommand(func): """Decorator that adds shared command arguments to b2g reftest 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) 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) 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 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) 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) 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) 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) totalChunks = CommandArgument('--total-chunks', dest='totalChunks', help = 'How many chunks to split the tests up into.') func = totalChunks(func) thisChunk = CommandArgument('--this-chunk', dest='thisChunk', help = 'Which chunk to run between 1 and --total-chunks.') func = thisChunk(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 ReftestCommand(func): """Decorator that adds shared command arguments to reftest commands.""" debugger = CommandArgument('--debugger', metavar='DEBUGGER', help=DEBUGGER_HELP) func = debugger(func) debugger_args = CommandArgument('--debugger-args', metavar='DEBUGGER_ARGS', help='Arguments to pass to the debugger.') func = debugger_args(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 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 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) return func
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) 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) 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) 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 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
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_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) 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) setenv = CommandArgument('--setenv', default=[], action='append', metavar='NAME=VALUE', dest='environment', help="Sets the given variable in the application's environment") func = setenv(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) 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) 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) 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 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 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) 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) 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 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) 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