Bug 1243546 - Add mach command for external-media-tests - r=gps

--HG--
extra : rebase_source : 04045035246948854cc91284dfad430cec1373fb
This commit is contained in:
Syd Polk 2016-02-09 18:10:19 -06:00
parent c04fc8bec6
commit 922d92002d
3 changed files with 78 additions and 1 deletions

View File

@ -67,6 +67,7 @@ SEARCH_PATHS = [
'config',
'dom/bindings',
'dom/bindings/parser',
'dom/media/test/external',
'layout/tools/reftest',
'other-licenses/ply',
'testing',
@ -109,6 +110,7 @@ MACH_MODULES = [
'addon-sdk/mach_commands.py',
'build/valgrind/mach_commands.py',
'dom/bindings/mach_commands.py',
'dom/media/test/external/mach_commands.py',
'layout/tools/reftest/mach_commands.py',
'python/mach_commands.py',
'python/mach/mach/commands/commandinfo.py',

View File

@ -91,7 +91,9 @@ class FirefoxMediaHarness(MarionetteHarness):
def cli():
mn_cli(MediaTestRunner, MediaTestArguments, FirefoxMediaHarness)
mn_cli(runner_class=MediaTestRunner,
parser_class=FirefoxMediaHarness,
args=args)
if __name__ == '__main__':
cli()

View File

@ -0,0 +1,73 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, unicode_literals
import os
import sys
from mozbuild.base import (
MachCommandBase,
MachCommandConditions as conditions,
)
from mach.decorators import (
CommandProvider,
Command,
)
def setup_argument_parser():
from external_media_harness.runtests import MediaTestArguments
return MediaTestArguments()
def run_external_media_test(tests, testtype=None, topsrcdir=None, **kwargs):
from external_media_harness.runtests import (
FirefoxMediaHarness,
MediaTestArguments,
MediaTestRunner,
mn_cli,
)
from mozlog.structured import commandline
parser = MediaTestArguments()
commandline.add_logging_group(parser)
args = parser.parse_args()
if not tests:
tests = [os.path.join(topsrcdir,
'dom/media/test/external/external_media_tests/manifest.ini')]
args.tests = tests
if not args.binary:
args.binary = kwargs['binary']
for k, v in kwargs.iteritems():
setattr(args, k, v)
parser.verify_usage(args)
args.logger = commandline.setup_logging("Firefox External Media Tests",
args,
{"mach": sys.stdout})
failed = mn_cli(MediaTestRunner, MediaTestArguments, FirefoxMediaHarness,
args=args)
if failed > 0:
return 1
else:
return 0
@CommandProvider
class MachCommands(MachCommandBase):
@Command('external-media-tests', category='testing',
description='Run Firefox external media tests.',
conditions=[conditions.is_firefox],
parser=setup_argument_parser,
)
def run_external_media_test(self, tests, **kwargs):
kwargs['binary'] = self.get_binary_path('app')
return run_external_media_test(tests, topsrcdir=self.topsrcdir, **kwargs)