Start to update the wasi crate in wasi tests (#675)
* Move `wasi` to `wasi_old` in wasi-tests Leave space for the new `wasi` crate but allow us to incrementally update tests. * Update the big_random_buf test * Update clock_time_get test * Update close_preopen test * Review comments * Update to latest Wasmtime API
This commit is contained in:
committed by
Jakub Konka
parent
51f880f625
commit
e13fabb276
@@ -1,12 +1,9 @@
|
||||
use wasi::wasi_unstable;
|
||||
|
||||
fn test_big_random_buf() {
|
||||
let mut buf = Vec::new();
|
||||
buf.resize(1024, 0);
|
||||
assert!(
|
||||
wasi_unstable::random_get(&mut buf).is_ok(),
|
||||
"calling get_random on a large buffer"
|
||||
);
|
||||
unsafe {
|
||||
wasi::random_get(buf.as_mut_ptr(), 1024).expect("failed to call random_get");
|
||||
}
|
||||
// Chances are pretty good that at least *one* byte will be non-zero in
|
||||
// any meaningful random function producing 1024 u8 values.
|
||||
assert!(buf.iter().any(|x| *x != 0), "random_get returned all zeros");
|
||||
|
||||
Reference in New Issue
Block a user