Update wasi-tests to wasi 0.11. (#5488)

This updates the tests to version 0.11 of the wasi bindings. There
aren't any fundamental changes here; this just syncs up with the latest
version so that it's consistent with other users of the wasi APIs.
This commit is contained in:
Dan Gohman
2023-01-03 09:43:04 -06:00
committed by GitHub
parent 0c615365c6
commit a71f679453
28 changed files with 89 additions and 149 deletions

View File

@@ -101,8 +101,7 @@ unsafe fn test_path_link(dir_fd: wasi::Fd) {
assert_errno!(
wasi::path_link(dir_fd, 0, "file", dir_fd, "link")
.expect_err("creating a link to existing path should fail")
.raw_error(),
.expect_err("creating a link to existing path should fail"),
wasi::ERRNO_EXIST
);
wasi::path_unlink_file(dir_fd, "link").expect("removing a file");
@@ -110,8 +109,7 @@ unsafe fn test_path_link(dir_fd: wasi::Fd) {
// Create a link to itself
assert_errno!(
wasi::path_link(dir_fd, 0, "file", dir_fd, "file")
.expect_err("creating a link to itself should fail")
.raw_error(),
.expect_err("creating a link to itself should fail"),
wasi::ERRNO_EXIST
);
@@ -120,8 +118,7 @@ unsafe fn test_path_link(dir_fd: wasi::Fd) {
assert_errno!(
wasi::path_link(dir_fd, 0, "file", dir_fd, "link")
.expect_err("creating a link where target is a directory should fail")
.raw_error(),
.expect_err("creating a link where target is a directory should fail"),
wasi::ERRNO_EXIST
);
wasi::path_remove_directory(dir_fd, "link").expect("removing a dir");
@@ -132,8 +129,7 @@ unsafe fn test_path_link(dir_fd: wasi::Fd) {
assert_errno!(
wasi::path_link(dir_fd, 0, "subdir", dir_fd, "link")
.expect_err("creating a link to a directory should fail")
.raw_error(),
.expect_err("creating a link to a directory should fail"),
wasi::ERRNO_PERM,
wasi::ERRNO_ACCES
);
@@ -143,8 +139,7 @@ unsafe fn test_path_link(dir_fd: wasi::Fd) {
// Create a link to a file with trailing slash
assert_errno!(
wasi::path_link(dir_fd, 0, "file", dir_fd, "link/")
.expect_err("creating a link to a file with trailing slash should fail")
.raw_error(),
.expect_err("creating a link to a file with trailing slash should fail"),
wasi::ERRNO_NOENT
);
@@ -171,8 +166,7 @@ unsafe fn test_path_link(dir_fd: wasi::Fd) {
assert_errno!(
wasi::path_link(dir_fd, 0, "file", dir_fd, "symlink")
.expect_err("creating a link where target is a dangling symlink")
.raw_error(),
.expect_err("creating a link where target is a dangling symlink"),
wasi::ERRNO_EXIST
);
wasi::path_unlink_file(dir_fd, "symlink").expect("removing a symlink");
@@ -189,8 +183,7 @@ unsafe fn test_path_link(dir_fd: wasi::Fd) {
dir_fd,
"link",
)
.expect_err("calling path_link with LOOKUPFLAGS_SYMLINK_FOLLOW should fail")
.raw_error(),
.expect_err("calling path_link with LOOKUPFLAGS_SYMLINK_FOLLOW should fail"),
wasi::ERRNO_INVAL
);