mirror of
https://github.com/marcoallegretti/WEFT_OS.git
synced 2026-11-22 08:13:59 +00:00
fix(runtime): stop reporting readiness without an engine
Built without the wasmtime-runtime feature, weft-runtime printed READY and exited without executing anything. weft-appd treats READY on the runtime's stdout as the readiness signal, so such a build made a session appear to start successfully although no component ran. The feature-disabled build now exits with an error naming the missing feature, so appd sees the runtime close without READY and stops the session. The binary still builds for the portable type, lint and unit checks. The Nix package keeps building the engine-enabled runtime. Validation: - new unit test: run_module in a feature-disabled build returns an error naming the feature; it fails against the previous stub - feature-disabled binary against a minimal package: exits 1 with the error and prints no READY - cargo test -p weft-runtime (5 passed), clippy -D warnings, fmt --check
This commit is contained in:
parent
b99cc73a47
commit
f6d5cf102c
2 changed files with 12 additions and 3 deletions
|
|
@ -87,8 +87,9 @@ fn run_module(
|
|||
_preopen: &[(String, String)],
|
||||
_ipc_socket: Option<&str>,
|
||||
) -> anyhow::Result<()> {
|
||||
println!("READY");
|
||||
Ok(())
|
||||
anyhow::bail!(
|
||||
"weft-runtime was built without the wasmtime-runtime feature and cannot execute components"
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(feature = "wasmtime-runtime")]
|
||||
|
|
@ -506,6 +507,14 @@ fn package_store_roots() -> Vec<PathBuf> {
|
|||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[cfg(not(feature = "wasmtime-runtime"))]
|
||||
#[test]
|
||||
fn engine_disabled_build_refuses_to_run_components() {
|
||||
let err = run_module(std::path::Path::new("app.wasm"), &[], None)
|
||||
.expect_err("a build without wasmtime-runtime must not report success");
|
||||
assert!(err.to_string().contains("wasmtime-runtime"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn package_store_roots_includes_system_path() {
|
||||
let roots = package_store_roots();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ cargo build --release
|
|||
cargo build -p weft-runtime --features wasmtime-runtime,net-fetch
|
||||
```
|
||||
|
||||
Without `--features wasmtime-runtime`, the runtime prints READY and exits (stub mode, used in CI on platforms without Linux system dependencies).
|
||||
Without `--features wasmtime-runtime`, the runtime compiles for type, lint and unit checks (the portable CI configuration) but exits with an error when asked to run a component; it never reports readiness.
|
||||
|
||||
## Signing packages
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue