Merge pull request #1810 from Kong/fix/test-programs-tagged-unions
fix(tagged-union): changed test programs to use new tagged union
This commit is contained in:
6
crates/test-programs/wasi-tests/Cargo.lock
generated
6
crates/test-programs/wasi-tests/Cargo.lock
generated
@@ -12,7 +12,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasi"
|
name = "wasi"
|
||||||
version = "0.9.0+wasi-snapshot-preview1"
|
version = "0.10.0+wasi-snapshot-preview1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -21,10 +21,10 @@ version = "0.17.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"more-asserts 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"more-asserts 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"wasi 0.10.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
"checksum libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49"
|
"checksum libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49"
|
||||||
"checksum more-asserts 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238"
|
"checksum more-asserts 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238"
|
||||||
"checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
|
"checksum wasi 0.10.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ publish = false
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libc = "0.2.65"
|
libc = "0.2.65"
|
||||||
wasi = "0.9.0"
|
wasi = "0.10.0"
|
||||||
more-asserts = "0.2.1"
|
more-asserts = "0.2.1"
|
||||||
|
|
||||||
# This crate is built with the wasm32-wasi target, so it's separate
|
# This crate is built with the wasm32-wasi target, so it's separate
|
||||||
|
|||||||
@@ -40,8 +40,12 @@ unsafe fn test_timeout() {
|
|||||||
};
|
};
|
||||||
let r#in = [wasi::Subscription {
|
let r#in = [wasi::Subscription {
|
||||||
userdata: CLOCK_ID,
|
userdata: CLOCK_ID,
|
||||||
r#type: wasi::EVENTTYPE_CLOCK,
|
u: wasi::SubscriptionU {
|
||||||
u: wasi::SubscriptionU { clock },
|
tag: wasi::EVENTTYPE_CLOCK,
|
||||||
|
u: wasi::SubscriptionUU {
|
||||||
|
clock
|
||||||
|
}
|
||||||
|
},
|
||||||
}];
|
}];
|
||||||
let out = poll_oneoff_impl(&r#in, 1);
|
let out = poll_oneoff_impl(&r#in, 1);
|
||||||
let event = &out[0];
|
let event = &out[0];
|
||||||
@@ -74,14 +78,22 @@ unsafe fn test_stdin_read() {
|
|||||||
let r#in = [
|
let r#in = [
|
||||||
wasi::Subscription {
|
wasi::Subscription {
|
||||||
userdata: CLOCK_ID,
|
userdata: CLOCK_ID,
|
||||||
r#type: wasi::EVENTTYPE_CLOCK,
|
u: wasi::SubscriptionU {
|
||||||
u: wasi::SubscriptionU { clock },
|
tag: wasi::EVENTTYPE_CLOCK,
|
||||||
|
u: wasi::SubscriptionUU {
|
||||||
|
clock
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
// Make sure that timeout is returned only once even if there are multiple read events
|
// Make sure that timeout is returned only once even if there are multiple read events
|
||||||
wasi::Subscription {
|
wasi::Subscription {
|
||||||
userdata: 1,
|
userdata: 1,
|
||||||
r#type: wasi::EVENTTYPE_FD_READ,
|
u: wasi::SubscriptionU {
|
||||||
u: wasi::SubscriptionU { fd_readwrite },
|
tag: wasi::EVENTTYPE_FD_READ,
|
||||||
|
u: wasi::SubscriptionUU {
|
||||||
|
fd_read: fd_readwrite
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
let out = poll_oneoff_impl(&r#in, 1);
|
let out = poll_oneoff_impl(&r#in, 1);
|
||||||
@@ -112,16 +124,20 @@ unsafe fn test_stdout_stderr_write() {
|
|||||||
let r#in = [
|
let r#in = [
|
||||||
wasi::Subscription {
|
wasi::Subscription {
|
||||||
userdata: 1,
|
userdata: 1,
|
||||||
r#type: wasi::EVENTTYPE_FD_WRITE,
|
|
||||||
u: wasi::SubscriptionU {
|
u: wasi::SubscriptionU {
|
||||||
fd_readwrite: stdout_readwrite,
|
tag: wasi::EVENTTYPE_FD_WRITE,
|
||||||
|
u: wasi::SubscriptionUU {
|
||||||
|
fd_write: stdout_readwrite
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
wasi::Subscription {
|
wasi::Subscription {
|
||||||
userdata: 2,
|
userdata: 2,
|
||||||
r#type: wasi::EVENTTYPE_FD_WRITE,
|
|
||||||
u: wasi::SubscriptionU {
|
u: wasi::SubscriptionU {
|
||||||
fd_readwrite: stderr_readwrite,
|
tag: wasi::EVENTTYPE_FD_WRITE,
|
||||||
|
u: wasi::SubscriptionUU {
|
||||||
|
fd_write: stderr_readwrite
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -163,13 +179,21 @@ unsafe fn test_fd_readwrite(fd: wasi::Fd, error_code: wasi::Errno) {
|
|||||||
let r#in = [
|
let r#in = [
|
||||||
wasi::Subscription {
|
wasi::Subscription {
|
||||||
userdata: 1,
|
userdata: 1,
|
||||||
r#type: wasi::EVENTTYPE_FD_READ,
|
u: wasi::SubscriptionU {
|
||||||
u: wasi::SubscriptionU { fd_readwrite },
|
tag: wasi::EVENTTYPE_FD_READ,
|
||||||
|
u: wasi::SubscriptionUU {
|
||||||
|
fd_read: fd_readwrite
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
wasi::Subscription {
|
wasi::Subscription {
|
||||||
userdata: 2,
|
userdata: 2,
|
||||||
r#type: wasi::EVENTTYPE_FD_WRITE,
|
u: wasi::SubscriptionU {
|
||||||
u: wasi::SubscriptionU { fd_readwrite },
|
tag: wasi::EVENTTYPE_FD_WRITE,
|
||||||
|
u: wasi::SubscriptionUU {
|
||||||
|
fd_write: fd_readwrite
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
let out = poll_oneoff_impl(&r#in, 2);
|
let out = poll_oneoff_impl(&r#in, 2);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ pub fn open_scratch_directory(path: &str) -> Result<wasi::Fd, String> {
|
|||||||
Ok(s) => s,
|
Ok(s) => s,
|
||||||
Err(_) => break,
|
Err(_) => break,
|
||||||
};
|
};
|
||||||
if stat.pr_type != wasi::PREOPENTYPE_DIR {
|
if stat.tag != wasi::PREOPENTYPE_DIR {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let mut dst = Vec::with_capacity(stat.u.dir.pr_name_len);
|
let mut dst = Vec::with_capacity(stat.u.dir.pr_name_len);
|
||||||
|
|||||||
Reference in New Issue
Block a user