Bug 1129495 - [mozlog] Add optional 'path' attribute to test_start, r=jgraham

This commit is contained in:
Andrew Halberstadt 2015-02-10 17:11:35 -05:00
parent 89b656f752
commit e55738f586
3 changed files with 12 additions and 3 deletions

View File

@ -84,6 +84,10 @@ emitted:
``test``
A unique id for the test (string or list of strings).
``path``
Optional path to the test relative to some base (typically the root of the
source tree). Mainly used when ``test`` id is not a path (string).
``test_status``
Emitted for a test which has subtests to record the result of a
single subtest.

View File

@ -24,6 +24,7 @@ Allowed actions, and subfields:
test_start
test - ID for the test
path - Relative path to test (optional)
test_end
test - ID for the test
@ -248,11 +249,14 @@ class StructuredLogger(object):
self._log_data("suite_end")
@log_action(TestId("test"))
@log_action(TestId("test"),
Unicode("path", default=None, optional=True))
def test_start(self, data):
"""Log a test_start message
:param test: Identifier of the test that will run.
:param path: Path to test relative to some base (typically the root of
the source tree).
"""
if not self._state.suite_started:
self.error("Got test_start message before suite_start for test %s" %

View File

@ -117,9 +117,10 @@ class TestStructuredLog(BaseStructuredTest):
self.assert_log_equals({"action": "test_start",
"test":"test1"})
self.logger.test_start(("test1", "==", "test1-ref"))
self.logger.test_start(("test1", "==", "test1-ref"), path="path/to/test")
self.assert_log_equals({"action": "test_start",
"test":("test1", "==", "test1-ref")})
"test":("test1", "==", "test1-ref"),
"path": "path/to/test"})
self.logger.suite_end()
def test_start_inprogress(self):