Update WASI tests to use wasi crate v0.9.0 (#743)

This commit updates _all_ WASI test programs to use the latest
version of the `wasi` crate (`v0.9.0`). While at it, it also
unifies asserting error conditions across all test programs.
This commit is contained in:
Jakub Konka
2019-12-24 22:04:15 +01:00
committed by Dan Gohman
parent 907e7aac01
commit 51f3ac0c45
37 changed files with 862 additions and 1860 deletions

View File

@@ -1,7 +1,6 @@
use libc;
use more_asserts::assert_gt;
use std::{env, process};
use wasi_tests::open_scratch_directory_new;
use wasi_tests::open_scratch_directory;
unsafe fn test_fd_advise(dir_fd: wasi::Fd) {
// Create a file in the scratch directory.
@@ -26,10 +25,7 @@ unsafe fn test_fd_advise(dir_fd: wasi::Fd) {
assert_eq!(stat.size, 0, "file size should be 0");
// Allocate some size
assert!(
wasi::fd_allocate(file_fd, 0, 100).is_ok(),
"allocating size"
);
wasi::fd_allocate(file_fd, 0, 100).expect("allocating size");
let stat = wasi::fd_filestat_get(file_fd).expect("failed to fdstat 2");
assert_eq!(stat.size, 100, "file size should be 100");
@@ -51,7 +47,7 @@ fn main() {
};
// Open scratch directory
let dir_fd = match open_scratch_directory_new(&arg) {
let dir_fd = match open_scratch_directory(&arg) {
Ok(dir_fd) => dir_fd,
Err(err) => {
eprintln!("{}", err);