use assert_cmd::Command;
use uuid::Uuid;
#[test]
#[cfg_attr(windows, ignore = "nightly build-std is incompatible with this Windows toolchain")]
fn test_unwind_flags() -> color_eyre::Result<()> {
color_eyre::install().ok();
let out_dir = format!("tests/onetime/{}", Uuid::new_v4());
let mut cmd = Command::cargo_bin("wasi_virt_layer")?;
cmd.args([
"build",
"-p",
"lfs_api_test_vfs",
"test_wasm",
"-t",
"single",
"--out-dir",
&out_dir,
"--dev",
"--vfs-unwind",
"--wasm-unwind",
"true",
"--adjust-abi",
]);
cmd.assert().success();
let _ = std::fs::remove_dir_all(&out_dir);
Ok(())
}
#[test]
#[cfg_attr(windows, ignore = "nightly build-std is incompatible with this Windows toolchain")]
fn test_unwind_target_compile_with_unwind() -> color_eyre::Result<()> {
color_eyre::install().ok();
let out_dir = format!("tests/onetime/{}", Uuid::new_v4());
let mut cmd = Command::cargo_bin("wasi_virt_layer")?;
cmd.args([
"build",
"-p",
"test_unwind_vfs",
"test_unwind_target",
"-t",
"single",
"--out-dir",
&out_dir,
"--dev",
"--vfs-unwind",
"--wasm-unwind",
"true",
]);
cmd.assert().success();
let _ = std::fs::remove_dir_all(&out_dir);
Ok(())
}
#[test]
fn test_unwind_target_compile_without_unwind() -> color_eyre::Result<()> {
color_eyre::install().ok();
let out_dir = format!("tests/onetime/{}", Uuid::new_v4());
let mut cmd = Command::cargo_bin("wasi_virt_layer")?;
cmd.args([
"build",
"-p",
"test_unwind_vfs",
"test_unwind_target",
"-t",
"single",
"--out-dir",
&out_dir,
"--dev",
]);
cmd.assert().success();
let _ = std::fs::remove_dir_all(&out_dir);
Ok(())
}