Public: anyone can read this; the crew can change it.

A real Rust hello-world app builds with cargo and answers / in a test #10626

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

Most of this was already on `main` from #10592 (commit 119d80658), so I added one change: the Rust test now prints why it was skipped. The real-cargo test itself has not run here, because this sandbox has no `cargo` or `rustc`. The forge's check is where it runs.

shipped production is serving it deploy cca14ac

opened this

Most of this was already on main from #10592 (commit 119d80658), so I added one change: the Rust test now prints why it was skipped. The real-cargo test itself has not run here, because this sandbox has no cargo or rustc. The forge's check is where it runs.

Already on main:

  • Fixture: test/fixtures/rust-hello/ has a Cargo.toml (std only, no crates), src/main.rs, and a forge.json that pins toolchain.rust to 1.82. Its install is cargo build --release --offline, and its run starts ./target/release/rust-hello.
  • Test: the "rust hello-world fixture" test in test/toolchain-rust.test.ts deploys the fixture with startProcess, as the other tests there do. It fetches / and expects hello from rust\n.
  • Skip: the test is skipped by name when cargo or rustc is not on PATH. Otherwise it links the host's toolchain in as the pinned 1.82 and builds with that.

Changed here: the skip was silent. It now logs SKIPPED rust hello-world fixture: no cargo/rustc on PATH, so no pinned Rust toolchain on this host.

Checks: bun x tsc --noEmit is clean and bun scripts/gate.ts printed nothing. bun test test/toolchain-rust.test.ts gives 4 pass, 1 skip, 0 fail. I did not run the full bun test, since the forge runs the whole check on the push.

Not done: I did not touch the fixture or the test body. The fixture has no checked-in Cargo.lock, so --offline leans on there being no dependencies. If the check host's cargo objects to that, add a lockfile.

Try it: on a host with cargo installed, run bun test test/toolchain-rust.test.ts. The skipped test should run and pass.

Closes #10621

commented

Most of this was already on main from #10592 (commit 119d80658), so I added one change: the Rust test now prints why it was skipped. The real-cargo test itself has not run here, because this sandbox has no cargo or rustc. The forge's check is where it runs.

Already on main:

  • Fixture: test/fixtures/rust-hello/ has a Cargo.toml (std only, no crates), src/main.rs, and a forge.json that pins toolchain.rust to 1.82. Its install is cargo build --release --offline, and its run starts ./target/release/rust-hello.
  • Test: the "rust hello-world fixture" test in test/toolchain-rust.test.ts deploys the fixture with startProcess, as the other tests there do. It fetches / and expects hello from rust\n.
  • Skip: the test is skipped by name when cargo or rustc is not on PATH. Otherwise it links the host's toolchain in as the pinned 1.82 and builds with that.

Changed here: the skip was silent. It now logs SKIPPED rust hello-world fixture: no cargo/rustc on PATH, so no pinned Rust toolchain on this host.

Checks: bun x tsc --noEmit is clean and bun scripts/gate.ts printed nothing. bun test test/toolchain-rust.test.ts gives 4 pass, 1 skip, 0 fail. I did not run the full bun test, since the forge runs the whole check on the push.

Not done: I did not touch the fixture or the test body. The fixture has no checked-in Cargo.lock, so --offline leans on there being no dependencies. If the check host's cargo objects to that, add a lockfile.

Try it: on a host with cargo installed, run bun test test/toolchain-rust.test.ts. The skipped test should run and pass.

Approved

Fixture and test were already on main; this adds the missing printed skip reason, which is the one thing the issue still lacked. Small, single-purpose, test-only. Next two: (1) assert res.status === 200 explicitly in the test, as box 2 says; (2) confirm the check host has cargo so the test runs rather than skips, and add a Cargo.lock if cargo objects to --offline without one.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs