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:
@@ -1,21 +1,17 @@
|
||||
use std::{env, process};
|
||||
use wasi_tests::open_scratch_directory_new;
|
||||
use wasi_tests::open_scratch_directory;
|
||||
|
||||
unsafe fn test_dangling_symlink(dir_fd: wasi::Fd) {
|
||||
// First create a dangling symlink.
|
||||
assert!(
|
||||
wasi::path_symlink("target", dir_fd, "symlink").is_ok(),
|
||||
"creating a symlink"
|
||||
);
|
||||
wasi::path_symlink("target", dir_fd, "symlink").expect("creating a symlink");
|
||||
|
||||
// Try to open it as a directory with O_NOFOLLOW.
|
||||
let status = wasi::path_open(dir_fd, 0, "symlink", wasi::OFLAGS_DIRECTORY, 0, 0, 0)
|
||||
.err()
|
||||
.expect("failed to open symlink");
|
||||
assert_eq!(
|
||||
status.raw_error(),
|
||||
wasi::path_open(dir_fd, 0, "symlink", wasi::OFLAGS_DIRECTORY, 0, 0, 0)
|
||||
.expect_err("opening a dangling symlink as a directory")
|
||||
.raw_error(),
|
||||
wasi::ERRNO_LOOP,
|
||||
"opening a dangling symlink as a directory",
|
||||
"errno should be ERRNO_LOOP",
|
||||
);
|
||||
|
||||
// Clean up.
|
||||
@@ -33,7 +29,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);
|
||||
|
||||
Reference in New Issue
Block a user