Reorganize wasi-misc-tests. (#575)
* Reorganize wasi-misc-tests. Move wasi-misc-tests out of wasi-common, to break a dependency cycle; previously, wasmtime-* depended on wasi-common, but wasi-common dev-dependended on wasmtime-*. Now, wasi-common no longer dev-depends on wasmtime-*; instead, the tests are in their own crate which depends on wasi-common and on wasmtime-*. Also, rename wasi-misc-tests to wasi-tests for simplicity. This also removes the "wasm_tests" feature; it's replaced by the "test-programs" feature. * Update the CI script to use the new feature name. * Update the CI script to use the new feature name in one more place. * Change a `write!` to a `writeln!`.
This commit is contained in:
18
crates/test-programs/wasi-tests/src/bin/big_random_buf.rs
Normal file
18
crates/test-programs/wasi-tests/src/bin/big_random_buf.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
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"
|
||||
);
|
||||
// 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");
|
||||
}
|
||||
|
||||
fn main() {
|
||||
// Run the tests.
|
||||
test_big_random_buf()
|
||||
}
|
||||
Reference in New Issue
Block a user