зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1014760 - Move mozlog.structured to mozlog; Move mozlog to mozlog.unstructured, r=jgraham
Mozlog currently has two implementations. The top level package is based on the logging module and is deprecated. The newer structured logging implementation lives in mozlog.structured. This patch swaps the two, so the top level mozlog module contains the recommended implementation, while mozlog.unstructured contains the old one. --HG-- rename : testing/mozbase/docs/mozlog_structured.rst => testing/mozbase/docs/mozlog.rst rename : testing/mozbase/mozlog/mozlog/structured/commandline.py => testing/mozbase/mozlog/mozlog/commandline.py rename : testing/mozbase/mozlog/mozlog/structured/formatters/__init__.py => testing/mozbase/mozlog/mozlog/formatters/__init__.py rename : testing/mozbase/mozlog/mozlog/structured/formatters/base.py => testing/mozbase/mozlog/mozlog/formatters/base.py rename : testing/mozbase/mozlog/mozlog/structured/formatters/errorsummary.py => testing/mozbase/mozlog/mozlog/formatters/errorsummary.py rename : testing/mozbase/mozlog/mozlog/structured/formatters/html/__init__.py => testing/mozbase/mozlog/mozlog/formatters/html/__init__.py rename : testing/mozbase/mozlog/mozlog/structured/formatters/html/html.py => testing/mozbase/mozlog/mozlog/formatters/html/html.py rename : testing/mozbase/mozlog/mozlog/structured/formatters/html/main.js => testing/mozbase/mozlog/mozlog/formatters/html/main.js rename : testing/mozbase/mozlog/mozlog/structured/formatters/html/style.css => testing/mozbase/mozlog/mozlog/formatters/html/style.css rename : testing/mozbase/mozlog/mozlog/structured/formatters/html/xmlgen.py => testing/mozbase/mozlog/mozlog/formatters/html/xmlgen.py rename : testing/mozbase/mozlog/mozlog/structured/formatters/machformatter.py => testing/mozbase/mozlog/mozlog/formatters/machformatter.py rename : testing/mozbase/mozlog/mozlog/structured/formatters/tbplformatter.py => testing/mozbase/mozlog/mozlog/formatters/tbplformatter.py rename : testing/mozbase/mozlog/mozlog/structured/formatters/unittest.py => testing/mozbase/mozlog/mozlog/formatters/unittest.py rename : testing/mozbase/mozlog/mozlog/structured/formatters/xunit.py => testing/mozbase/mozlog/mozlog/formatters/xunit.py rename : testing/mozbase/mozlog/mozlog/structured/handlers/__init__.py => testing/mozbase/mozlog/mozlog/handlers/__init__.py rename : testing/mozbase/mozlog/mozlog/structured/handlers/base.py => testing/mozbase/mozlog/mozlog/handlers/base.py rename : testing/mozbase/mozlog/mozlog/structured/handlers/bufferhandler.py => testing/mozbase/mozlog/mozlog/handlers/bufferhandler.py rename : testing/mozbase/mozlog/mozlog/structured/handlers/statushandler.py => testing/mozbase/mozlog/mozlog/handlers/statushandler.py rename : testing/mozbase/mozlog/mozlog/structured/logtypes.py => testing/mozbase/mozlog/mozlog/logtypes.py rename : testing/mozbase/mozlog/mozlog/structured/reader.py => testing/mozbase/mozlog/mozlog/reader.py rename : testing/mozbase/mozlog/mozlog/structured/scripts/__init__.py => testing/mozbase/mozlog/mozlog/scripts/__init__.py rename : testing/mozbase/mozlog/mozlog/structured/scripts/format.py => testing/mozbase/mozlog/mozlog/scripts/format.py rename : testing/mozbase/mozlog/mozlog/structured/scripts/logmerge.py => testing/mozbase/mozlog/mozlog/scripts/logmerge.py rename : testing/mozbase/mozlog/mozlog/structured/scripts/unstable.py => testing/mozbase/mozlog/mozlog/scripts/unstable.py rename : testing/mozbase/mozlog/mozlog/structured/stdadapter.py => testing/mozbase/mozlog/mozlog/stdadapter.py rename : testing/mozbase/mozlog/mozlog/structured/structuredlog.py => testing/mozbase/mozlog/mozlog/structuredlog.py rename : testing/mozbase/mozlog/mozlog/logger.py => testing/mozbase/mozlog/mozlog/unstructured/logger.py rename : testing/mozbase/mozlog/mozlog/loggingmixin.py => testing/mozbase/mozlog/mozlog/unstructured/loggingmixin.py rename : testing/mozbase/mozlog/mozlog/loglistener.py => testing/mozbase/mozlog/mozlog/unstructured/loglistener.py extra : commitid : 3JWk75JY4N0 extra : rebase_source : 229bad7a7bf8ead013ce62d128c0896a75cad393
This commit is contained in:
Родитель
c8b6dbffb7
Коммит
2be5ff0c10
|
@ -17,7 +17,7 @@ import traceback
|
|||
import zipfile
|
||||
|
||||
from automation import Automation
|
||||
from mozlog.structured import get_default_logger
|
||||
from mozlog import get_default_logger
|
||||
from mozprocess import ProcessHandlerMixin
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import sys
|
|||
|
||||
from automation import Automation
|
||||
from devicemanager import DMError, DeviceManager
|
||||
from mozlog.structured import get_default_logger
|
||||
from mozlog import get_default_logger
|
||||
import mozcrash
|
||||
|
||||
# signatures for logcat messages that we don't care about much
|
||||
|
|
|
@ -21,7 +21,7 @@ from mozrunner import FirefoxRunner
|
|||
import mozinfo
|
||||
import mozlog
|
||||
|
||||
log = mozlog.getLogger('REFTEST')
|
||||
log = mozlog.unstructured.getLogger('REFTEST')
|
||||
|
||||
class B2GDesktopReftest(RefTest):
|
||||
build_type = "desktop"
|
||||
|
|
|
@ -15,7 +15,7 @@ import mozinfo
|
|||
import mozlog
|
||||
import mozprocess
|
||||
|
||||
log = mozlog.getLogger('gtest')
|
||||
log = mozlog.unstructured.getLogger('gtest')
|
||||
|
||||
class GTests(object):
|
||||
# Time (seconds) to wait for test process to complete
|
||||
|
|
|
@ -14,7 +14,7 @@ from luciddream import LucidDreamTestCase
|
|||
from marionette import Marionette
|
||||
from marionette.runner import BaseMarionetteTestRunner
|
||||
import marionette
|
||||
from mozlog import structured
|
||||
import mozlog
|
||||
|
||||
|
||||
class CommandLineError(Exception):
|
||||
|
@ -60,7 +60,7 @@ def parse_args(in_args):
|
|||
help='max time to wait for Marionette to be available after launching binary')
|
||||
parser.add_argument('manifest', metavar='MANIFEST', action='store',
|
||||
help='path to manifest of tests to run')
|
||||
structured.commandline.add_logging_group(parser)
|
||||
mozlog.commandline.add_logging_group(parser)
|
||||
|
||||
args = parser.parse_args(in_args)
|
||||
try:
|
||||
|
@ -117,7 +117,7 @@ def run(browser_path=None, b2g_desktop_path=None, emulator_path=None,
|
|||
|
||||
kwargs["browser"] = browser
|
||||
if not "logger" in kwargs:
|
||||
logger = structured.commandline.setup_logging(
|
||||
logger = mozlog.commandline.setup_logging(
|
||||
"luciddream", kwargs, {"tbpl": sys.stdout})
|
||||
kwargs["logger"] = logger
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
marionette-client>=0.8.5
|
||||
mozlog
|
||||
mozlog>=3.0
|
||||
|
|
|
@ -290,7 +290,7 @@ class MachCommands(MachCommandBase):
|
|||
|
||||
def run_cppunit_test(self, **params):
|
||||
import mozinfo
|
||||
from mozlog.structured import commandline
|
||||
from mozlog import commandline
|
||||
import runcppunittests as cppunittests
|
||||
|
||||
log = commandline.setup_logging("cppunittest",
|
||||
|
|
|
@ -24,9 +24,9 @@ from marionette_driver.errors import (
|
|||
MoveTargetOutOfBoundsException, FrameSendNotInitializedError, FrameSendFailureError
|
||||
)
|
||||
from marionette_driver.marionette import Marionette
|
||||
from mozlog.structured.structuredlog import get_default_logger
|
||||
from marionette_driver.wait import Wait
|
||||
from marionette_driver.expected import element_present, element_not_present
|
||||
from mozlog import get_default_logger
|
||||
|
||||
|
||||
class SkipTest(Exception):
|
||||
|
@ -376,7 +376,7 @@ class CommonTestCase(unittest.TestCase):
|
|||
def id(self):
|
||||
# TBPL starring requires that the "test name" field of a failure message
|
||||
# not differ over time. The test name to be used is passed to
|
||||
# mozlog.structured via the test id, so this is overriden to maintain
|
||||
# mozlog via the test id, so this is overriden to maintain
|
||||
# consistency.
|
||||
return self.test_name
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ from manifestparser import TestManifest
|
|||
from manifestparser.filters import tags
|
||||
from marionette_driver.marionette import Marionette
|
||||
from mixins.b2g import B2GTestResultMixin, get_b2g_pid, get_dm
|
||||
from mozlog.structured.structuredlog import get_default_logger
|
||||
from mozlog import get_default_logger
|
||||
from moztest.adapters.unit import StructuredTestRunner, StructuredTestResult
|
||||
from moztest.results import TestResultCollection, TestResult, relevant_line
|
||||
import mozversion
|
||||
|
|
|
@ -11,7 +11,7 @@ import pkg_resources
|
|||
import sys
|
||||
import time
|
||||
|
||||
from mozlog.structured.structuredlog import get_default_logger
|
||||
from mozlog import get_default_logger
|
||||
import mozversion
|
||||
from xmlgen import html
|
||||
from xmlgen import raw
|
||||
|
|
|
@ -6,12 +6,12 @@ import sys
|
|||
|
||||
from marionette import __version__
|
||||
from marionette.marionette_test import MarionetteTestCase, MarionetteJSTestCase
|
||||
from mozlog import structured
|
||||
from marionette.runner import (
|
||||
BaseMarionetteTestRunner,
|
||||
BaseMarionetteOptions,
|
||||
BrowserMobProxyOptionsMixin
|
||||
)
|
||||
)
|
||||
import mozlog
|
||||
|
||||
|
||||
class MarionetteTestRunner(BaseMarionetteTestRunner):
|
||||
|
@ -38,11 +38,11 @@ def startTestRunner(runner_class, options, tests):
|
|||
def cli(runner_class=MarionetteTestRunner, parser_class=MarionetteOptions):
|
||||
parser = parser_class(usage='%prog [options] test_file_or_dir <test_file_or_dir> ...',
|
||||
version='%prog ' + __version__)
|
||||
structured.commandline.add_logging_group(parser)
|
||||
mozlog.commandline.add_logging_group(parser)
|
||||
options, tests = parser.parse_args()
|
||||
parser.verify_usage(options, tests)
|
||||
|
||||
logger = structured.commandline.setup_logging(
|
||||
logger = mozlog.commandline.setup_logging(
|
||||
options.logger_name, options, {"tbpl": sys.stdout})
|
||||
|
||||
options.logger = logger
|
||||
|
|
|
@ -6,7 +6,7 @@ mozinfo >= 0.8
|
|||
mozprocess >= 0.9
|
||||
mozrunner >= 6.2
|
||||
mozdevice >= 0.44
|
||||
mozlog >= 2.7
|
||||
mozlog >= 3.0
|
||||
moznetwork >= 0.21
|
||||
mozcrash >= 0.5
|
||||
mozprofile >= 0.7
|
||||
|
|
|
@ -9,9 +9,9 @@ import os
|
|||
import tempfile
|
||||
|
||||
from droid import DroidADB, DroidSUT
|
||||
from mozlog import structured
|
||||
from mozprofile import DEFAULT_PORTS
|
||||
import mozinfo
|
||||
import mozlog
|
||||
import moznetwork
|
||||
|
||||
|
||||
|
@ -1188,7 +1188,7 @@ class MochitestArgumentParser(ArgumentParser):
|
|||
group.add_argument(*cli, **kwargs)
|
||||
|
||||
self.set_defaults(**defaults)
|
||||
structured.commandline.add_logging_group(self)
|
||||
mozlog.commandline.add_logging_group(self)
|
||||
|
||||
@property
|
||||
def containers(self):
|
||||
|
|
|
@ -55,8 +55,8 @@ from mochitest_options import MochitestArgumentParser, build_obj
|
|||
from mozprofile import Profile, Preferences
|
||||
from mozprofile.permissions import ServerLocations
|
||||
from urllib import quote_plus as encodeURIComponent
|
||||
from mozlog.structured.formatters import TbplFormatter
|
||||
from mozlog.structured import commandline
|
||||
from mozlog.formatters import TbplFormatter
|
||||
from mozlog import commandline
|
||||
from mozrunner.utils import test_environment
|
||||
import mozleak
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ from runtests import MochitestUtilsMixin
|
|||
from mochitest_options import MochitestArgumentParser
|
||||
from marionette import Marionette
|
||||
from mozprofile import Profile, Preferences
|
||||
from mozlog import structured
|
||||
import mozinfo
|
||||
import mozleak
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ this.EXPORTED_SYMBOLS = [
|
|||
|
||||
/**
|
||||
* TestLogger: Logger class generating messages compliant with the
|
||||
* structured logging protocol for tests exposed by the mozlog.structured
|
||||
* structured logging protocol for tests exposed by mozlog
|
||||
*
|
||||
* @param name
|
||||
* The name of the logger to instantiate.
|
||||
|
@ -30,8 +30,7 @@ this.StructuredLogger = function (name, dumpFun=dump, mutators=[]) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Log functions producing messages in the format specified by
|
||||
* mozlog.structured
|
||||
* Log functions producing messages in the format specified by mozlog
|
||||
*/
|
||||
StructuredLogger.prototype.testStart = function (test) {
|
||||
this._runningTests.add(test);
|
||||
|
|
|
@ -3,7 +3,7 @@ import sys
|
|||
import traceback
|
||||
import types
|
||||
|
||||
from mozlog.structured import commandline, get_default_logger
|
||||
from mozlog import commandline, get_default_logger
|
||||
|
||||
class TestAssertion(Exception):
|
||||
pass
|
||||
|
|
|
@ -8,4 +8,4 @@ less verbose. We created some libraries to make doing this easy.
|
|||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
mozlog_structured
|
||||
mozlog
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
:mod:`mozlog.structured` --- Structured logging for test output
|
||||
:mod:`mozlog` --- Structured logging for test output
|
||||
===============================================================
|
||||
|
||||
:py:mod:`mozlog.structured` is a library designed for logging the
|
||||
:py:mod:`mozlog` is a library designed for logging the
|
||||
execution and results of test harnesses. The internal data model is a
|
||||
stream of JSON-compatible objects, with one object per log entry. The
|
||||
default output format is line-based, with one JSON object serialized
|
||||
per line.
|
||||
|
||||
:py:mod:`mozlog.structured` is *not* based on the stdlib logging
|
||||
:py:mod:`mozlog` is *not* based on the stdlib logging
|
||||
module, although it shares several concepts with it.
|
||||
|
||||
One notable difference between this module and the standard logging
|
||||
|
@ -199,7 +199,7 @@ under test to crash).
|
|||
StructuredLogger Objects
|
||||
------------------------
|
||||
|
||||
.. automodule:: mozlog.structured.structuredlog
|
||||
.. automodule:: mozlog.structuredlog
|
||||
:members: set_default_logger, get_default_logger
|
||||
|
||||
.. autoclass:: StructuredLogger
|
||||
|
@ -219,7 +219,7 @@ message. The typical example of this is a ``StreamHandler`` which takes
|
|||
a log message, invokes a formatter which converts the log to a string,
|
||||
and writes it to a file.
|
||||
|
||||
.. automodule:: mozlog.structured.handlers
|
||||
.. automodule:: mozlog.handlers
|
||||
|
||||
.. autoclass:: BaseHandler
|
||||
:members:
|
||||
|
@ -248,32 +248,32 @@ Formatter modules are written so that they can take raw input on stdin
|
|||
and write formatted output on stdout. This allows the formatters to be
|
||||
invoked as part of a command line for post-processing raw log files.
|
||||
|
||||
.. automodule:: mozlog.structured.formatters.base
|
||||
.. automodule:: mozlog.formatters.base
|
||||
|
||||
.. autoclass:: BaseFormatter
|
||||
:members:
|
||||
|
||||
.. automodule:: mozlog.structured.formatters.unittest
|
||||
.. automodule:: mozlog.formatters.unittest
|
||||
|
||||
.. autoclass:: UnittestFormatter
|
||||
:members:
|
||||
|
||||
.. automodule:: mozlog.structured.formatters.xunit
|
||||
.. automodule:: mozlog.formatters.xunit
|
||||
|
||||
.. autoclass:: XUnitFormatter
|
||||
:members:
|
||||
|
||||
.. automodule:: mozlog.structured.formatters.html
|
||||
.. automodule:: mozlog.formatters.html
|
||||
|
||||
.. autoclass:: HTMLFormatter
|
||||
:members:
|
||||
|
||||
.. automodule:: mozlog.structured.formatters.machformatter
|
||||
.. automodule:: mozlog.formatters.machformatter
|
||||
|
||||
.. autoclass:: MachFormatter
|
||||
:members:
|
||||
|
||||
.. automodule:: mozlog.structured.formatters.tbplformatter
|
||||
.. automodule:: mozlog.formatters.tbplformatter
|
||||
|
||||
.. autoclass:: TbplFormatter
|
||||
:members:
|
||||
|
@ -281,22 +281,22 @@ invoked as part of a command line for post-processing raw log files.
|
|||
Processing Log Files
|
||||
--------------------
|
||||
|
||||
The ``mozlog.structured.reader`` module provides utilities for working
|
||||
The ``mozlog.reader`` module provides utilities for working
|
||||
with structured log files.
|
||||
|
||||
.. automodule:: mozlog.structured.reader
|
||||
.. automodule:: mozlog.reader
|
||||
:members:
|
||||
|
||||
Integration with argparse
|
||||
-------------------------
|
||||
|
||||
The `mozlog.structured.commandline` module provides integration with
|
||||
the `argparse` module to provide uniform logging-related command line
|
||||
arguments to programs using `mozlog.structured`. Each known formatter
|
||||
gets a command line argument of the form ``--log-{name}``, which takes
|
||||
the name of a file to log to with that format, or ``-`` to indicate stdout.
|
||||
The `mozlog.commandline` module provides integration with the `argparse`
|
||||
module to provide uniform logging-related command line arguments to programs
|
||||
using `mozlog`. Each known formatter gets a command line argument of the form
|
||||
``--log-{name}``, which takes the name of a file to log to with that format,
|
||||
or ``-`` to indicate stdout.
|
||||
|
||||
.. automodule:: mozlog.structured.commandline
|
||||
.. automodule:: mozlog.commandline
|
||||
:members:
|
||||
|
||||
Simple Examples
|
||||
|
@ -304,8 +304,8 @@ Simple Examples
|
|||
|
||||
Log to stdout::
|
||||
|
||||
from mozlog.structured import structuredlog
|
||||
from mozlog.structured import handlers, formatters
|
||||
from mozlog import structuredlog
|
||||
from mozlog import handlers, formatters
|
||||
logger = structuredlog.StructuredLogger("my-test-suite")
|
||||
logger.add_handler(handlers.StreamHandler(sys.stdout,
|
||||
formatters.JSONFormatter()))
|
||||
|
@ -322,7 +322,7 @@ create a logger based on the value of those options, defaulting to
|
|||
JSON output on stdout if nothing else is supplied::
|
||||
|
||||
import argparse
|
||||
from mozlog.structured import commandline
|
||||
from mozlog import commandline
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
# Here one would populate the parser with other options
|
||||
|
@ -333,7 +333,7 @@ JSON output on stdout if nothing else is supplied::
|
|||
|
||||
Count the number of tests that timed out in a testsuite::
|
||||
|
||||
from mozlog.structured import reader
|
||||
from mozlog import reader
|
||||
|
||||
count = 0
|
||||
|
||||
|
@ -373,7 +373,7 @@ set of structured logging arguments appropriate to all tools producing
|
|||
structured logging.
|
||||
|
||||
The values of these command line arguments are used to create a
|
||||
:py:class:`mozlog.structured.StructuredLogger` object populated with the
|
||||
:py:class:`mozlog.StructuredLogger` object populated with the
|
||||
specified handlers and formatters in
|
||||
:py:func:`commandline.setup_logging`. The third argument to this
|
||||
function is the default arguments to use. In this case the default
|
|
@ -23,7 +23,6 @@ from collections import namedtuple
|
|||
import mozfile
|
||||
import mozinfo
|
||||
import mozlog
|
||||
from mozlog.structured import structuredlog
|
||||
|
||||
|
||||
StackInfo = namedtuple("StackInfo",
|
||||
|
@ -37,9 +36,9 @@ StackInfo = namedtuple("StackInfo",
|
|||
|
||||
|
||||
def get_logger():
|
||||
structured_logger = structuredlog.get_default_logger("mozcrash")
|
||||
structured_logger = mozlog.get_default_logger("mozcrash")
|
||||
if structured_logger is None:
|
||||
return mozlog.getLogger('mozcrash')
|
||||
return mozlog.unstructured.getLogger('mozcrash')
|
||||
return structured_logger
|
||||
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ PACKAGE_VERSION = '0.14'
|
|||
|
||||
# dependencies
|
||||
deps = ['mozfile >= 1.0',
|
||||
'mozlog']
|
||||
'mozlog >= 3.0']
|
||||
|
||||
setup(name=PACKAGE_NAME,
|
||||
version=PACKAGE_VERSION,
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import os, unittest, subprocess, tempfile, shutil, urlparse, zipfile, StringIO
|
||||
import mozcrash, mozlog, mozhttpd
|
||||
import mozcrash
|
||||
import mozhttpd
|
||||
import mozlog.unstructured as mozlog
|
||||
|
||||
# Make logs go away
|
||||
log = mozlog.getLogger("mozcrash", handler=mozlog.FileHandler(os.devnull))
|
||||
|
|
|
@ -163,8 +163,8 @@ class ADBCommand(object):
|
|||
def _get_logger(self, logger_name):
|
||||
logger = None
|
||||
try:
|
||||
from mozlog import structured
|
||||
logger = structured.get_default_logger(logger_name)
|
||||
import mozlog
|
||||
logger = mozlog.get_default_logger(logger_name)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
import hashlib
|
||||
import mozlog
|
||||
import logging
|
||||
import os
|
||||
import posixpath
|
||||
import re
|
||||
|
@ -50,9 +51,9 @@ class DeviceManager(object):
|
|||
|
||||
def __init__(self, logLevel=None, deviceRoot=None):
|
||||
try:
|
||||
self._logger = mozlog.structured.structuredlog.get_default_logger(component="mozdevice")
|
||||
self._logger = mozlog.get_default_logger(component="mozdevice")
|
||||
if not self._logger: # no global structured logger, fall back to reg logging
|
||||
self._logger = mozlog.getLogger("mozdevice")
|
||||
self._logger = mozlog.unstructured.getLogger("mozdevice")
|
||||
if logLevel is not None:
|
||||
self._logger.setLevel(logLevel)
|
||||
except AttributeError:
|
||||
|
@ -88,16 +89,16 @@ class DeviceManager(object):
|
|||
@property
|
||||
def debug(self):
|
||||
self._logger.warning("dm.debug is deprecated. Use logLevel.")
|
||||
levels = {mozlog.DEBUG: 5, mozlog.INFO: 3, mozlog.WARNING: 2,
|
||||
mozlog.ERROR: 1, mozlog.CRITICAL: 0}
|
||||
levels = {logging.DEBUG: 5, logging.INFO: 3, logging.WARNING: 2,
|
||||
logging.ERROR: 1, logging.CRITICAL: 0}
|
||||
return levels[self.logLevel]
|
||||
|
||||
@debug.setter
|
||||
def debug_setter(self, newDebug):
|
||||
self._logger.warning("dm.debug is deprecated. Use logLevel.")
|
||||
newDebug = 5 if newDebug > 5 else newDebug # truncate >=5 to 5
|
||||
levels = {5: mozlog.DEBUG, 3: mozlog.INFO, 2: mozlog.WARNING,
|
||||
1: mozlog.ERROR, 0: mozlog.CRITICAL}
|
||||
levels = {5: logging.DEBUG, 3: logging.INFO, 2: logging.WARNING,
|
||||
1: logging.ERROR, 0: logging.CRITICAL}
|
||||
self.logLevel = levels[newDebug]
|
||||
|
||||
@abstractmethod
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
# 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/.
|
||||
|
||||
import logging
|
||||
import re
|
||||
import os
|
||||
import shutil
|
||||
|
@ -12,7 +13,6 @@ import traceback
|
|||
from devicemanager import DeviceManager, DMError
|
||||
from mozprocess import ProcessHandler
|
||||
import mozfile
|
||||
import mozlog
|
||||
|
||||
|
||||
class DeviceManagerADB(DeviceManager):
|
||||
|
@ -34,7 +34,7 @@ class DeviceManagerADB(DeviceManager):
|
|||
|
||||
def __init__(self, host=None, port=5555, retryLimit=5, packageName='fennec',
|
||||
adbPath='adb', deviceSerial=None, deviceRoot=None,
|
||||
logLevel=mozlog.ERROR, autoconnect=True, runAdbAsRoot=False,
|
||||
logLevel=logging.ERROR, autoconnect=True, runAdbAsRoot=False,
|
||||
serverHost=None, serverPort=None, **kwargs):
|
||||
DeviceManager.__init__(self, logLevel=logLevel,
|
||||
deviceRoot=deviceRoot)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import datetime
|
||||
import mozlog
|
||||
import logging
|
||||
import moznetwork
|
||||
import select
|
||||
import socket
|
||||
|
@ -34,10 +34,10 @@ class DeviceManagerSUT(DeviceManager):
|
|||
reboot_timeout = 600
|
||||
reboot_settling_time = 60
|
||||
|
||||
def __init__(self, host, port = 20701, retryLimit = 5,
|
||||
deviceRoot = None, logLevel = mozlog.ERROR, **kwargs):
|
||||
DeviceManager.__init__(self, logLevel = logLevel,
|
||||
deviceRoot = deviceRoot)
|
||||
def __init__(self, host, port=20701, retryLimit=5, deviceRoot=None,
|
||||
logLevel=logging.ERROR, **kwargs):
|
||||
DeviceManager.__init__(self, logLevel=logLevel,
|
||||
deviceRoot=deviceRoot)
|
||||
self.host = host
|
||||
self.port = port
|
||||
self.retryLimit = retryLimit
|
||||
|
|
|
@ -7,6 +7,7 @@ Command-line client to control a device
|
|||
"""
|
||||
|
||||
import errno
|
||||
import logging
|
||||
import os
|
||||
import posixpath
|
||||
import StringIO
|
||||
|
@ -134,12 +135,12 @@ class DMCli(object):
|
|||
self.parser = argparse.ArgumentParser()
|
||||
self.add_options(self.parser)
|
||||
self.add_commands(self.parser)
|
||||
mozlog.structured.commandline.add_logging_group(self.parser)
|
||||
mozlog.commandline.add_logging_group(self.parser)
|
||||
|
||||
def run(self, args=sys.argv[1:]):
|
||||
args = self.parser.parse_args()
|
||||
|
||||
mozlog.structured.commandline.setup_logging(
|
||||
mozlog.commandline.setup_logging(
|
||||
'mozdevice', args, {'mach': sys.stdout})
|
||||
|
||||
if args.dmtype == "sut" and not args.host and not args.hwid:
|
||||
|
@ -202,9 +203,9 @@ class DMCli(object):
|
|||
'''
|
||||
Returns a device with the specified parameters
|
||||
'''
|
||||
logLevel = mozlog.ERROR
|
||||
logLevel = logging.ERROR
|
||||
if verbose:
|
||||
logLevel = mozlog.DEBUG
|
||||
logLevel = logging.DEBUG
|
||||
|
||||
if hwid:
|
||||
return mozdevice.DroidConnectByHWID(hwid, logLevel=logLevel)
|
||||
|
|
|
@ -8,7 +8,7 @@ PACKAGE_NAME = 'mozdevice'
|
|||
PACKAGE_VERSION = '0.45'
|
||||
|
||||
deps = ['mozfile >= 1.0',
|
||||
'mozlog >= 2.1',
|
||||
'mozlog >= 3.0',
|
||||
'moznetwork >= 0.24',
|
||||
'mozprocess >= 0.19',
|
||||
]
|
||||
|
|
|
@ -2,18 +2,17 @@
|
|||
# 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/.
|
||||
|
||||
import logging
|
||||
import types
|
||||
import unittest
|
||||
|
||||
import mozlog
|
||||
|
||||
from mozdevice import devicemanager
|
||||
from mozdevice import devicemanagerSUT
|
||||
|
||||
ip = ''
|
||||
port = 0
|
||||
heartbeat_port = 0
|
||||
log_level = mozlog.ERROR
|
||||
log_level = logging.ERROR
|
||||
|
||||
class DeviceManagerTestCase(unittest.TestCase):
|
||||
"""DeviceManager tests should subclass this.
|
||||
|
|
|
@ -3,13 +3,12 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from optparse import OptionParser
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
import mozlog
|
||||
|
||||
import dmunit
|
||||
import genfiles
|
||||
|
||||
|
@ -19,7 +18,7 @@ def main(ip, port, heartbeat_port, scripts, directory, isTestDevice, verbose):
|
|||
dmunit.port = port
|
||||
dmunit.heartbeat_port = heartbeat_port
|
||||
if verbose:
|
||||
dmunit.log_level = mozlog.DEBUG
|
||||
dmunit.log_level = logging.DEBUG
|
||||
|
||||
suite = unittest.TestSuite()
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from sut import MockAgent
|
||||
import mozdevice
|
||||
import mozlog
|
||||
import logging
|
||||
import unittest
|
||||
|
||||
class LaunchTest(unittest.TestCase):
|
||||
|
@ -14,7 +14,7 @@ class LaunchTest(unittest.TestCase):
|
|||
"org.mozilla.fennec/.App -a "
|
||||
"android.intent.action.VIEW",
|
||||
"OK\nreturn code [0]")])
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=a.port, logLevel=mozlog.DEBUG)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=a.port, logLevel=logging.DEBUG)
|
||||
d.launchFennec("org.mozilla.fennec")
|
||||
a.wait()
|
||||
|
||||
|
@ -27,7 +27,7 @@ class LaunchTest(unittest.TestCase):
|
|||
"org.mozilla.fennec/.App -a "
|
||||
"android.intent.action.VIEW",
|
||||
"OK\nreturn code [0]")])
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=a.port, logLevel=mozlog.DEBUG)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=a.port, logLevel=logging.DEBUG)
|
||||
d.launchFennec("org.mozilla.fennec")
|
||||
a.wait()
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#/usr/bin/env python
|
||||
import mozdevice
|
||||
import mozlog
|
||||
import logging
|
||||
import unittest
|
||||
from sut import MockAgent
|
||||
|
||||
|
@ -12,7 +12,7 @@ class TestApp(unittest.TestCase):
|
|||
"/data/data/org.mozilla.firefox")]
|
||||
|
||||
m = MockAgent(self, commands=command)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=mozlog.DEBUG)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=logging.DEBUG)
|
||||
|
||||
self.assertEqual(command[0][1], d.getAppRoot('org.mozilla.firefox'))
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from sut import MockAgent
|
||||
import mozdevice
|
||||
import mozlog
|
||||
import logging
|
||||
import unittest
|
||||
|
||||
class BasicTest(unittest.TestCase):
|
||||
|
@ -9,7 +9,7 @@ class BasicTest(unittest.TestCase):
|
|||
"""Tests DeviceManager initialization."""
|
||||
a = MockAgent(self)
|
||||
|
||||
mozdevice.DroidSUT("127.0.0.1", port=a.port, logLevel=mozlog.DEBUG)
|
||||
mozdevice.DroidSUT("127.0.0.1", port=a.port, logLevel=logging.DEBUG)
|
||||
# all testing done in device's constructor
|
||||
a.wait()
|
||||
|
||||
|
@ -19,7 +19,7 @@ class BasicTest(unittest.TestCase):
|
|||
self.assertRaises(mozdevice.DMError,
|
||||
lambda: mozdevice.DroidSUT("127.0.0.1",
|
||||
port=a.port,
|
||||
logLevel=mozlog.DEBUG))
|
||||
logLevel=logging.DEBUG))
|
||||
a.wait()
|
||||
|
||||
def test_timeout_normal(self):
|
||||
|
@ -29,7 +29,7 @@ class BasicTest(unittest.TestCase):
|
|||
("ls", "test.txt"),
|
||||
("rm /mnt/sdcard/tests/test.txt",
|
||||
"Removed the file")])
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=a.port, logLevel=mozlog.DEBUG)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=a.port, logLevel=logging.DEBUG)
|
||||
ret = d.removeFile('/mnt/sdcard/tests/test.txt')
|
||||
self.assertEqual(ret, None) # if we didn't throw an exception, we're ok
|
||||
a.wait()
|
||||
|
@ -40,7 +40,7 @@ class BasicTest(unittest.TestCase):
|
|||
("cd /mnt/sdcard/tests", ""),
|
||||
("ls", "test.txt"),
|
||||
("rm /mnt/sdcard/tests/test.txt", 0)])
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=a.port, logLevel=mozlog.DEBUG)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=a.port, logLevel=logging.DEBUG)
|
||||
d.default_timeout = 1
|
||||
exceptionThrown = False
|
||||
try:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#/usr/bin/env python
|
||||
import mozdevice
|
||||
import mozlog
|
||||
import logging
|
||||
import unittest
|
||||
from sut import MockAgent
|
||||
|
||||
|
@ -13,7 +13,7 @@ class TestChmod(unittest.TestCase):
|
|||
' <empty>\n'
|
||||
'chmod /storage/emulated/legacy/Test ok\n')]
|
||||
m = MockAgent(self, commands=command)
|
||||
d = mozdevice.DroidSUT('127.0.0.1', port=m.port, logLevel=mozlog.DEBUG)
|
||||
d = mozdevice.DroidSUT('127.0.0.1', port=m.port, logLevel=logging.DEBUG)
|
||||
|
||||
self.assertEqual(None, d.chmodDir('/mnt/sdcard/test'))
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import mozdevice
|
||||
import mozlog
|
||||
import logging
|
||||
import unittest
|
||||
from sut import MockAgent
|
||||
|
||||
|
@ -18,7 +18,7 @@ class CopyTreeTest(unittest.TestCase):
|
|||
('ls', 'test.txt\ntest2.txt')]
|
||||
|
||||
m = MockAgent(self, commands=commands)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=mozlog.DEBUG)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=logging.DEBUG)
|
||||
|
||||
self.assertEqual(None, d.copyTree('/mnt/sdcard/tests/test.txt',
|
||||
'/mnt/sdcard/tests/test2.txt'))
|
||||
|
@ -33,7 +33,7 @@ class CopyTreeTest(unittest.TestCase):
|
|||
|
||||
m = MockAgent(self, commands=commands)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port,
|
||||
logLevel=mozlog.DEBUG)
|
||||
logLevel=logging.DEBUG)
|
||||
|
||||
self.assertEqual(None, d.copyTree('/mnt/sdcard/tests/foo',
|
||||
'/mnt/sdcard/tests/bar'))
|
||||
|
@ -52,7 +52,7 @@ class CopyTreeTest(unittest.TestCase):
|
|||
|
||||
m = MockAgent(self, commands=commands)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port,
|
||||
logLevel=mozlog.DEBUG)
|
||||
logLevel=logging.DEBUG)
|
||||
|
||||
self.assertTrue(d.dirExists('/mnt/sdcard/tests/foo/bar'))
|
||||
self.assertEqual(None, d.copyTree('/mnt/sdcard/tests/foo',
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import hashlib
|
||||
import mozdevice
|
||||
import mozlog
|
||||
import logging
|
||||
import shutil
|
||||
import tempfile
|
||||
import unittest
|
||||
|
@ -27,14 +27,14 @@ class TestFileMethods(unittest.TestCase):
|
|||
commands_valid = [("hash /sdcard/test/file", self.temp_hash)]
|
||||
|
||||
m = MockAgent(self, commands=commands_valid)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=mozlog.DEBUG)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=logging.DEBUG)
|
||||
self.assertTrue(d.validateFile('/sdcard/test/file', f.name))
|
||||
|
||||
# Test invalid hashes
|
||||
commands_invalid = [("hash /sdcard/test/file", "0this0hash0is0completely0invalid")]
|
||||
|
||||
m = MockAgent(self, commands=commands_invalid)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=mozlog.DEBUG)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=logging.DEBUG)
|
||||
self.assertFalse(d.validateFile('/sdcard/test/file', f.name))
|
||||
|
||||
def test_getFile(self):
|
||||
|
@ -45,7 +45,7 @@ class TestFileMethods(unittest.TestCase):
|
|||
|
||||
with tempfile.NamedTemporaryFile() as f:
|
||||
m = MockAgent(self, commands=commands)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=mozlog.DEBUG)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=logging.DEBUG)
|
||||
# No error means success
|
||||
self.assertEqual(None, d.getFile(fname, f.name))
|
||||
|
||||
|
@ -62,7 +62,7 @@ class TestFileMethods(unittest.TestCase):
|
|||
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
m = MockAgent(self, commands=commands)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=mozlog.DEBUG)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=logging.DEBUG)
|
||||
self.assertEqual(None, d.getDirectory("/mnt/sdcard", tmpdir))
|
||||
|
||||
# Cleanup
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#/usr/bin/env python
|
||||
import mozdevice
|
||||
import mozlog
|
||||
import logging
|
||||
import re
|
||||
import unittest
|
||||
from sut import MockAgent
|
||||
|
@ -36,7 +36,7 @@ class TestGetInfo(unittest.TestCase):
|
|||
|
||||
for directive in self.commands.keys():
|
||||
m = MockAgent(self, commands=[self.commands[directive]])
|
||||
d = mozdevice.DroidSUT('127.0.0.1', port=m.port, logLevel=mozlog.DEBUG)
|
||||
d = mozdevice.DroidSUT('127.0.0.1', port=m.port, logLevel=logging.DEBUG)
|
||||
|
||||
expected = re.sub(r'\ +', ' ', self.commands[directive][1]).split('\n')
|
||||
# Account for slightly different return format for 'process'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#/usr/bin/env python
|
||||
import mozdevice
|
||||
import mozlog
|
||||
import logging
|
||||
import unittest
|
||||
from sut import MockAgent
|
||||
|
||||
|
@ -20,17 +20,17 @@ class TestGetIP(unittest.TestCase):
|
|||
|
||||
def test_getIP_eth0(self):
|
||||
m = MockAgent(self, commands=[self.commands[0]])
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=mozlog.DEBUG)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=logging.DEBUG)
|
||||
self.assertEqual('192.168.0.1', d.getIP(interfaces=['eth0']))
|
||||
|
||||
def test_getIP_wlan0(self):
|
||||
m = MockAgent(self, commands=[self.commands[1]])
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=mozlog.DEBUG)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=logging.DEBUG)
|
||||
self.assertEqual('10.1.39.126', d.getIP(interfaces=['wlan0']))
|
||||
|
||||
def test_getIP_error(self):
|
||||
m = MockAgent(self, commands=[self.commands[2]])
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=mozlog.DEBUG)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=logging.DEBUG)
|
||||
self.assertRaises(mozdevice.DMError, d.getIP, interfaces=['fake0'])
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import mozdevice
|
||||
import mozlog
|
||||
import logging
|
||||
import unittest
|
||||
from sut import MockAgent
|
||||
|
||||
|
@ -15,7 +15,7 @@ class TestKill(unittest.TestCase):
|
|||
("kill com.android.settings",
|
||||
"Successfully killed com.android.settings\n")]
|
||||
m = MockAgent(self, commands=commands)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=mozlog.DEBUG)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=logging.DEBUG)
|
||||
# No error raised means success
|
||||
self.assertEqual(None, d.killProcess("com.android.settings"))
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#/usr/bin/env python
|
||||
import mozdevice
|
||||
import mozlog
|
||||
import logging
|
||||
import unittest
|
||||
from sut import MockAgent
|
||||
|
||||
|
@ -13,7 +13,7 @@ class TestListFiles(unittest.TestCase):
|
|||
|
||||
def test_listFiles(self):
|
||||
m = MockAgent(self, commands=self.commands)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=mozlog.DEBUG)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=logging.DEBUG)
|
||||
|
||||
expected = (self.commands[2][1].strip()).split("\n")
|
||||
self.assertEqual(expected, d.listFiles("/mnt/sdcard"))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import mozdevice
|
||||
import mozlog
|
||||
import logging
|
||||
import unittest
|
||||
from sut import MockAgent
|
||||
|
||||
|
@ -35,7 +35,7 @@ class TestLogCat(unittest.TestCase):
|
|||
|
||||
commands = [(inp, logcat_output)]
|
||||
m = MockAgent(self, commands=commands)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=mozlog.DEBUG)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=logging.DEBUG)
|
||||
self.assertEqual(logcat_output[:-17].replace('\r\n', '\n').splitlines(True), d.getLogcat())
|
||||
|
||||
def test_recordLogcat(self):
|
||||
|
@ -43,7 +43,7 @@ class TestLogCat(unittest.TestCase):
|
|||
commands = [("execsu /system/bin/logcat -c", "return code [0]")]
|
||||
|
||||
m = MockAgent(self, commands=commands)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=mozlog.DEBUG)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=logging.DEBUG)
|
||||
# No error raised means success
|
||||
self.assertEqual(None, d.recordLogcat())
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
import mozdevice
|
||||
import mozlog
|
||||
import logging
|
||||
import unittest
|
||||
from sut import MockAgent
|
||||
|
||||
|
@ -35,7 +35,7 @@ class MkDirsTest(unittest.TestCase):
|
|||
exceptionThrown = False
|
||||
try:
|
||||
d = mozdevice.DroidSUT('127.0.0.1', port=a.port,
|
||||
logLevel=mozlog.DEBUG)
|
||||
logLevel=logging.DEBUG)
|
||||
d.mkDirs('/mnt/sdcard/baz/boop/bip')
|
||||
except mozdevice.DMError:
|
||||
exceptionThrown = True
|
||||
|
@ -58,7 +58,7 @@ class MkDirsTest(unittest.TestCase):
|
|||
'/mnt/sdcard/foo successfully created')]
|
||||
a = MockAgent(self, commands=cmds)
|
||||
d = mozdevice.DroidSUT('127.0.0.1', port=a.port,
|
||||
logLevel=mozlog.DEBUG)
|
||||
logLevel=logging.DEBUG)
|
||||
d.mkDirs('/mnt/sdcard/foo/foo')
|
||||
a.wait()
|
||||
|
||||
|
@ -66,7 +66,7 @@ class MkDirsTest(unittest.TestCase):
|
|||
cmds = [('isdir /', 'TRUE')]
|
||||
a = MockAgent(self, commands=cmds)
|
||||
d = mozdevice.DroidSUT('127.0.0.1', port=a.port,
|
||||
logLevel=mozlog.DEBUG)
|
||||
logLevel=logging.DEBUG)
|
||||
d.mkDirs('/foo')
|
||||
|
||||
a.wait()
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import mozdevice
|
||||
import mozlog
|
||||
import logging
|
||||
import unittest
|
||||
from sut import MockAgent
|
||||
|
||||
|
@ -21,7 +21,7 @@ class MoveTreeTest(unittest.TestCase):
|
|||
('ls', 'test1.txt')]
|
||||
|
||||
m = MockAgent(self, commands=commands)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=mozlog.DEBUG)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=logging.DEBUG)
|
||||
self.assertEqual(None, d.moveTree('/mnt/sdcard/tests/test.txt',
|
||||
'/mnt/sdcard/tests/test1.txt'))
|
||||
self.assertFalse(d.fileExists('/mnt/sdcard/tests/test.txt'))
|
||||
|
@ -34,7 +34,7 @@ class MoveTreeTest(unittest.TestCase):
|
|||
('ls', 'bar')]
|
||||
|
||||
m = MockAgent(self, commands=commands)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=mozlog.DEBUG)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=logging.DEBUG)
|
||||
self.assertEqual(None, d.moveTree('/mnt/sdcard/tests/foo',
|
||||
'/mnt/sdcard/tests/bar'))
|
||||
self.assertTrue(d.fileExists('/mnt/sdcard/tests/bar'))
|
||||
|
@ -51,7 +51,7 @@ class MoveTreeTest(unittest.TestCase):
|
|||
|
||||
m = MockAgent(self, commands=commands)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port,
|
||||
logLevel=mozlog.DEBUG)
|
||||
logLevel=logging.DEBUG)
|
||||
|
||||
self.assertTrue(d.dirExists('/mnt/sdcard/tests/foo/bar'))
|
||||
self.assertEqual(None, d.moveTree('/mnt/sdcard/tests/foo',
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from sut import MockAgent
|
||||
import mozdevice
|
||||
import mozlog
|
||||
import logging
|
||||
import unittest
|
||||
|
||||
class PullTest(unittest.TestCase):
|
||||
|
@ -20,7 +20,7 @@ class PullTest(unittest.TestCase):
|
|||
("isdir /mnt/sdcard", "TRUE")])
|
||||
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=a.port,
|
||||
logLevel=mozlog.DEBUG)
|
||||
logLevel=logging.DEBUG)
|
||||
pulledData = d.pullFile("/mnt/sdcard/cheeseburgers")
|
||||
self.assertEqual(pulledData, cheeseburgers)
|
||||
d.dirExists('/mnt/sdcard')
|
||||
|
@ -34,7 +34,7 @@ class PullTest(unittest.TestCase):
|
|||
"%s,15\n%s" % (remoteName,
|
||||
"cheeseburgh"))])
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=a.port,
|
||||
logLevel=mozlog.DEBUG)
|
||||
logLevel=logging.DEBUG)
|
||||
exceptionThrown = False
|
||||
try:
|
||||
d.pullFile("/mnt/sdcard/cheeseburgers")
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from sut import MockAgent
|
||||
import mozfile
|
||||
import mozdevice
|
||||
import mozlog
|
||||
import logging
|
||||
import unittest
|
||||
import hashlib
|
||||
import tempfile
|
||||
|
@ -73,7 +73,7 @@ class PushTest(unittest.TestCase):
|
|||
exceptionThrown = False
|
||||
try:
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=a.port,
|
||||
logLevel=mozlog.DEBUG)
|
||||
logLevel=logging.DEBUG)
|
||||
d.pushDir(tempdir, "/mnt/sdcard")
|
||||
except mozdevice.DMError:
|
||||
exceptionThrown = True
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#/usr/bin/env python
|
||||
import mozdevice
|
||||
import mozlog
|
||||
import logging
|
||||
import unittest
|
||||
from sut import MockAgent
|
||||
|
||||
|
@ -16,7 +16,7 @@ class TestRemove(unittest.TestCase):
|
|||
"/storage/emulated/legacy/Moztest\n")]
|
||||
|
||||
m = MockAgent(self, commands=commands)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=mozlog.DEBUG)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=logging.DEBUG)
|
||||
# No error implies we're all good
|
||||
self.assertEqual(None, d.removeDir("/mnt/sdcard/test"))
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#/usr/bin/env python
|
||||
import mozdevice
|
||||
import mozlog
|
||||
import logging
|
||||
import unittest
|
||||
from sut import MockAgent
|
||||
|
||||
|
@ -11,7 +11,7 @@ class TestGetCurrentTime(unittest.TestCase):
|
|||
command = [('clok', '1349980200')]
|
||||
|
||||
m = MockAgent(self, commands=command)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=mozlog.DEBUG)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=logging.DEBUG)
|
||||
self.assertEqual(d.getCurrentTime(), int(command[0][1]))
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import mozdevice
|
||||
import mozlog
|
||||
import logging
|
||||
import unittest
|
||||
from sut import MockAgent
|
||||
|
||||
|
@ -14,7 +14,7 @@ class TestUnpack(unittest.TestCase):
|
|||
"Checksum: 653400271\n"
|
||||
"1 of 1 successfully extracted\n")]
|
||||
m = MockAgent(self, commands=commands)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=mozlog.DEBUG)
|
||||
d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=logging.DEBUG)
|
||||
# No error being thrown imples all is well
|
||||
self.assertEqual(None, d.unpackFile("/data/test/sample.zip",
|
||||
"/data/test/"))
|
||||
|
|
|
@ -1,26 +1,25 @@
|
|||
# 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/.
|
||||
# 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/.
|
||||
|
||||
"""
|
||||
Mozlog aims to standardize log formatting within Mozilla.
|
||||
Mozlog aims to standardize log handling and formatting within Mozilla.
|
||||
|
||||
It simply wraps Python's logging_ module and adds a few convenience methods
|
||||
for logging test results and events.
|
||||
It implements a JSON-based structured logging protocol with convenience
|
||||
facilities for recording test results.
|
||||
|
||||
The structured submodule takes a different approach and implements a
|
||||
JSON-based logging protocol designed for recording test results."""
|
||||
The old unstructured module is deprecated. It simply wraps Python's
|
||||
logging_ module and adds a few convenience methods for logging test
|
||||
results and events.
|
||||
"""
|
||||
|
||||
from logger import *
|
||||
from loglistener import LogMessageServer
|
||||
from loggingmixin import LoggingMixin
|
||||
import sys
|
||||
|
||||
try:
|
||||
import structured
|
||||
except ImportError:
|
||||
# Structured logging doesn't work on python 2.6 which is still used on some
|
||||
# legacy test machines; https://bugzilla.mozilla.org/show_bug.cgi?id=864866
|
||||
# Once we move away from Python 2.6, please cleanup devicemanager.py's
|
||||
# exception block
|
||||
pass
|
||||
from . import commandline
|
||||
from . import structuredlog
|
||||
from . import unstructured
|
||||
from .structuredlog import get_default_logger, set_default_logger
|
||||
|
||||
# Backwards compatibility shim for consumers that use mozlog.structured
|
||||
structured = sys.modules[__name__]
|
||||
sys.modules['{}.structured'.format(__name__)] = structured
|
||||
|
|
|
@ -6,11 +6,11 @@ import argparse
|
|||
import optparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
from collections import defaultdict
|
||||
from structuredlog import StructuredLogger, set_default_logger
|
||||
import handlers
|
||||
import formatters
|
||||
|
||||
from . import handlers
|
||||
from . import formatters
|
||||
from .structuredlog import StructuredLogger, set_default_logger
|
||||
|
||||
log_formatters = {
|
||||
'raw': (formatters.JSONFormatter, "Raw structured log messages"),
|
||||
|
@ -170,7 +170,7 @@ def setup_logging(suite, args, defaults=None, formatter_defaults=None):
|
|||
Configure a structuredlogger based on command line arguments.
|
||||
|
||||
The created structuredlogger will also be set as the default logger, and
|
||||
can be retrieved with :py:func:`~mozlog.structured.structuredlog.get_default_logger`.
|
||||
can be retrieved with :py:func:`~mozlog.get_default_logger`.
|
||||
|
||||
:param suite: The name of the testsuite being run
|
||||
:param args: A dictionary of {argument_name:value} produced from
|
|
@ -7,7 +7,7 @@ from collections import (
|
|||
namedtuple,
|
||||
)
|
||||
|
||||
from mozlog.structured.structuredlog import log_levels
|
||||
from mozlog.structuredlog import log_levels
|
||||
|
||||
RunSummary = namedtuple("RunSummary",
|
||||
("unexpected_statuses",
|
|
@ -5,7 +5,7 @@ import os
|
|||
import sys
|
||||
from threading import current_thread
|
||||
import time
|
||||
from mozlog.structured.reader import read
|
||||
from mozlog.reader import read
|
||||
|
||||
|
||||
def dump_entry(entry, output):
|
||||
|
@ -79,4 +79,4 @@ if __name__ == "__main__":
|
|||
parser = get_parser()
|
||||
args = parser.parse_args()
|
||||
kwargs = vars(args)
|
||||
main(**kwargs)
|
||||
main(**kwargs)
|
|
@ -2,7 +2,7 @@ import argparse
|
|||
from collections import defaultdict
|
||||
import json
|
||||
|
||||
from mozlog.structured import reader
|
||||
from mozlog import reader
|
||||
|
||||
class StatusHandler(reader.LogHandler):
|
||||
def __init__(self):
|
|
@ -80,7 +80,7 @@ def set_default_logger(default_logger):
|
|||
|
||||
It can then be retrieved with :py:func:`get_default_logger`
|
||||
|
||||
Note that :py:func:`~mozlog.structured.commandline.setup_logging` will
|
||||
Note that :py:func:`~mozlog.commandline.setup_logging` will
|
||||
set a default logger for you, so there should be no need to call this
|
||||
function if you're using setting up logging that way (recommended).
|
||||
|
|
@ -2,6 +2,6 @@
|
|||
# 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/.
|
||||
|
||||
import commandline
|
||||
import structuredlog
|
||||
from structuredlog import get_default_logger, set_default_logger
|
||||
from .logger import *
|
||||
from .loglistener import LogMessageServer
|
||||
from .loggingmixin import LoggingMixin
|
|
@ -2,7 +2,11 @@
|
|||
# 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/.
|
||||
|
||||
import mozlog
|
||||
from .logger import (
|
||||
Logger,
|
||||
getLogger,
|
||||
)
|
||||
|
||||
|
||||
class LoggingMixin(object):
|
||||
"""Expose a subset of logging functions to an inheriting class."""
|
||||
|
@ -10,19 +14,18 @@ class LoggingMixin(object):
|
|||
def set_logger(self, logger_instance=None, name=None):
|
||||
"""Method for setting the underlying logger instance to be used."""
|
||||
|
||||
if logger_instance and not isinstance(logger_instance, mozlog.Logger):
|
||||
raise ValueError("logger_instance must be an instance of" +
|
||||
"mozlog.Logger")
|
||||
if logger_instance and not isinstance(logger_instance, Logger):
|
||||
raise ValueError("logger_instance must be an instance of Logger")
|
||||
|
||||
if name is None:
|
||||
name = ".".join([self.__module__, self.__class__.__name__])
|
||||
|
||||
self._logger = logger_instance or mozlog.getLogger(name)
|
||||
self._logger = logger_instance or getLogger(name)
|
||||
|
||||
def _log_msg(self, cmd, *args, **kwargs):
|
||||
if not hasattr(self, "_logger"):
|
||||
self._logger = mozlog.getLogger(".".join([self.__module__,
|
||||
self.__class__.__name__]))
|
||||
self._logger = getLogger(".".join([self.__module__,
|
||||
self.__class__.__name__]))
|
||||
getattr(self._logger, cmd)(*args, **kwargs)
|
||||
|
||||
def log(self, *args, **kwargs):
|
|
@ -5,7 +5,7 @@
|
|||
from setuptools import setup, find_packages
|
||||
|
||||
PACKAGE_NAME = 'mozlog'
|
||||
PACKAGE_VERSION = '2.11'
|
||||
PACKAGE_VERSION = '3.0'
|
||||
|
||||
setup(name=PACKAGE_NAME,
|
||||
version=PACKAGE_VERSION,
|
||||
|
@ -27,10 +27,10 @@ setup(name=PACKAGE_NAME,
|
|||
'Operating System :: OS Independent',
|
||||
'Topic :: Software Development :: Libraries :: Python Modules',
|
||||
],
|
||||
package_data={"mozlog.structured": ["formatters/html/main.js",
|
||||
"formatters/html/style.css"]},
|
||||
package_data={"mozlog": ["formatters/html/main.js",
|
||||
"formatters/html/style.css"]},
|
||||
entry_points={
|
||||
"console_scripts": [
|
||||
"structlog = mozlog.structured.scripts:main"
|
||||
"structlog = mozlog.scripts:main"
|
||||
]}
|
||||
)
|
||||
|
|
|
@ -11,7 +11,7 @@ import unittest
|
|||
|
||||
import mozfile
|
||||
|
||||
import mozlog
|
||||
import mozlog.unstructured as mozlog
|
||||
|
||||
class ListHandler(mozlog.Handler):
|
||||
"""Mock handler appends messages to a list for later inspection."""
|
||||
|
|
|
@ -10,7 +10,7 @@ import xml.etree.ElementTree as ET
|
|||
|
||||
import mozfile
|
||||
|
||||
from mozlog.structured import (
|
||||
from mozlog import (
|
||||
commandline,
|
||||
reader,
|
||||
structuredlog,
|
||||
|
|
|
@ -12,7 +12,6 @@ import sys
|
|||
|
||||
import mozinfo
|
||||
import mozlog
|
||||
from mozlog import structured
|
||||
|
||||
if mozinfo.isLinux:
|
||||
import fcntl
|
||||
|
@ -23,9 +22,9 @@ class NetworkError(Exception):
|
|||
|
||||
|
||||
def _get_logger():
|
||||
logger = structured.get_default_logger(component='moznetwork')
|
||||
logger = mozlog.get_default_logger(component='moznetwork')
|
||||
if not logger:
|
||||
logger = mozlog.getLogger('moznetwork')
|
||||
logger = mozlog.unstructured.getLogger('moznetwork')
|
||||
return logger
|
||||
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ from setuptools import setup
|
|||
PACKAGE_VERSION = '0.26'
|
||||
|
||||
deps = ['mozinfo',
|
||||
'mozlog >= 2.11',
|
||||
'mozlog >= 3.0',
|
||||
]
|
||||
|
||||
setup(name='moznetwork',
|
||||
|
|
|
@ -10,15 +10,15 @@ import urllib2
|
|||
import zipfile
|
||||
from xml.dom import minidom
|
||||
|
||||
from manifestparser import ManifestParser
|
||||
import mozfile
|
||||
import mozlog
|
||||
from manifestparser import ManifestParser
|
||||
from mozlog.unstructured import getLogger
|
||||
|
||||
# Needed for the AMO's rest API - https://developer.mozilla.org/en/addons.mozilla.org_%28AMO%29_API_Developers%27_Guide/The_generic_AMO_API
|
||||
AMO_API_VERSION = "1.5"
|
||||
|
||||
# Logger for 'mozprofile.addons' module
|
||||
module_logger = mozlog.getLogger(__name__)
|
||||
module_logger = getLogger(__name__)
|
||||
|
||||
|
||||
class AddonFormatError(Exception):
|
||||
|
|
|
@ -13,7 +13,7 @@ assert sys.version_info[0] == 2
|
|||
|
||||
deps = ['manifestparser >= 0.6',
|
||||
'mozfile >= 1.0',
|
||||
'mozlog']
|
||||
'mozlog >= 3.0']
|
||||
|
||||
setup(name=PACKAGE_NAME,
|
||||
version=PACKAGE_VERSION,
|
||||
|
|
|
@ -13,7 +13,7 @@ import urllib2
|
|||
from manifestparser import ManifestParser
|
||||
import mozfile
|
||||
import mozhttpd
|
||||
import mozlog
|
||||
import mozlog.unstructured as mozlog
|
||||
import mozprofile
|
||||
|
||||
from addon_stubs import generate_addon, generate_manifest
|
||||
|
|
|
@ -8,7 +8,7 @@ import os
|
|||
import subprocess
|
||||
import traceback
|
||||
|
||||
from mozlog.structured import get_default_logger
|
||||
from mozlog import get_default_logger
|
||||
from mozprocess import ProcessHandler
|
||||
import mozcrash
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ deps = ['mozcrash >= 0.14',
|
|||
'mozdevice >= 0.37',
|
||||
'mozfile >= 1.0',
|
||||
'mozinfo >= 0.7',
|
||||
'mozlog >= 1.5',
|
||||
'mozlog >= 3.0',
|
||||
'mozprocess >= 0.17',
|
||||
'mozprofile >= 0.18',
|
||||
]
|
||||
|
|
|
@ -15,7 +15,6 @@ import zipfile
|
|||
import mozdevice
|
||||
import mozfile
|
||||
import mozlog
|
||||
from mozlog import structured
|
||||
|
||||
import errors
|
||||
|
||||
|
@ -27,9 +26,9 @@ class Version(object):
|
|||
|
||||
def __init__(self):
|
||||
self._info = {}
|
||||
self._logger = structured.get_default_logger(component='mozversion')
|
||||
self._logger = mozlog.get_default_logger(component='mozversion')
|
||||
if not self._logger:
|
||||
self._logger = mozlog.getLogger('mozversion')
|
||||
self._logger = mozlog.unstructured.getLogger('mozversion')
|
||||
|
||||
def get_gecko_info(self, path):
|
||||
for type, section in INI_DATA_MAPPING:
|
||||
|
|
|
@ -8,7 +8,7 @@ PACKAGE_VERSION = '1.2'
|
|||
|
||||
dependencies = ['mozdevice >= 0.44',
|
||||
'mozfile >= 1.0',
|
||||
'mozlog >= 2.11']
|
||||
'mozlog >= 3.0']
|
||||
|
||||
setup(name='mozversion',
|
||||
version=PACKAGE_VERSION,
|
||||
|
|
|
@ -17,7 +17,7 @@ import os
|
|||
import sys
|
||||
import unittest
|
||||
|
||||
from mozlog import structured
|
||||
import mozlog
|
||||
from moztest.results import TestResultCollection
|
||||
from moztest.adapters.unit import StructuredTestRunner
|
||||
|
||||
|
@ -51,13 +51,10 @@ def main(args=sys.argv[1:]):
|
|||
parser.add_option('--list', dest='list_tests',
|
||||
action='store_true', default=False,
|
||||
help="list paths of tests to be run")
|
||||
structured.commandline.add_logging_group(parser)
|
||||
mozlog.commandline.add_logging_group(parser)
|
||||
options, args = parser.parse_args(args)
|
||||
logger = structured.commandline.setup_logging("mozbase",
|
||||
options,
|
||||
{
|
||||
"tbpl": sys.stdout
|
||||
})
|
||||
logger = mozlog.commandline.setup_logging("mozbase", options,
|
||||
{"tbpl": sys.stdout})
|
||||
|
||||
# read the manifest
|
||||
if args:
|
||||
|
|
|
@ -30,21 +30,21 @@ class StructuredOutputParser(OutputParser):
|
|||
|
||||
super(StructuredOutputParser, self).__init__(**kwargs)
|
||||
|
||||
structured = self._get_mozlog_module()
|
||||
self.formatter = structured.formatters.TbplFormatter()
|
||||
self.handler = structured.handlers.StatusHandler()
|
||||
self.log_actions = structured.structuredlog.log_actions()
|
||||
mozlog = self._get_mozlog_module()
|
||||
self.formatter = mozlog.formatters.TbplFormatter()
|
||||
self.handler = mozlog.handlers.StatusHandler()
|
||||
self.log_actions = mozlog.structuredlog.log_actions()
|
||||
|
||||
self.worst_log_level = INFO
|
||||
self.tbpl_status = TBPL_SUCCESS
|
||||
|
||||
def _get_mozlog_module(self):
|
||||
try:
|
||||
from mozlog import structured
|
||||
import mozlog
|
||||
except ImportError:
|
||||
self.fatal("A script class using structured logging must inherit "
|
||||
"from the MozbaseMixin to ensure that mozlog is available.")
|
||||
return structured
|
||||
return mozlog
|
||||
|
||||
def _handle_unstructured_output(self, line):
|
||||
if self.strict:
|
||||
|
|
|
@ -12,10 +12,10 @@ import runcppunittests as cppunittests
|
|||
import mozcrash
|
||||
import mozfile
|
||||
import mozinfo
|
||||
import mozlog
|
||||
import StringIO
|
||||
import posixpath
|
||||
from mozdevice import devicemanager, devicemanagerADB, devicemanagerSUT
|
||||
from mozlog import structured
|
||||
|
||||
try:
|
||||
from mozbuild.base import MozbuildObject
|
||||
|
@ -208,7 +208,7 @@ class RemoteCPPUnittestOptions(cppunittests.CPPUnittestOptions):
|
|||
|
||||
def main():
|
||||
parser = RemoteCPPUnittestOptions()
|
||||
structured.commandline.add_logging_group(parser)
|
||||
mozlog.commandline.add_logging_group(parser)
|
||||
options, args = parser.parse_args()
|
||||
if not args:
|
||||
print >>sys.stderr, """Usage: %s <test binary> [<test binary>...]""" % sys.argv[0]
|
||||
|
@ -249,10 +249,8 @@ def main():
|
|||
print "Error: you must provide a device IP to connect to via the --deviceIP option"
|
||||
sys.exit(1)
|
||||
|
||||
log = structured.commandline.setup_logging("remotecppunittests",
|
||||
options,
|
||||
{"tbpl": sys.stdout})
|
||||
|
||||
log = mozlog.commandline.setup_logging("remotecppunittests", options,
|
||||
{"tbpl": sys.stdout})
|
||||
|
||||
options.xre_path = os.path.abspath(options.xre_path)
|
||||
cppunittests.update_mozinfo()
|
||||
|
|
|
@ -12,8 +12,8 @@ import mozprocess
|
|||
import mozinfo
|
||||
import mozcrash
|
||||
import mozfile
|
||||
import mozlog
|
||||
from contextlib import contextmanager
|
||||
from mozlog import structured
|
||||
from subprocess import PIPE
|
||||
|
||||
SCRIPT_DIR = os.path.abspath(os.path.realpath(os.path.dirname(__file__)))
|
||||
|
@ -142,7 +142,7 @@ class CPPUnitTests(object):
|
|||
otherwise.
|
||||
"""
|
||||
self.xre_path = xre_path
|
||||
self.log = structured.structuredlog.get_default_logger()
|
||||
self.log = mozlog.get_default_logger()
|
||||
self.log.suite_start(programs)
|
||||
env = self.build_environment()
|
||||
pass_count = 0
|
||||
|
@ -215,7 +215,7 @@ def update_mozinfo():
|
|||
|
||||
def main():
|
||||
parser = CPPUnittestOptions()
|
||||
structured.commandline.add_logging_group(parser)
|
||||
mozlog.commandline.add_logging_group(parser)
|
||||
options, args = parser.parse_args()
|
||||
if not args:
|
||||
print >>sys.stderr, """Usage: %s <test binary> [<test binary>...]""" % sys.argv[0]
|
||||
|
@ -224,9 +224,8 @@ def main():
|
|||
print >>sys.stderr, """Error: --xre-path is required"""
|
||||
sys.exit(1)
|
||||
|
||||
log = structured.commandline.setup_logging("cppunittests",
|
||||
options,
|
||||
{"tbpl": sys.stdout})
|
||||
log = mozlog.commandline.setup_logging("cppunittests", options,
|
||||
{"tbpl": sys.stdout})
|
||||
|
||||
update_mozinfo()
|
||||
progs = extract_unittests_from_args(args, mozinfo.info)
|
||||
|
|
|
@ -154,11 +154,11 @@ metadata files in a subdirectory of the current directory named ``meta``.
|
|||
Output
|
||||
------
|
||||
|
||||
wptrunner uses the :py:mod:`mozlog.structured` package for output. This
|
||||
wptrunner uses the :py:mod:`mozlog` package for output. This
|
||||
structures events such as test results or log messages as JSON objects
|
||||
that can then be fed to other tools for interpretation. More details
|
||||
about the message format are given in the
|
||||
:py:mod:`mozlog.structured` documentation.
|
||||
:py:mod:`mozlog` documentation.
|
||||
|
||||
By default the raw JSON messages are dumped to stdout. This is
|
||||
convenient for piping into other tools, but not ideal for humans
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
html5lib >= 0.99
|
||||
mozinfo >= 0.7
|
||||
mozlog >= 2.8
|
||||
mozlog >= 3.0
|
||||
mozdebug >= 0.1
|
||||
|
|
|
@ -8,9 +8,9 @@ import threading
|
|||
import time
|
||||
from StringIO import StringIO
|
||||
|
||||
from mozlog.structured import structuredlog, reader
|
||||
from mozlog.structured.handlers import BaseHandler, StreamHandler, StatusHandler
|
||||
from mozlog.structured.formatters import MachFormatter
|
||||
from mozlog import structuredlog, reader
|
||||
from mozlog.handlers import BaseHandler, StreamHandler, StatusHandler
|
||||
from mozlog.formatters import MachFormatter
|
||||
from wptrunner import wptcommandline, wptrunner
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
|
|
|
@ -10,7 +10,7 @@ import socket
|
|||
import sys
|
||||
import time
|
||||
|
||||
from mozlog.structured import get_default_logger, handlers
|
||||
from mozlog import get_default_logger, handlers
|
||||
|
||||
from wptlogging import LogLevelRewriter
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ import types
|
|||
import uuid
|
||||
from collections import defaultdict
|
||||
|
||||
from mozlog.structured import reader
|
||||
from mozlog.structured import structuredlog
|
||||
from mozlog import reader
|
||||
from mozlog import structuredlog
|
||||
|
||||
import expected
|
||||
import manifestupdate
|
||||
|
|
|
@ -10,7 +10,7 @@ from collections import defaultdict
|
|||
import wptrunner
|
||||
import wpttest
|
||||
|
||||
from mozlog.structured import commandline, reader
|
||||
from mozlog import commandline, reader
|
||||
|
||||
logger = None
|
||||
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче