Skip to content

feat: ilo test subcommand for -- run: / -- out: assertions#569

Merged
danieljohnmorris merged 3 commits into
mainfrom
fix/ilo-test-cmd
May 21, 2026
Merged

feat: ilo test subcommand for -- run: / -- out: assertions#569
danieljohnmorris merged 3 commits into
mainfrom
fix/ilo-test-cmd

Conversation

@danieljohnmorris
Copy link
Copy Markdown
Collaborator

Summary

Pending #52: a user-facing ilo test subcommand that runs the same -- run: / -- out: / -- err: annotation format tests/examples_engines.rs already uses.

Manifesto framing: every .ilo example in the repo already carries embedded assertions and the integration harness runs them. Surfacing that same format as ilo test means end-user programs and agent-written test suites can assert behaviour the same way examples do, with zero new syntax to learn. Token win: one annotation pattern covers in-repo examples, agent docs, and user tests.

Repro

Before: an agent writing tests for its own ilo program had no in-language test runner. The closest thing was hand-rolled bash scripts piping ilo <file> into diff, or copying the Rust integration harness verbatim.

After:

$ cat tests/sum.ilo
-- run: m
-- out: 3
m>n;+1 2

$ ilo test tests/sum.ilo
PASS  tests/sum.ilo::m (line 1)

1 passed, 0 failed

ilo test examples/ runs every example in the repo as a smoke test (~ same set the integration harness covers).

What's in the diff

  • feat: ilo test subcommand - src/cli/test_runner.rs (new) implements the file/directory walker, annotation parser (parse_cases / parse_engine_skips), engine selector (vm / jit / all), and subprocess fan-out. Cmd::Test(TestArgs) added to src/cli/args.rs; dispatch wired in src/main.rs. Path defaults to examples/ when omitted.
  • test: end-to-end coverage for ilo test - 7 subprocess tests pin pass / fail / -- err: / dir recursion / --engine all / missing-path / no-annotations paths. Spawns the ilo binary so the test exercises real CLI parsing + the runner's own subprocess fan-out.
  • doc: sync ilo test surface across SPEC, ai.txt, skill - SPEC.md CLI invocation line and **ilo test** paragraph next to ilo check. ai.txt agent-spec entry inline. skills/ilo/ilo-agent.md Testing section with the three canonical invocations.

Test plan

  • cargo test --release --features cranelift --test cli_test_cmd - 7 passing
  • cargo fmt && cargo clippy --release --features cranelift --all-targets -- -D warnings - clean
  • Full suite passes except pre-existing regression_reserved_names_doc::spec_reserved_short_names_match_builtin_registry (b64/hex SPEC drift, unrelated to this PR)
  • Manually verified ilo test examples/ walks the examples dir and reports per-file PASS/FAIL

Follow-ups

  • Could add a --json output mode in a follow-up if agents want a machine-parseable summary instead of the human PASS/FAIL lines.

Surfaces the in-tree -- run: / -- out: / -- err: annotation format as a
user-facing command. The same format that tests/examples_engines.rs
already exercises, exposed so end-user programs and test suites can
assert behaviour from the same files agents read as in-context
examples. ilo test <file> runs one file; ilo test <dir> walks .ilo
files recursively. Each case spawns the current ilo binary with the
chosen engine flag (defaults to --vm; --engine jit / --engine all
widen the matrix), asserts stdout (-- out:) or stderr (-- err:) against
the expected payload, and prints PASS / FAIL with the source line.
Final line is N passed, M failed; exit 0 on all-pass, 1 otherwise.

The runner lives in src/cli/test_runner.rs, dispatched from main on
Cmd::Test. Path defaults to examples/ when omitted so ilo test in a
fresh checkout does something useful out of the box.
Seven subprocess tests pin the dispatch path: passing case, failing
case (exit 1 + FAIL line), -- err: assertion shape, directory
recursion, --engine all running both engines, missing-path error, and
no-annotations-found error. Each spawns the ilo binary so the test
exercises real CLI parsing + the runner's own subprocess fan-out, two
layers deep.
SPEC.md gains the CLI invocation line in the inventory plus a full
**ilo test** paragraph next to ilo check, covering engine selection,
the -- engine-skip: passthrough, and the all-pass / any-fail exit
codes. ai.txt gets the matching agent-spec entry inline. The skill's
ilo-agent.md gets a Testing section with the three canonical
invocations so an agent writing tests for its own programs sees the
shape without round-tripping to SPEC.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
4734 2 4732 0
View the top 2 failed test(s) by shortest run time
ilo::examples::examples
Stack Traces | 7.85s run time
thread 'examples' (42138) panicked at tests/examples.rs:158:9:
9/1167 example test(s) failed:

crypto-primitives.ilo (line 42): `ilo .../ilo/examples/crypto-primitives.ilo sha-empty`
  FAILED (exit exit status: 101)
  stderr: thread 'main' (43203) panicked at src/vm/mod.rs:1877:13:
auto-unwrap on a non-Result tree-bridge builtin slipped past verify
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

crypto-primitives.ilo (line 44): `ilo .../ilo/examples/crypto-primitives.ilo sha-abc`
  FAILED (exit exit status: 101)
  stderr: thread 'main' (43209) panicked at src/vm/mod.rs:1877:13:
auto-unwrap on a non-Result tree-bridge builtin slipped past verify
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

crypto-primitives.ilo (line 46): `ilo .../ilo/examples/crypto-primitives.ilo hmac-rfc2`
  FAILED (exit exit status: 101)
  stderr: thread 'main' (43215) panicked at src/vm/mod.rs:1877:13:
auto-unwrap on a non-Result tree-bridge builtin slipped past verify
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

crypto-primitives.ilo (line 48): `ilo .../ilo/examples/crypto-primitives.ilo b64-roundtrip`
  FAILED (exit exit status: 101)
  stderr: thread 'main' (43221) panicked at src/vm/mod.rs:1877:13:
auto-unwrap on a non-Result tree-bridge builtin slipped past verify
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

crypto-primitives.ilo (line 50): `ilo .../ilo/examples/crypto-primitives.ilo b64-padded`
  FAILED (exit exit status: 101)
  stderr: thread 'main' (43227) panicked at src/vm/mod.rs:1877:13:
auto-unwrap on a non-Result tree-bridge builtin slipped past verify
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

crypto-primitives.ilo (line 52): `ilo .../ilo/examples/crypto-primitives.ilo hex-abc`
  FAILED (exit exit status: 101)
  stderr: thread 'main' (43233) panicked at src/vm/mod.rs:1877:13:
auto-unwrap on a non-Result tree-bridge builtin slipped past verify
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

crypto-primitives.ilo (line 54): `ilo .../ilo/examples/crypto-primitives.ilo ct-eq-yes`
  FAILED (exit exit status: 101)
  stderr: thread 'main' (43239) panicked at src/vm/mod.rs:1877:13:
auto-unwrap on a non-Result tree-bridge builtin slipped past verify
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

crypto-primitives.ilo (line 56): `ilo .../ilo/examples/crypto-primitives.ilo ct-eq-no`
  FAILED (exit exit status: 101)
  stderr: thread 'main' (43244) panicked at src/vm/mod.rs:1877:13:
auto-unwrap on a non-Result tree-bridge builtin slipped past verify
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

crypto-primitives.ilo (line 58): `ilo .../ilo/examples/crypto-primitives.ilo ct-eq-len`
  FAILED (exit exit status: 101)
  stderr: thread 'main' (43250) panicked at src/vm/mod.rs:1877:13:
auto-unwrap on a non-Result tree-bridge builtin slipped past verify
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
ilo::examples_engines::examples_all_engines
Stack Traces | 7.88s run time
thread 'examples_all_engines' (42150) panicked at tests/examples_engines.rs:235:9:
9/1153 multi-engine example test(s) failed:

crypto-primitives.ilo [vm] (line 42): `ilo .../ilo/examples/crypto-primitives.ilo --vm sha-empty`
  FAILED (exit exit status: 101)
  stderr: thread 'main' (43412) panicked at src/vm/mod.rs:1877:13:
auto-unwrap on a non-Result tree-bridge builtin slipped past verify
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

crypto-primitives.ilo [vm] (line 44): `ilo .../ilo/examples/crypto-primitives.ilo --vm sha-abc`
  FAILED (exit exit status: 101)
  stderr: thread 'main' (43416) panicked at src/vm/mod.rs:1877:13:
auto-unwrap on a non-Result tree-bridge builtin slipped past verify
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

crypto-primitives.ilo [vm] (line 46): `ilo .../ilo/examples/crypto-primitives.ilo --vm hmac-rfc2`
  FAILED (exit exit status: 101)
  stderr: thread 'main' (43420) panicked at src/vm/mod.rs:1877:13:
auto-unwrap on a non-Result tree-bridge builtin slipped past verify
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

crypto-primitives.ilo [vm] (line 48): `ilo .../ilo/examples/crypto-primitives.ilo --vm b64-roundtrip`
  FAILED (exit exit status: 101)
  stderr: thread 'main' (43423) panicked at src/vm/mod.rs:1877:13:
auto-unwrap on a non-Result tree-bridge builtin slipped past verify
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

crypto-primitives.ilo [vm] (line 50): `ilo .../ilo/examples/crypto-primitives.ilo --vm b64-padded`
  FAILED (exit exit status: 101)
  stderr: thread 'main' (43428) panicked at src/vm/mod.rs:1877:13:
auto-unwrap on a non-Result tree-bridge builtin slipped past verify
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

crypto-primitives.ilo [vm] (line 52): `ilo .../ilo/examples/crypto-primitives.ilo --vm hex-abc`
  FAILED (exit exit status: 101)
  stderr: thread 'main' (43432) panicked at src/vm/mod.rs:1877:13:
auto-unwrap on a non-Result tree-bridge builtin slipped past verify
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

crypto-primitives.ilo [vm] (line 54): `ilo .../ilo/examples/crypto-primitives.ilo --vm ct-eq-yes`
  FAILED (exit exit status: 101)
  stderr: thread 'main' (43436) panicked at src/vm/mod.rs:1877:13:
auto-unwrap on a non-Result tree-bridge builtin slipped past verify
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

crypto-primitives.ilo [vm] (line 56): `ilo .../ilo/examples/crypto-primitives.ilo --vm ct-eq-no`
  FAILED (exit exit status: 101)
  stderr: thread 'main' (43440) panicked at src/vm/mod.rs:1877:13:
auto-unwrap on a non-Result tree-bridge builtin slipped past verify
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

crypto-primitives.ilo [vm] (line 58): `ilo .../ilo/examples/crypto-primitives.ilo --vm ct-eq-len`
  FAILED (exit exit status: 101)
  stderr: thread 'main' (43444) panicked at src/vm/mod.rs:1877:13:
auto-unwrap on a non-Result tree-bridge builtin slipped past verify
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@danieljohnmorris danieljohnmorris merged commit f5cc788 into main May 21, 2026
1 of 4 checks passed
@danieljohnmorris danieljohnmorris deleted the fix/ilo-test-cmd branch May 21, 2026 18:49
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.

1 participant