Deny warnings in the CI by default (#616)
* Deny warnings in the CI by default This commit passes `-D warnings` flag to `rustc` in the Test stage of the CI in order to deny warnings on _all_ tested platforms. * Fix warnings * Fix warnings
This commit is contained in:
1
.github/workflows/main.yml
vendored
1
.github/workflows/main.yml
vendored
@@ -144,6 +144,7 @@ jobs:
|
|||||||
- run: cargo test --features test_programs --all --exclude lightbeam --exclude wasmtime-wasi-c --exclude wasmtime-py -- --nocapture
|
- run: cargo test --features test_programs --all --exclude lightbeam --exclude wasmtime-wasi-c --exclude wasmtime-py -- --nocapture
|
||||||
env:
|
env:
|
||||||
RUST_BACKTRACE: 1
|
RUST_BACKTRACE: 1
|
||||||
|
RUSTFLAGS: "-D warnings"
|
||||||
|
|
||||||
# Build and test lightbeam if we're using the nightly toolchain. Note that
|
# Build and test lightbeam if we're using the nightly toolchain. Note that
|
||||||
# Lightbeam tests fail right now, but we don't want to block on that.
|
# Lightbeam tests fail right now, but we don't want to block on that.
|
||||||
|
|||||||
@@ -5,27 +5,6 @@ use wasi_tests::open_scratch_directory;
|
|||||||
use wasi_tests::utils::{cleanup_dir, cleanup_file, create_dir, create_file};
|
use wasi_tests::utils::{cleanup_dir, cleanup_file, create_dir, create_file};
|
||||||
use wasi_tests::wasi_wrappers::wasi_path_open;
|
use wasi_tests::wasi_wrappers::wasi_path_open;
|
||||||
|
|
||||||
unsafe fn create_or_open(
|
|
||||||
dir_fd: wasi_unstable::Fd,
|
|
||||||
name: &str,
|
|
||||||
flags: wasi_unstable::OFlags,
|
|
||||||
) -> wasi_unstable::Fd {
|
|
||||||
let mut file_fd = wasi_unstable::Fd::max_value() - 1;
|
|
||||||
let mut status = wasi_path_open(dir_fd, 0, name, flags, 0, 0, 0, &mut file_fd);
|
|
||||||
assert_eq!(
|
|
||||||
status,
|
|
||||||
wasi_unstable::raw::__WASI_ESUCCESS,
|
|
||||||
"opening '{}'",
|
|
||||||
name
|
|
||||||
);
|
|
||||||
assert_gt!(
|
|
||||||
file_fd,
|
|
||||||
libc::STDERR_FILENO as wasi_unstable::Fd,
|
|
||||||
"file descriptor range check",
|
|
||||||
);
|
|
||||||
file_fd
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe fn test_dangling_fd(dir_fd: wasi_unstable::Fd) {
|
unsafe fn test_dangling_fd(dir_fd: wasi_unstable::Fd) {
|
||||||
// Create a file, open it, delete it without closing the handle,
|
// Create a file, open it, delete it without closing the handle,
|
||||||
// and then try creating it again
|
// and then try creating it again
|
||||||
@@ -48,7 +27,7 @@ unsafe fn test_dangling_fd(dir_fd: wasi_unstable::Fd) {
|
|||||||
// Now, repeat the same process but for a directory
|
// Now, repeat the same process but for a directory
|
||||||
create_dir(dir_fd, "subdir");
|
create_dir(dir_fd, "subdir");
|
||||||
let mut subdir_fd = wasi_unstable::Fd::max_value() - 1;
|
let mut subdir_fd = wasi_unstable::Fd::max_value() - 1;
|
||||||
let mut status = wasi_path_open(
|
status = wasi_path_open(
|
||||||
dir_fd,
|
dir_fd,
|
||||||
0,
|
0,
|
||||||
"subdir",
|
"subdir",
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ unsafe fn create_or_open(
|
|||||||
flags: wasi_unstable::OFlags,
|
flags: wasi_unstable::OFlags,
|
||||||
) -> wasi_unstable::Fd {
|
) -> wasi_unstable::Fd {
|
||||||
let mut file_fd = wasi_unstable::Fd::max_value() - 1;
|
let mut file_fd = wasi_unstable::Fd::max_value() - 1;
|
||||||
let mut status = wasi_path_open(dir_fd, 0, name, flags, 0, 0, 0, &mut file_fd);
|
let status = wasi_path_open(dir_fd, 0, name, flags, 0, 0, 0, &mut file_fd);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
status,
|
status,
|
||||||
wasi_unstable::raw::__WASI_ESUCCESS,
|
wasi_unstable::raw::__WASI_ESUCCESS,
|
||||||
@@ -30,7 +30,7 @@ unsafe fn create_or_open(
|
|||||||
|
|
||||||
unsafe fn open_link(dir_fd: wasi_unstable::Fd, name: &str) -> wasi_unstable::Fd {
|
unsafe fn open_link(dir_fd: wasi_unstable::Fd, name: &str) -> wasi_unstable::Fd {
|
||||||
let mut file_fd = wasi_unstable::Fd::max_value() - 1;
|
let mut file_fd = wasi_unstable::Fd::max_value() - 1;
|
||||||
let mut status = wasi_path_open(dir_fd, 0, name, 0, 0, 0, 0, &mut file_fd);
|
let status = wasi_path_open(dir_fd, 0, name, 0, 0, 0, 0, &mut file_fd);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
status,
|
status,
|
||||||
wasi_unstable::raw::__WASI_ESUCCESS,
|
wasi_unstable::raw::__WASI_ESUCCESS,
|
||||||
@@ -135,7 +135,7 @@ unsafe fn test_path_link(dir_fd: wasi_unstable::Fd) {
|
|||||||
|
|
||||||
// Create a link to a directory
|
// Create a link to a directory
|
||||||
create_dir(dir_fd, "subdir");
|
create_dir(dir_fd, "subdir");
|
||||||
let subdir_fd = create_or_open(dir_fd, "subdir", wasi_unstable::O_DIRECTORY);
|
create_or_open(dir_fd, "subdir", wasi_unstable::O_DIRECTORY);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
wasi_path_link(dir_fd, 0, "subdir", dir_fd, "link"),
|
wasi_path_link(dir_fd, 0, "subdir", dir_fd, "link"),
|
||||||
Err(wasi_unstable::EPERM),
|
Err(wasi_unstable::EPERM),
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
use libc;
|
|
||||||
use std::mem::MaybeUninit;
|
use std::mem::MaybeUninit;
|
||||||
use std::{env, process};
|
|
||||||
use wasi::wasi_unstable;
|
use wasi::wasi_unstable;
|
||||||
use wasi_tests::wasi_wrappers::wasi_fd_fdstat_get;
|
use wasi_tests::wasi_wrappers::wasi_fd_fdstat_get;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user