author B2G Bumper Bot <release+b2gbumper@mozilla.com>
Mon, 17 Nov 2014 03:16:00 -0800
changeset 216081 c258debff3dab0196b2f442ff125f17a7ede9c3d
parent 209987 efb340c7b7ce3f074bc4a90f268251a2743a7623
child 253176 5c2f87f734bee93ae29a84028705a75e46752f99
permissions -rwxr-xr-x
Bumping gaia.json for 6 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/82204d99a4c4 Author: Dominic Kuo <dkuo@mozilla.com> Desc: Merge pull request #26146 from dominickuo/bug-1082938 Bug 1082938 - [Music] set play status to playing when play event fires, r=jimporter ======== https://hg.mozilla.org/integration/gaia-central/rev/958e4dddc74f Author: Dominic Kuo <dkuo@mozilla.com> Desc: Bug 1082938 - [Music] set play status to playing when play event fires ======== https://hg.mozilla.org/integration/gaia-central/rev/0ebefae658f4 Author: RickyChien <RickyChien@users.noreply.github.com> Desc: Merge pull request #26188 from RickyChien/bug-1022728 Bug 1022728 - Prevent building gaia when running ./build.sh gecko r=@cctuan ======== https://hg.mozilla.org/integration/gaia-central/rev/366a14e421f4 Author: Ricky Chien <ricky060709@gmail.com> Desc: Bug 1022728 - Prevent building gaia when running ./build.sh gecko ======== https://hg.mozilla.org/integration/gaia-central/rev/f386379f0d8d Author: Etienne Segonzac <etienne@segonzac.info> Desc: Merge pull request #25938 from etiennesegonzac/bug-1088166 Bug 1088166 - Adding sanity marionette JS tests for the TaskManager r=sfoster ======== https://hg.mozilla.org/integration/gaia-central/rev/082e9a35b762 Author: Etienne Segonzac <etienne@segonzac.info> Desc: Bug 1088166 - Adding sanity marionette JS tests for the TaskManager

#!/usr/bin/env python

# 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/.

run mozbase tests from a manifest,
by default https://github.com/mozilla/mozbase/blob/master/test-manifest.ini

import imp
import manifestparser
import mozinfo
import optparse
import os
import sys
import unittest

from mozlog import structured
from moztest.results import TestResultCollection
from moztest.adapters.unit import StructuredTestRunner

here = os.path.dirname(os.path.abspath(__file__))

def unittests(path):
    """return the unittests in a .py file"""

    path = os.path.abspath(path)
    unittests = []
    assert os.path.exists(path)
    directory = os.path.dirname(path)
    sys.path.insert(0, directory) # insert directory into path for top-level imports
    modname = os.path.splitext(os.path.basename(path))[0]
    module = imp.load_source(modname, path)
    sys.path.pop(0) # remove directory from global path
    loader = unittest.TestLoader()
    suite = loader.loadTestsFromModule(module)
    for test in suite:
    return unittests

def main(args=sys.argv[1:]):

    # parse command line options
    usage = '%prog [options] manifest.ini <manifest.ini> <...>'
    parser = optparse.OptionParser(usage=usage, description=__doc__)
    parser.add_option('-b', "--binary",
                  dest="binary", help="Binary path",
                  metavar=None, default=None)
    parser.add_option('--list', dest='list_tests',
                      action='store_true', default=False,
                      help="list paths of tests to be run")
    options, args = parser.parse_args(args)
    logger = structured.commandline.setup_logging("mozbase",
                                                      "tbpl": sys.stdout

    # read the manifest
    if args:
        manifests = args
        manifests = [os.path.join(here, 'test-manifest.ini')]
    missing = []
    for manifest in manifests:
        # ensure manifests exist
        if not os.path.exists(manifest):
    assert not missing, 'manifest(s) not found: %s' % ', '.join(missing)
    manifest = manifestparser.TestManifest(manifests=manifests)

    if options.binary:
        # A specified binary should override the environment variable
        os.environ['BROWSER_PATH'] = options.binary

    # gather the tests
    tests = manifest.active_tests(disabled=False, **mozinfo.info)
    tests = [test['path'] for test in tests]

    if options.list_tests:
        # print test paths
        print '\n'.join(tests)

    # create unittests
    unittestlist = []
    for test in tests:

    # run the tests
    suite = unittest.TestSuite(unittestlist)
    runner = StructuredTestRunner(logger=logger)
    unittest_results = runner.run(suite)
    results = TestResultCollection.from_unittest_results(None, unittest_results)

    # exit according to results
    sys.exit(1 if results.num_failures else 0)

if __name__ == '__main__':