Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/rust/wasm32-wasip1/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ _WASI_RUST = wasi_manifest(
_RUST_DEPS = [
":wasi_tests",
"//third-party/rust:libc",
"//third-party/rust:wasi",
"//third-party/rust:wasip1",
]

rust_library(
Expand All @@ -27,7 +27,7 @@ rust_library(
deps = [
"//third-party/rust:libc",
"//third-party/rust:once_cell",
"//third-party/rust:wasi",
"//third-party/rust:wasip1",
],
_cxx_toolchain = "toolchains//:rust_linker",
_rust_toolchain = "toolchains//:rust_wasi_p1",
Expand Down
2 changes: 2 additions & 0 deletions tests/rust/wasm32-wasip1/src/bin/big_random_buf.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use wasip1 as wasi;

fn test_big_random_buf() {
let mut buf = Vec::new();
buf.resize(1024, 0);
Expand Down
2 changes: 2 additions & 0 deletions tests/rust/wasm32-wasip1/src/bin/clock_time_get.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use wasip1 as wasi;

unsafe fn test_clock_time_get() {
// Test that clock_time_get succeeds. Even in environments where it's not
// desirable to expose high-precision timers, it should still succeed.
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/close_preopen.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{assert_errno, root_directory};
use wasip1 as wasi;

unsafe fn test_close_preopen(dir_fd: wasi::Fd) {
let pre_fd: wasi::Fd = (libc::STDERR_FILENO + 1) as wasi::Fd;
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/dangling_fd.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{TESTCONFIG, root_directory};
use wasip1 as wasi;

unsafe fn test_dangling_fd(dir_fd: wasi::Fd) {
if TESTCONFIG.support_dangling_filesystem() {
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/dangling_symlink.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{TESTCONFIG, assert_errno, root_directory};
use wasip1 as wasi;

unsafe fn test_dangling_symlink(dir_fd: wasi::Fd) {
if TESTCONFIG.support_dangling_filesystem() {
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/dir_fd_op_failures.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{assert_errno, root_directory};
use wasip1 as wasi;

unsafe fn test_fd_dir_ops(dir_fd: wasi::Fd) {
let stat = wasi::fd_filestat_get(dir_fd).expect("failed to fdstat");
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/directory_seek.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{assert_errno, root_directory};
use wasip1 as wasi;

unsafe fn test_directory_seek(dir_fd: wasi::Fd) {
const DIR_NAME: &str = "directory_seek_dir.cleanup";
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/fd_advise.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::root_directory;
use wasip1 as wasi;

unsafe fn test_fd_advise(dir_fd: wasi::Fd) {
const FILE_NAME: &str = "fd_advise_file.cleanup";
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/fd_fdstat_set_rights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::{env, process};
use wasi_tests::{
assert_errno, create_tmp_dir, drop_rights, fd_get_rights, root_directory, supports_rights,
};
use wasip1 as wasi;

const TEST_FILENAME: &'static str = "file.cleanup";

Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/fd_filestat_set.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::root_directory;
use wasip1 as wasi;

unsafe fn test_fd_filestat_set(dir_fd: wasi::Fd) {
const FILE_NAME: &str = "fd_filestat_set_file.cleanup";
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/fd_flags_set.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::root_directory;
use wasip1 as wasi;

unsafe fn test_fd_fdstat_set_flags(dir_fd: wasi::Fd) {
const FILE_NAME: &str = "fd_flags_set_file.cleanup";
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/fd_readdir.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, mem, process, slice, str};
use wasi_tests::{create_tmp_dir, root_directory};
use wasip1 as wasi;

const BUF_LEN: usize = 256;

Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/file_allocate.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{create_tmp_dir, root_directory};
use wasip1 as wasi;

unsafe fn test_file_allocate(dir_fd: wasi::Fd) {
// Create a file in the scratch directory.
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/file_pread_pwrite.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::convert::TryInto;
use std::{env, process};
use wasi_tests::{create_tmp_dir, root_directory};
use wasip1 as wasi;

unsafe fn test_file_pread_pwrite(dir_fd: wasi::Fd) {
// Create a file in the scratch directory.
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/file_seek_tell.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{assert_errno, create_tmp_dir, root_directory};
use wasip1 as wasi;

unsafe fn test_file_seek_tell(dir_fd: wasi::Fd) {
// Create a file in the scratch directory.
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/file_truncation.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{create_tmp_dir, root_directory};
use wasip1 as wasi;

unsafe fn test_file_truncation(dir_fd: wasi::Fd) {
const FILENAME: &str = "test.txt";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{create_tmp_dir, root_directory};
use wasip1 as wasi;

unsafe fn test_file_unbuffered_write(dir_fd: wasi::Fd) {
// Create and open file for reading
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/fstflags_validate.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::root_directory;
use wasip1 as wasi;

unsafe fn test_fstflags_validate(dir_fd: wasi::Fd) {
const FILE_NAME: &str = "fstflags_validate.cleanup";
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/interesting_paths.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::{env, process};
use wasi::path_create_directory;
use wasi_tests::{assert_errno, create_file, root_directory};
use wasip1 as wasi;

unsafe fn test_interesting_paths(dir_fd: wasi::Fd) {
// Create a directory in the scratch directory.
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/isatty.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{create_tmp_dir, root_directory};
use wasip1 as wasi;

unsafe fn test_isatty(dir_fd: wasi::Fd) {
// Create a file in the scratch directory and test if it's a tty.
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/nofollow_errors.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{assert_errno, create_tmp_dir, root_directory};
use wasip1 as wasi;

unsafe fn test_nofollow_errors(dir_fd: wasi::Fd) {
// Create a directory for the symlink to point to.
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/overwrite_preopen.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{assert_errno, create_tmp_dir, root_directory};
use wasip1 as wasi;

unsafe fn test_overwrite_preopen(dir_fd: wasi::Fd) {
let pre_fd: wasi::Fd = (libc::STDERR_FILENO + 1) as wasi::Fd;
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/path_exists.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{create_file, create_tmp_dir, root_directory};
use wasip1 as wasi;

unsafe fn test_path_exists(dir_fd: wasi::Fd) {
// Create a temporary directory
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/path_filestat.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{assert_errno, create_tmp_dir, root_directory};
use wasip1 as wasi;

unsafe fn test_path_filestat(dir_fd: wasi::Fd) {
let mut fdstat = wasi::fd_fdstat_get(dir_fd).expect("fd_fdstat_get");
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/path_link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::{env, process};
use wasi_tests::{
TESTCONFIG, assert_errno, create_file, create_tmp_dir, root_directory, supports_rights,
};
use wasip1 as wasi;

const TEST_RIGHTS: wasi::Rights = wasi::RIGHTS_FD_READ
| wasi::RIGHTS_PATH_LINK_SOURCE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{assert_errno, create_file, create_tmp_dir, root_directory};
use wasip1 as wasi;

unsafe fn test_path_open_create_existing(dir_fd: wasi::Fd) {
create_file(dir_fd, "file");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{assert_errno, create_tmp_dir, root_directory};
use wasip1 as wasi;

unsafe fn test_dirfd_not_dir(dir_fd: wasi::Fd) {
// Open a file.
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/path_open_missing.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{assert_errno, create_tmp_dir, root_directory};
use wasip1 as wasi;

unsafe fn test_path_open_missing(dir_fd: wasi::Fd) {
assert_errno!(
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/path_open_nonblock.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::root_directory;
use wasip1 as wasi;

unsafe fn try_path_open(dir_fd: wasi::Fd) {
let _fd =
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/path_open_preopen.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use wasip1 as wasi;
unsafe fn find_first_preopened_fd(path: &str) -> Result<wasi::Fd, String> {
let max_fd = (1 << 31) - 1;

Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/path_open_read_write.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{assert_errno, create_file, root_directory};
use wasip1 as wasi;

const TEST_FILENAME: &'static str = "file.cleanup";

Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/path_rename.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{TESTCONFIG, assert_errno, create_file, create_tmp_dir, root_directory};
use wasip1 as wasi;

unsafe fn test_path_rename(dir_fd: wasi::Fd) {
// First, try renaming a dir to nonexistent path
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{create_tmp_dir, root_directory};
use wasip1 as wasi;

unsafe fn test_path_rename_trailing_slashes(dir_fd: wasi::Fd) {
// Test renaming a directory with a trailing slash in the name.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{TESTCONFIG, assert_errno, create_file, create_tmp_dir, root_directory};
use wasip1 as wasi;

unsafe fn test_path_symlink_trailing_slashes(dir_fd: wasi::Fd) {
if TESTCONFIG.support_dangling_filesystem() {
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/poll_oneoff_stdio.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::collections::HashMap;
use std::mem::MaybeUninit;
use wasi_tests::{STDERR_FD, STDIN_FD, STDOUT_FD, assert_errno};
use wasip1 as wasi;

const TIMEOUT: u64 = 200_000_000u64; // 200 milliseconds, required to satisfy slow execution in CI
const CLOCK_ID: wasi::Userdata = 0x0123_45678;
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/readlink.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{create_file, create_tmp_dir, root_directory};
use wasip1 as wasi;

unsafe fn test_readlink(dir_fd: wasi::Fd) {
// Create a file in the scratch directory.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{assert_errno, create_file, root_directory};
use wasip1 as wasi;

const TEST_FILENAME: &'static str = "file.cleanup";
const TEST_DIRNAME: &'static str = "dir.cleanup";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{assert_errno, create_tmp_dir, root_directory};
use wasip1 as wasi;

unsafe fn test_remove_nonempty_directory(dir_fd: wasi::Fd) {
// Create a directory in the scratch directory.
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/renumber.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{assert_errno, create_tmp_dir, root_directory};
use wasip1 as wasi;

unsafe fn test_renumber(dir_fd: wasi::Fd) {
let pre_fd: wasi::Fd = (libc::STDERR_FILENO + 1) as wasi::Fd;
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/sched_yield.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use wasip1 as wasi;
unsafe fn test_sched_yield() {
wasi::sched_yield().expect("sched_yield");
}
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/stdio.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::{env, process};
use wasip1 as wasi;

use wasi_tests::{STDERR_FD, STDIN_FD, STDOUT_FD, create_tmp_dir, root_directory};

Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/symlink_create.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{create_tmp_dir, root_directory};
use wasip1 as wasi;

unsafe fn create_symlink_to_file(dir_fd: wasi::Fd) {
// Create a directory for the symlink to point to.
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/symlink_filestat.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{create_tmp_dir, root_directory};
use wasip1 as wasi;

unsafe fn test_path_filestat(dir_fd: wasi::Fd) {
let fdstat = wasi::fd_fdstat_get(dir_fd).expect("fd_fdstat_get");
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/symlink_loop.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{TESTCONFIG, assert_errno, create_tmp_dir, root_directory};
use wasip1 as wasi;

unsafe fn test_symlink_loop(dir_fd: wasi::Fd) {
if TESTCONFIG.support_dangling_filesystem()
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/bin/truncation_rights.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{assert_errno, create_file, create_tmp_dir, root_directory};
use wasip1 as wasi;

unsafe fn test_truncation_rights(dir_fd: wasi::Fd) {
// Create a file in the scratch directory.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{env, process};
use wasi_tests::{assert_errno, create_file, create_tmp_dir, root_directory};
use wasip1 as wasi;

unsafe fn test_unlink_file_trailing_slashes(dir_fd: wasi::Fd) {
// Create a directory in the scratch directory.
Expand Down
1 change: 1 addition & 0 deletions tests/rust/wasm32-wasip1/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use wasip1 as wasi;
pub mod config;
use once_cell::sync::Lazy;
use wasi::path_create_directory;
Expand Down
2 changes: 1 addition & 1 deletion tests/rust/wasm32-wasip3/src/bin/http-service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl Guest for Component {
.append("content-length", &bytes.len().to_string().into_bytes())
.unwrap();
let (mut body_tx, body_rx) = wit_stream::new();
wit_bindgen::spawn(async move {
wit_bindgen::spawn_local(async move {
let remaining = body_tx.write_all(bytes).await;
assert!(remaining.is_empty());
drop(body_tx);
Expand Down
Loading
Loading