Summary
Lit has built-in result reporters (xUnit XML, ResultDB) but no way to produce WTT (Windows Test Technology) log files. This RFC proposes adding a --wtt-output flag that writes a .wtl file consumable by Windows lab infrastructure.
Motivation
We run LLVM Offload tests as part of Windows hardware certification (HLK). The HLK consumes test results through WTT log files. WTT log files have a UTF-16 XML format with specific elements for test start/end, error messages, and pass/fail results.
Lit already has precedent for platform-specific reporters, such as --resultdb-output, which produces ResultDB JSON.
Proposal
A new flag:
llvm-lit --wtt-output=results.wtl tests/
This produces a UTF-16 XML file conforming to the WTT Logger schema:
<?xml version="1.0" encoding="utf-16"?>
<WTT-Logger>
<RTI ID="1" Machine="hostname" ProcessName="lit" ProcessID="1234" BaseTime="2026:6:23 17:0:0:0" Frequency="1" />
<CTX ID="1" Current="WTTLOG" Parent="ROOT" />
<StartTest Title="suite :: path/to/test.test" TUID="">
</StartTest>
<Err UserText="error output truncated to 4KB">
</Err>
<EndTest Title="suite :: path/to/test.test" TUID="" Result="Fail" Repro="">
</EndTest>
<PFRollup Total="50" Passed="48" Failed="2" Blocked="0" Warned="0" Skipped="0" />
</WTT-Logger>
Result code mapping
| lit result | WTT Result | Notes |
|---|---|---|
| PASS | Pass | |
| XFAIL | Pass | Expected failure = success |
| FAIL | Fail | Error output included in <Err> |
| XPASS | Fail | Unexpected pass = failure |
| TIMEOUT | Fail | |
| UNRESOLVED | Fail | |
| EXCLUDED | (omitted) | Not reported |
| SKIPPED | (omitted) | Counted in summary |
| UNSUPPORTED | (omitted) | Counted in summary |
Proposed Code Changes
lit/reports.py- Add
WttReportclass alongside the existingResultDBReport. Inherits fromReport. - Overrides
write_resultsto force UTF-16 encoding (WTT requirement). - Iterates over tests, writes
<StartTest>/<EndTest>pairs for each executed test, includes<Err>with truncated output (4KB) for failures, and writes a<PFRollup>summary at the end. - Includes two helper functions:
_wtt_timestamp()for the WTT time format and_wtt_sanitize_attr()for XML attribute escaping.
- Add
lit/cl_arguments.py- Register the
--wtt-outputflag in the Output Format group, usingtype=lit.reports.WttReport(same--*-outputnaming pattern as--xunit-xml-outputand--resultdb-output).
- Register the
Design Decisions
- UTF-16 encoding: WTT Logger spec requires it. The
Reportbase class defaults to UTF-8, soWttReportoverrideswrite_resultsto open the file withencoding="utf-16". - Output truncation: Error output is capped at 4KB per test, pass messages at 1KB. The WTT log viewer has display limits.
- No new dependencies: Uses
xml.sax.saxutilswhichreports.pyalready imports for the xUnit reporter. - Skipped tests omitted: Tests that didn’t execute (UNSUPPORTED, EXCLUDED, SKIPPED) don’t appear as
<StartTest>/<EndTest>entries. A summary message notes how many were skipped.
Backward compatibility
Purely additive, and no output produced unless the flag is explicitly passed. Also, no new dependencies.
Thanks!