Compile world programs only on first start

This commit is contained in:
2026-11-12 09:35:51 +00:00
parent 0b79bb4227
commit 03ad478596
5 changed files with 66 additions and 171 deletions
+5 -8
View File
@@ -54,6 +54,7 @@ async fn init_seeds_config_tools_and_one_source_commit() -> anyhow::Result<()> {
target.join("wasm32-wasip2/release/git.wasm"),
bundle.join("bin/git.wasm"),
)?;
write(&bundle, "bin/unused.wasm", "not a component")?;
write(&bundle, "src/sausage/README.md", "World source")?;
write(
&bundle,
@@ -83,15 +84,13 @@ async fn init_seeds_config_tools_and_one_source_commit() -> anyhow::Result<()> {
lines,
[
format!("Create world folder: {}", destination.display()),
"Copy tools: 1".into(),
"Copy tools: 2".into(),
"Create /src/sausage".into(),
"Seed /etc and /srv/www".into(),
format!(
"Write config: {}",
destination.join("world/etc/sausage/config.yaml").display()
),
"Precompile tools 0/1".into(),
"Precompile tools 1/1".into(),
"Create the first commit in /src/sausage".into(),
"Next steps:".into(),
format!(
@@ -149,10 +148,10 @@ fn init_errors_name_the_failed_step() -> anyhow::Result<()> {
let bundle = dir.path().join("bundle");
for (name, expected) in [
("missing", "Copy tools failed"),
("invalid", "Precompile tools failed"),
("invalid", "Create source repository failed"),
] {
if name == "invalid" {
write(&bundle, "bin/invalid.wasm", "not a component")?;
write(&bundle, "bin/git.wasm", "not a component")?;
write(&bundle, "src/sausage/README.md", "Source")?;
}
let output = std::process::Command::new(env!("CARGO_BIN_EXE_sausage"))
@@ -166,9 +165,7 @@ fn init_errors_name_the_failed_step() -> anyhow::Result<()> {
let stderr = String::from_utf8(output.stderr)?;
assert!(stderr.contains(expected), "{stderr}");
assert!(!stderr.contains("Next steps:"), "{stderr}");
if name == "invalid" {
assert!(stderr.contains("/bin/invalid.wasm"), "{stderr}");
}
assert!(!stderr.contains("Precompile"), "{stderr}");
}
Ok(())
}