diff --git a/tests/wasi-wast/wasi/nightly_2022_10_18/fd_rights.wasm b/tests/wasi-wast/wasi/nightly_2022_10_18/fd_rights.wasm index 431cb187b6c..e970c3bf8e6 100755 Binary files a/tests/wasi-wast/wasi/nightly_2022_10_18/fd_rights.wasm and b/tests/wasi-wast/wasi/nightly_2022_10_18/fd_rights.wasm differ diff --git a/tests/wasi-wast/wasi/nightly_2022_10_18/fd_rights.wast b/tests/wasi-wast/wasi/nightly_2022_10_18/fd_rights.wast index 13bf6720b86..6499e164aec 100644 --- a/tests/wasi-wast/wasi/nightly_2022_10_18/fd_rights.wast +++ b/tests/wasi-wast/wasi/nightly_2022_10_18/fd_rights.wast @@ -1,5 +1,6 @@ ;; This file was generated by https://github.com/wasmerio/wasi-tests (wasi_test "fd_rights.wasm" + (temp_dirs ".") (assert_return (i64.const 0)) ) diff --git a/tests/wasi-wast/wasi/tests/fd_rights.rs b/tests/wasi-wast/wasi/tests/fd_rights.rs index a11194b61f3..5ab1c2063eb 100644 --- a/tests/wasi-wast/wasi/tests/fd_rights.rs +++ b/tests/wasi-wast/wasi/tests/fd_rights.rs @@ -1,14 +1,27 @@ +// WASI: +// tempdir: . + use std::io::{Read, Write}; +use std::path::PathBuf; fn main() { + let file = { + let mut base = PathBuf::from("."); + + base.push("foo.txt"); + base + }; + let mut filehandle = std::fs::OpenOptions::new() .read(false) // <- should only be writeable, not readable .write(true) .create(true) - .open("foo.txt") + .open(&file) .unwrap(); filehandle.write_all(b"test"); let mut contents = String::new(); assert!(filehandle.read_to_string(&mut contents).is_err()); + + std::fs::remove_file(&file).unwrap(); }