Experimental code coverage local debugger

From chromium/chromium · View interactive version

Experimental code coverage local debugger is an AI agent skill from the GitHub repository chromium/chromium. Runs code coverage locally via Universal Test Runner (UTR) or helper scripts, mimicking LUCI trybots. Activate when CQ tryjobs fail or underreport coverage, to test local GN/recipe repairs before uploading, or to debug hermetic crashes.

How to use this skill

Skill file

Code Coverage Local Debugger

Use this skill to generate code coverage data on a local workstation using

Chromium's Universal Test Runner (tools/utr). It wraps the exact recipe logic

used by LUCI trybots, dynamically evaluating local Starlark and GN repairs.


When to Use This Skill

restore code coverage before uploading patchsets.


Inputs


Workflow

1. Regenerate Starlark Configurations

If prior agent debugging steps modified Starlark files under infra/config/,

regenerate the global configuration files so UTR reads the latest state.

lucicfg generate infra/config/main.star

2. Execute Universal Test Runner (UTR)

For general UTR command documentation, common flags, and authentication

guidelines, refer to the utr skill.

When debugging code coverage specifically, invoke tools/utr/run.py to compile

and execute the test target while replicating the exact LUCI builder recipe

environment and evaluating Starlark code coverage GN arguments (e.g.,

use_clang_coverage = true):

vpython3 tools/utr/run.py -p chromium -B {{bucket}} -b {{builder_name}} \
  -t {{test_suite}} compile-and-test

that Starlark or GN argument repairs successfully restore code coverage

instrumentation and .profdata generation before uploading a CL, or when

isolating shard failures on platforms not accessible locally (e.g., Windows or

ChromeOS).

3. Rapid Workstation Execution (Bypass Container)

To build and run a native workstation test binary directly against pinned LLVM

tools without UTR container overhead, execute run_local_coverage.py:

vpython3 tools/code_coverage/run_local_coverage.py \
  --binary {{build_dir}}/{{test_suite}} --source {{target_file}}

target test binary using autoninja -C {{build_dir}} {{test_suite}} before

running.

already compiled locally to skip the build step.

4. Inspect Local Verification Artifacts

UTR run (ci.chromium.org/ui/inv/...) to verify code coverage percentage

resolution.

that generated .profdata reports non-zero line execution counts matching

edits.


References


[clang_cov_ref]: https://clang.llvm.org/docs/SourceBasedCodeCoverage.html

[utr_ref]: https://chromium.googlesource.com/chromium/src/tools/+/HEAD/utr/README.md

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.