Skip to content

Commit

Permalink
Fix fd_advise signature in fyi test
Browse files Browse the repository at this point in the history
  • Loading branch information
yagehu authored and theduke committed Apr 15, 2024
1 parent ee7a8ea commit a28b1f1
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions tests/wasi-fyi/fd_advise_validity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::os::fd::AsRawFd;

#[link(wasm_import_module = "wasi_snapshot_preview1")]
extern "C" {
pub fn fd_advise(arg0: i32, arg1: i64, arg2: i64, arg3: i32) -> i32;
pub fn fd_advise(arg0: i32, arg1: u64, arg2: u64, arg3: i32) -> i32;
}

const ERRNO_BADF: i32 = 8;
Expand All @@ -20,12 +20,7 @@ fn main() {

let f = std::fs::File::create("test.sh").unwrap();

let errno = fd_advise(
f.as_raw_fd(),
i64::MAX,
i64::MAX,
ADVISE_WILLNEED,
);
let errno = fd_advise(f.as_raw_fd(), u64::MAX, u64::MAX, ADVISE_WILLNEED);
assert_eq!(
errno, ERRNO_INVAL,
"fd_advise with invalid overflowing offset + length should fail with errno 28 (INVAL)"
Expand Down

0 comments on commit a28b1f1

Please sign in to comment.