Open
Bug 2017145
Opened 2 days ago
Updated 2 days ago
Switch the gtest harness to structured logging
Categories
(Testing :: GTest, enhancement)
Testing
GTest
Tracking
(Not tracked)
ASSIGNED
People
(Reporter: florian, Assigned: florian)
Details
Attachments
(1 file)
This will enable seeing much nicer data in resource usage profiles for the GTest jobs.
Example profile with the patch: https://share.firefox.dev/4roXvb9
Example profile without the patch: https://share.firefox.dev/4kBM1hK
The output when running ./mach gtest locally will also look a lot more like the output of running mach test for xpcshell tests.
| Assignee | ||
Comment 1•2 days ago
|
||
GTest was still using unstructured TBPL-format output.
This switches it to emit mozlog-compatible structured JSON from the C++ side
and properly consume it on the Python side, matching what mochitest and
xpcshell already do.
C++ (testing/gtest/mozilla/GTestRunner.cpp):
- MozillaPrinter now emits structured JSON actions (suite_start, group_start,
test_start, test_status, test_end, group_end, suite_end) instead of
TBPL-formatted text (TEST-START, TEST-PASS, TEST-UNEXPECTED-FAIL). - Added group_start/group_end via OnTestSuiteStart/OnTestSuiteEnd for
per-suite markers in resource-usage profiles. - Added JsonEscape helper for safe JSON string encoding.
- Always installed (MOZ_TBPL_PARSER conditional removed since every caller
set it).
mach gtest (python/mozbuild/mozbuild/mach_commands.py):
- Structured JSON lines from the gtest binary are parsed and routed through
a StructuredLogger with MachFormatter (for human-readable terminal output)
and ResourceHandler (for ./mach resource-usage profiles). - Non-JSON output lines are logged as process_output actions so they also
appear in resource profiles. - Timestamps are continuous with build output.
- Removed the --tbpl-parser / -t flag (no longer needed).
CI harnesses (testing/gtest/rungtests.py, remotegtests.py):
- Switched from mozlog.unstructured to mozlog.commandline.setup_logging
with {"raw": sys.stdout}, so mozharness StructuredOutputParser can
parse the JSON directly. - Added commandline.add_logging_group to argument parsers.
Mozharness configs:
- Removed gtest from unstructured_suites (android_common.py) and
unstructured_flavors (linux/mac/win_unittest.py) so mozharness uses
StructuredOutputParser instead of DesktopUnittestOutputParser.
You need to log in
before you can comment on or make changes to this bug.
Description
•