Bug 1034272 - Convert cppunittests to structured logging.;r=ted

This commit is contained in:
Chris Manchester
2014-07-10 09:33:39 -04:00
parent 9ce06c8ac5
commit ed5ff541e2
3 changed files with 80 additions and 39 deletions

View File

@@ -253,8 +253,12 @@ class MachCommands(MachCommandBase):
'executed.')
def run_cppunit_test(self, **params):
from mozlog.structured import commandline
import runcppunittests as cppunittests
import logging
log = commandline.setup_logging("cppunittest",
{},
{"tbpl": sys.stdout})
if len(params['test_files']) == 0:
testdir = os.path.join(self.distdir, 'cppunittests')
@@ -269,11 +273,9 @@ class MachCommands(MachCommandBase):
tester = cppunittests.CPPUnitTests()
try:
result = tester.run_tests(progs, self.bindir, symbols_path)
except Exception, e:
self.log(logging.ERROR, 'cppunittests',
{'exception': str(e)},
'Caught exception running cpp unit tests: {exception}')
result = tester.run_tests(progs, self.bindir, symbols_path, interactive=True)
except Exception as e:
log.error("Caught exception running cpp unit tests: %s" % str(e))
result = False
return 0 if result else 1