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

MozReview-Commit-ID: 5BcunutbebG
This commit is contained in:
Syd Polk 2016-02-10 11:48:25 -06:00
parent d273701620
commit c3c0fb77c6
2 changed files with 75 additions and 0 deletions

View File

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

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)