Skip to content

Commit

Permalink
tests: Add regression test for file system merging error
Browse files Browse the repository at this point in the history
  • Loading branch information
theduke committed Sep 5, 2023
1 parent 1c5c74d commit 7768ed7
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions lib/wasix/src/os/console/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,4 +364,32 @@ mod tests {

assert_eq!(out, "hello VAL1\n");
}

/// Regression test to ensure merging of multiple packages works correctly.
#[test]
fn test_console_python_merge() {
std::env::set_var("RUST_LOG", "wasmer_wasix=trace");
tracing_subscriber::fmt::init();
let tokio_rt = tokio::runtime::Runtime::new().unwrap();
let rt_handle = tokio_rt.handle().clone();
let _guard = rt_handle.enter();

let tm = TokioTaskManager::new(tokio_rt);
let mut rt = PluggableRuntime::new(Arc::new(tm));
rt.set_engine(Some(wasmer::Engine::default()))
.set_package_loader(BuiltinPackageLoader::from_env().unwrap());

let cmd = "wasmer-tests/python-env-dump --help";

let (mut handle, _proc) = Console::new(cmd, Arc::new(rt)).run().unwrap();

let code = rt_handle
.block_on(async move {
let res = handle.wait_finished().await?;
Ok::<_, anyhow::Error>(res)
})
.unwrap();

assert_eq!(code.raw(), 0);
}
}

0 comments on commit 7768ed7

Please sign in to comment.