test-programs: learn how to preopen a dir again
This commit is contained in:
63
Cargo.lock
generated
63
Cargo.lock
generated
@@ -207,12 +207,12 @@ checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cap-fs-ext"
|
name = "cap-fs-ext"
|
||||||
version = "0.7.0"
|
version = "0.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "724c2735539ad3ab51f04a0d84bca8c23398e558e810254a6996867fd6c7db81"
|
checksum = "eac51b267ca1f2abe043f6193ff8ef119cdcfd46f10a1644c76d41daf55a5b73"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cap-primitives",
|
"cap-primitives 0.8.0",
|
||||||
"cap-std",
|
"cap-std 0.8.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -226,7 +226,23 @@ dependencies = [
|
|||||||
"ipnet",
|
"ipnet",
|
||||||
"libc",
|
"libc",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"posish 0.5.2",
|
"posish",
|
||||||
|
"winapi",
|
||||||
|
"winx 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cap-primitives"
|
||||||
|
version = "0.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "43639eaff5966a4904bf0441ad4b6a8169b463e58f0cb34140dc8555d387b699"
|
||||||
|
dependencies = [
|
||||||
|
"errno",
|
||||||
|
"fs-set-times",
|
||||||
|
"ipnet",
|
||||||
|
"libc",
|
||||||
|
"once_cell",
|
||||||
|
"posish",
|
||||||
"winapi",
|
"winapi",
|
||||||
"winx 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winx 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@@ -237,7 +253,16 @@ version = "0.7.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0760daa4e6270daa9c5c6ad133108fb77edfe023a019c392d98dd769defa42d5"
|
checksum = "0760daa4e6270daa9c5c6ad133108fb77edfe023a019c392d98dd769defa42d5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cap-primitives",
|
"cap-primitives 0.7.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cap-std"
|
||||||
|
version = "0.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b9d28ff1a5e60755c62be712baf75794892eb63a8b5bc5c4a7911b3549333e96"
|
||||||
|
dependencies = [
|
||||||
|
"cap-primitives 0.8.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -934,11 +959,11 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fs-set-times"
|
name = "fs-set-times"
|
||||||
version = "0.2.1"
|
version = "0.2.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4a37c11eb7933093dd2a56c9c4d934a754b56e672fb8c2b46d50997dd2b4392d"
|
checksum = "08b6f6626f73621230f712be2ee1a9e70bf3d7f38ffbd75a80b8ed0d925d1df1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"posish 0.4.1",
|
"posish",
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1509,19 +1534,6 @@ version = "0.1.11"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c917123afa01924fc84bb20c4c03f004d9c38e5127e3c039bbf7f4b9c76a2f6b"
|
checksum = "c917123afa01924fc84bb20c4c03f004d9c38e5127e3c039bbf7f4b9c76a2f6b"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "posish"
|
|
||||||
version = "0.4.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a81e5017f1c873447782cd776e6ec307af670ecad29e934042005a0dec6864dd"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags",
|
|
||||||
"cfg-if 1.0.0",
|
|
||||||
"errno",
|
|
||||||
"itoa",
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "posish"
|
name = "posish"
|
||||||
version = "0.5.2"
|
version = "0.5.2"
|
||||||
@@ -2076,7 +2088,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "95457b1e5a9657ffd02a43048aeb083f20848d82176c0e1313facc1a23ba74da"
|
checksum = "95457b1e5a9657ffd02a43048aeb083f20848d82176c0e1313facc1a23ba74da"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atty",
|
"atty",
|
||||||
"posish 0.5.2",
|
"posish",
|
||||||
"winapi",
|
"winapi",
|
||||||
"winx 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winx 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@@ -2135,6 +2147,7 @@ name = "test-programs"
|
|||||||
version = "0.19.0"
|
version = "0.19.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
"cap-std 0.8.0",
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"os_pipe",
|
"os_pipe",
|
||||||
"pretty_env_logger",
|
"pretty_env_logger",
|
||||||
@@ -2378,7 +2391,7 @@ version = "0.21.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"cap-fs-ext",
|
"cap-fs-ext",
|
||||||
"cap-std",
|
"cap-std 0.8.0",
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"fs-set-times",
|
"fs-set-times",
|
||||||
"getrandom 0.2.0",
|
"getrandom 0.2.0",
|
||||||
@@ -2394,7 +2407,7 @@ name = "wasi-c2-wasmtime"
|
|||||||
version = "0.21.0"
|
version = "0.21.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"cap-std",
|
"cap-std 0.7.0",
|
||||||
"wasi-c2",
|
"wasi-c2",
|
||||||
"wasmtime",
|
"wasmtime",
|
||||||
"wasmtime-wiggle",
|
"wasmtime-wiggle",
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ tempfile = "3.1.0"
|
|||||||
os_pipe = "0.9"
|
os_pipe = "0.9"
|
||||||
anyhow = "1.0.19"
|
anyhow = "1.0.19"
|
||||||
wat = "1.0.23"
|
wat = "1.0.23"
|
||||||
|
cap-std = "0.8"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
test_programs = []
|
test_programs = []
|
||||||
|
|||||||
@@ -144,7 +144,11 @@ mod wasi_tests {
|
|||||||
let workspace = if no_preopens(testsuite, stemstr) {
|
let workspace = if no_preopens(testsuite, stemstr) {
|
||||||
"None"
|
"None"
|
||||||
} else {
|
} else {
|
||||||
"Some(std::path::Path::new(&bin_name))"
|
writeln!(
|
||||||
|
out,
|
||||||
|
" let workspace = utils::prepare_workspace(&bin_name)?;"
|
||||||
|
)?;
|
||||||
|
"Some(workspace.path())"
|
||||||
};
|
};
|
||||||
writeln!(
|
writeln!(
|
||||||
out,
|
out,
|
||||||
|
|||||||
@@ -14,22 +14,13 @@ pub fn instantiate(data: &[u8], bin_name: &str, workspace: Option<&Path>) -> any
|
|||||||
|
|
||||||
builder.arg(bin_name)?.arg(".")?.inherit_stdio();
|
builder.arg(bin_name)?.arg(".")?.inherit_stdio();
|
||||||
|
|
||||||
/*
|
if let Some(workspace) = workspace {
|
||||||
if let Some(workspace) = workspace {
|
let dirfd =
|
||||||
match preopen_type {
|
File::open(workspace).context(format!("error while preopening {:?}", workspace))?;
|
||||||
PreopenType::OS => {
|
let preopen_dir = unsafe { cap_std::fs::Dir::from_std_file(dirfd) };
|
||||||
let preopen_dir = wasi_common::preopen_dir(workspace)
|
builder.preopened_dir(Box::new(preopen_dir), ".")?;
|
||||||
.context(format!("error while preopening {:?}", workspace))?;
|
}
|
||||||
builder.preopened_dir(preopen_dir, ".");
|
|
||||||
}
|
|
||||||
PreopenType::Virtual => {
|
|
||||||
// we can ignore the workspace path for virtual preopens because virtual preopens
|
|
||||||
// don't exist in the filesystem anyway - no name conflict concerns.
|
|
||||||
builder.preopened_virt(VirtualDirEntry::empty_directory(), ".");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/*
|
/*
|
||||||
// The nonstandard thing we do with `WasiCtxBuilder` is to ensure that
|
// The nonstandard thing we do with `WasiCtxBuilder` is to ensure that
|
||||||
// `stdin` is always an unreadable pipe. This is expected in the test suite
|
// `stdin` is always an unreadable pipe. This is expected in the test suite
|
||||||
|
|||||||
Reference in New Issue
Block a user