Skip to content

Add verify-compilers-locally skill#2156

Open
mattgodbolt wants to merge 1 commit into
mainfrom
mg/verify-compilers-skill
Open

Add verify-compilers-locally skill#2156
mattgodbolt wants to merge 1 commit into
mainfrom
mg/verify-compilers-skill

Conversation

@mattgodbolt

Copy link
Copy Markdown
Member

A Claude Code skill that captures the loop for vetting new compiler PRs: install the compilers locally (plus toolchain deps), run a local CE instance against the real config, compile-test every id, report a pass/fail table, then tear down.

What's here

  • SKILL.md -- the procedure and the hard-won gotchas (never --env amazon locally; layer config as local.properties; --gcc-toolchain GCC must be installed; disassembly passing != execution working).
  • compile_matrix.py -- the reusable harness. Drives POST /api/compiler/<id>/compile across a list of lang:id cases and prints a table. Flags: --source/--source-file (interpreted DSLs whose source is an example file), --args, and --execute (checks didExecute + execResult.code, a separate path from disassembly).

Why

Built and refined while adopting AOCC, CuTe DSL, and Lua. It earned its keep: it caught a CuTe DSL placeholder false-pass, and the --execute mode exists because every Lua version disassembled correctly while all executed with the wrong interpreter -- a disassembly-only check was all-green.

make static-checks passes.

Captures the install -> run-local-CE -> compile-test loop for vetting new
compiler PRs: ce_install the compilers (plus toolchain deps), layer the config
as local.properties (never --env amazon), drive the compile API across every
id, report a pass/fail table, tear down.

compile_matrix.py is the reusable harness: --source-file/--args for interpreted
DSLs, and --execute to check the execution path (didExecute + execResult.code),
which is separate from disassembly -- a compiler can disassemble fine yet run
the wrong binary.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 4, 2026 04:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Claude skill and a small Python harness to standardize the “verify new compilers locally” workflow against a real local Compiler Explorer (CE) instance, including optional execution-path validation.

Changes:

  • Introduces verify-compilers-locally skill documentation capturing the end-to-end local verification procedure and common gotchas.
  • Adds compile_matrix.py, a CLI helper to drive CE’s compile API across multiple lang:compilerId cases and print a pass/fail matrix (with an --execute mode).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
.claude/skills/verify-compilers-locally/SKILL.md Documents the local install/config/run/teardown procedure and verification gotchas.
.claude/skills/verify-compilers-locally/compile_matrix.py Adds a reusable CLI harness to compile (and optionally execute) a test program across many compiler IDs via the CE API.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +57 to +69
asm = res.get("asm") or []
exec_res = res.get("execResult") or {}
exec_stdout = " ".join(x.get("text", "") for x in (exec_res.get("stdout") or [])).strip()
# The build/setup stderr (e.g. a failed interpreter spawn) surfaces at the top level.
setup_err = " ".join(x.get("text", "") for x in (res.get("stderr") or [])).strip()
return {
"code": res.get("code"),
"asm_lines": sum(1 for a in asm if (a.get("text") or "").strip()),
"did_execute": exec_res.get("didExecute"),
"exec_code": exec_res.get("code"),
"stdout": exec_stdout,
"setup_err": setup_err,
}
Comment on lines +98 to +100
ok = r["did_execute"] is True and r["exec_code"] == 0
note = (f"stdout={r['stdout'][:60]!r}" if ok else f"FAIL: {r['setup_err'][:200]}").strip()
print(f"{lang:8} {cid:16} {str(r['did_execute']):7} {str(r['exec_code']):4} {note}")
Comment on lines +144 to +145
cases = [(case.partition(":")[0], case.partition(":")[2]) for case in opts.cases]
all_ok = run_execution(cases, sources, opts) if opts.execute else run_disassembly(cases, sources, opts)
### 4. Launch CE locally
Needs `node_modules` (run `npm ci` in the checkout/worktree if absent). Then:
```bash
nohup npm run dev -- --port 10240 > /tmp/ce_dev.log 2>&1 &
Comment on lines +95 to +96
pkill -f "app.ts --port 10240"
rm -f <ce-checkout>/etc/config/*.local.properties # so the next `npm run dev` isn't AOCC-only
```

### 2. Install the compilers (+ toolchain deps)
Default dest is `/opt/compiler-explorer` (must be writable). Install the group:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps important to note to never install a complete group with things like gcc, clang or rust

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could list first and select the exact versions to install instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants