Fix path_open_read_without_rights test

Fixes `path_open_read_without_rights` test making the CI green again.
This commit is contained in:
Jakub Konka
2020-01-09 21:16:31 +01:00
parent 4e0c1c08c1
commit 036fd8ead5

View File

@@ -1,6 +1,6 @@
use std::{env, process};
use wasi_tests::open_scratch_directory;
use wasi_tests::{drop_rights, fd_get_rights, create_file};
use wasi_tests::{create_file, drop_rights, fd_get_rights};
const TEST_FILENAME: &'static str = "file";
@@ -27,8 +27,13 @@ unsafe fn try_read_file(dir_fd: wasi::Fd) {
};
// Since we no longer have the right to fd_read, trying to read a file
// should be an error.
let err = wasi::fd_read(fd, &[iovec]).expect_err("reading bytes from file should fail");
assert_eq!(err, wasi::ERRNO_NOTCAPABLE, "the errno should be ENOTCAPABLE");
assert_eq!(
wasi::fd_read(fd, &[iovec])
.expect_err("reading bytes from file should fail")
.raw_error(),
wasi::ERRNO_NOTCAPABLE,
"the errno should be ENOTCAPABLE"
);
}
unsafe fn test_read_rights(dir_fd: wasi::Fd) {