Skip to content

Commit 69909df

Browse files
committed
move WASI skip list from workflow into test annotations
1 parent 9ec7893 commit 69909df

26 files changed

Lines changed: 108 additions & 64 deletions

.github/workflows/wasi.yml

Lines changed: 5 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,14 @@ jobs:
4141
UTILS=$(./util/show-utils.sh | tr ' ' '\n' | grep -vE "^($EXCLUDE)$" | sed 's/^/-p uu_/' | tr '\n' ' ')
4242
cargo test --target wasm32-wasip1 --no-default-features $UTILS
4343
- name: Run integration tests via wasmtime
44+
env:
45+
RUSTFLAGS: --cfg wasi_runner
4446
run: |
4547
# Build the WASI binary
4648
cargo build --target wasm32-wasip1 --no-default-features --features feat_wasm
4749
# Run host-compiled integration tests against the WASI binary.
50+
# Tests incompatible with WASI are annotated with
51+
# #[cfg_attr(wasi_runner, ignore)] in the test source files.
4852
# TODO: add integration tests for these tools as WASI support is extended:
4953
# arch b2sum cat cksum cp csplit date dir dircolors fmt join ln
5054
# ls md5sum mkdir mv nproc pathchk pr printenv ptx pwd readlink
@@ -60,66 +64,4 @@ jobs:
6064
test_head:: test_link:: test_nl:: test_numfmt:: \
6165
test_od:: test_paste:: test_printf:: test_shuf:: test_sum:: \
6266
test_tee:: test_tr:: test_true:: test_truncate:: \
63-
test_unexpand:: test_unlink:: test_wc:: \
64-
\
65-
`# WASI sandbox: host paths (/proc, /sys, /dev) not visible in guest` \
66-
--skip test_factor::test_parallel \
67-
--skip test_cut::test_too_large \
68-
--skip test_read_backwards_bytes_proc_fs_version \
69-
--skip test_read_backwards_bytes_proc_fs_modules \
70-
--skip test_read_backwards_lines_proc_fs_modules \
71-
--skip test_read_backwards_bytes_sys_kernel_profiling \
72-
--skip test_files_from_pseudo_filesystem \
73-
--skip test_files0_stops_after_stdout_write_error \
74-
--skip test_dev_zero_write_error_dev_full \
75-
--skip test_dev_zero_closed_pipe \
76-
--skip test_simd_respects_glibc_tunables \
77-
--skip test_comm::test_comm_anonymous_pipes \
78-
--skip test_comm::test_read_error \
79-
--skip test_base64::test_read_error \
80-
--skip test_expand::test_read_error \
81-
--skip test_unexpand::test_read_error \
82-
--skip test_od::test_skip_bytes_proc_file_without_seeking \
83-
--skip test_shuf::write_errors_are_reported \
84-
--skip test_tee::linux_only \
85-
--skip test_tee::test_readonly \
86-
\
87-
`# WASI spec: argv/filenames must be valid UTF-8` \
88-
--skip test_invalid_utf8_args \
89-
--skip test_dirname_non_utf8_paths \
90-
--skip test_trailing_dot_non_utf8 \
91-
--skip test_8bit_non_utf8_delimiter \
92-
--skip test_non_utf8_delimiter \
93-
--skip test_echo_invalid_unicode_in_arguments \
94-
--skip mb_invalid_unicode \
95-
--skip non_utf_8_input \
96-
--skip non_utf_8 \
97-
--skip test_octal_escape_ambiguous_followed_by_non_utf8 \
98-
--skip test_truncate_non_utf8_set \
99-
--skip test_output_lossy_utf8 \
100-
--skip non_utf8_paths \
101-
--skip non_utf8_filename \
102-
--skip non_utf8_name \
103-
--skip test_invalid_unicode_in_filename \
104-
--skip test_one_byte_section_delimiter \
105-
--skip test_section_delimiter_non_utf8 \
106-
--skip test_number_separator_non_utf8 \
107-
\
108-
`# WASI: no FIFO/mkfifo support` \
109-
--skip test_fifo_error_reference_file_only \
110-
--skip test_fifo_error_reference_and_size \
111-
--skip test_fifo_error_size_only \
112-
\
113-
`# WASI: no pipe/signal support` \
114-
--skip test_broken_pipe_no_error \
115-
--skip test_tee_output_not_buffered \
116-
\
117-
`# WASI: no subprocess spawning (test shells out or invokes another binary)` \
118-
--skip test_all_but_last_bytes_large_file_piped \
119-
--skip test_all_but_last_lines_large_file \
120-
--skip test_cmd_result_stderr_check_and_stderr_str_check \
121-
\
122-
`# WASI: stdin file position not preserved through wasmtime` \
123-
--skip test_od::test_read_bytes \
124-
--skip test_validate_stdin_offset_lines \
125-
--skip test_validate_stdin_offset_bytes
67+
test_unexpand:: test_unlink:: test_wc::

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,7 @@ workspace = true
718718
unexpected_cfgs = { level = "warn", check-cfg = [
719719
'cfg(fuzzing)',
720720
'cfg(target_os, values("cygwin"))',
721+
'cfg(wasi_runner)',
721722
] }
722723
unused_qualifications = "warn"
723724

docs/src/wasi-test-gaps.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# WASI integration test gaps
2+
3+
Tests annotated with `#[cfg_attr(wasi_runner, ignore = "...")]` are skipped when running integration tests against a WASI binary via wasmtime. This document tracks the reasons so that gaps in WASI support are visible in one place.
4+
5+
To find all annotated tests: `grep -rn 'wasi_runner, ignore' tests/`
6+
7+
## Tools not yet covered by integration tests
8+
9+
arch, b2sum, cat, cksum, cp, csplit, date, dir, dircolors, fmt, join, ln, ls, md5sum, mkdir, mv, nproc, pathchk, pr, printenv, ptx, pwd, readlink, realpath, rm, rmdir, seq, sha1sum, sha224sum, sha256sum, sha384sum, sha512sum, shred, sleep, sort, split, tail, touch, tsort, uname, uniq, vdir, yes
10+
11+
## WASI sandbox: host paths not visible
12+
13+
The WASI guest only sees directories explicitly mapped with `--dir`. Host paths like `/proc`, `/sys`, and `/dev` are not accessible. Affected tests include those that read `/proc/version`, `/proc/modules`, `/proc/cpuinfo`, `/proc/self/mem`, `/sys/kernel/profiling`, `/dev/null`, `/dev/zero`, `/dev/full`, and tests that rely on anonymous pipes or Linux-specific I/O error paths.
14+
15+
## WASI: argv/filenames must be valid UTF-8
16+
17+
The WASI specification requires that argv entries and filenames are valid UTF-8. Tests that pass non-UTF-8 bytes as arguments or create files with non-UTF-8 names cannot run under WASI.
18+
19+
## WASI: no FIFO/mkfifo support
20+
21+
WASI does not support creating or opening FIFOs (named pipes). Tests that use `mkfifo` are skipped.
22+
23+
## WASI: no pipe/signal support
24+
25+
WASI does not support Unix signals or pipe creation. Tests that rely on `SIGPIPE`, broken pipe detection, or pipe-based I/O are skipped.
26+
27+
## WASI: no subprocess spawning
28+
29+
WASI does not support spawning child processes. Tests that shell out to other commands or invoke a second binary are skipped.
30+
31+
## WASI: stdin file position not preserved through wasmtime
32+
33+
When stdin is a seekable file, wasmtime does not preserve the file position between the host and guest. Tests that validate stdin offset behavior after `head` reads are skipped.

tests/by-util/test_base64.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ fn test_version() {
2020

2121
#[test]
2222
#[cfg(target_os = "linux")]
23+
#[cfg_attr(wasi_runner, ignore = "WASI: argv/filenames must be valid UTF-8")]
2324
fn test_base64_non_utf8_paths() {
2425
use std::os::unix::ffi::OsStringExt;
2526
let (at, mut ucmd) = at_and_ucmd!();
@@ -277,6 +278,7 @@ cyBvdmVyIHRoZSBsYXp5IGRvZy4=
277278

278279
#[test]
279280
#[cfg(all(target_os = "linux", not(target_env = "musl")))]
281+
#[cfg_attr(wasi_runner, ignore = "WASI sandbox: host paths not visible")]
280282
fn test_read_error() {
281283
new_ucmd!()
282284
.arg("/proc/self/mem")

tests/by-util/test_basename.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ fn test_too_many_args_output() {
138138

139139
#[cfg(any(unix, target_os = "redox"))]
140140
#[test]
141+
#[cfg_attr(wasi_runner, ignore = "WASI: argv/filenames must be valid UTF-8")]
141142
fn test_invalid_utf8_args() {
142143
let param = uucore::os_str_from_bytes(b"/tmp/some-\xc0-file.k\xf3")
143144
.expect("Only unix platforms can test non-unicode names");

tests/by-util/test_basenc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ fn test_file() {
396396

397397
#[test]
398398
#[cfg(target_os = "linux")]
399+
#[cfg_attr(wasi_runner, ignore = "WASI: argv/filenames must be valid UTF-8")]
399400
fn test_file_with_non_utf8_name() {
400401
use std::os::unix::ffi::OsStringExt;
401402
let (at, mut ucmd) = at_and_ucmd!();

tests/by-util/test_comm.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,7 @@ fn test_comm_eintr_handling() {
658658
}
659659

660660
#[test]
661+
#[cfg_attr(wasi_runner, ignore = "WASI: argv/filenames must be valid UTF-8")]
661662
fn test_output_lossy_utf8() {
662663
let scene = TestScenario::new(util_name!());
663664
let at = &scene.fixtures;
@@ -683,6 +684,7 @@ fn test_output_lossy_utf8() {
683684

684685
#[test]
685686
#[cfg(any(target_os = "linux", target_os = "android"))]
687+
#[cfg_attr(wasi_runner, ignore = "WASI sandbox: host paths not visible")]
686688
fn test_comm_anonymous_pipes() {
687689
use std::{io::Write, os::fd::AsRawFd, process};
688690
use uucore::pipes::pipe;
@@ -722,6 +724,7 @@ fn test_comm_anonymous_pipes() {
722724

723725
#[test]
724726
#[cfg(all(target_os = "linux", not(target_env = "musl")))]
727+
#[cfg_attr(wasi_runner, ignore = "WASI sandbox: host paths not visible")]
725728
fn test_read_error() {
726729
new_ucmd!()
727730
.arg("/proc/self/mem")

tests/by-util/test_cut.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ fn test_delimiter_with_byte_and_char() {
137137
}
138138

139139
#[test]
140+
#[cfg_attr(wasi_runner, ignore = "WASI sandbox: host paths not visible")]
140141
fn test_too_large() {
141142
new_ucmd!()
142143
.args(&["-b1-18446744073709551615", "/dev/null"])
@@ -569,6 +570,7 @@ fn test_multiple_mode_args() {
569570

570571
#[test]
571572
#[cfg(unix)]
573+
#[cfg_attr(wasi_runner, ignore = "WASI: argv/filenames must be valid UTF-8")]
572574
fn test_8bit_non_utf8_delimiter() {
573575
use std::ffi::OsStr;
574576
use std::os::unix::ffi::OsStrExt;
@@ -635,6 +637,7 @@ fn test_failed_write_is_reported() {
635637

636638
#[test]
637639
#[cfg(target_os = "linux")]
640+
#[cfg_attr(wasi_runner, ignore = "WASI: argv/filenames must be valid UTF-8")]
638641
fn test_cut_non_utf8_paths() {
639642
use std::fs::File;
640643
use std::io::Write;

tests/by-util/test_dirname.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ fn test_empty() {
7272

7373
#[test]
7474
#[cfg(unix)]
75+
#[cfg_attr(wasi_runner, ignore = "WASI: argv/filenames must be valid UTF-8")]
7576
fn test_dirname_non_utf8_paths() {
7677
use std::ffi::OsStr;
7778
use std::os::unix::ffi::OsStrExt;
@@ -177,6 +178,7 @@ fn test_trailing_dot_emoji() {
177178

178179
#[test]
179180
#[cfg(unix)]
181+
#[cfg_attr(wasi_runner, ignore = "WASI: argv/filenames must be valid UTF-8")]
180182
fn test_trailing_dot_non_utf8() {
181183
use std::ffi::OsStr;
182184
use std::os::unix::ffi::OsStrExt;

tests/by-util/test_echo.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,7 @@ fn multibyte_escape_unicode() {
586586
}
587587

588588
#[test]
589+
#[cfg_attr(wasi_runner, ignore = "WASI: argv/filenames must be valid UTF-8")]
589590
fn non_utf_8_hex_round_trip() {
590591
new_ucmd!()
591592
.args(&["-e", r"\xFF"])
@@ -610,6 +611,7 @@ fn nine_bit_octal() {
610611

611612
#[test]
612613
#[cfg(target_family = "unix")]
614+
#[cfg_attr(wasi_runner, ignore = "WASI: argv/filenames must be valid UTF-8")]
613615
fn non_utf_8() {
614616
use std::ffi::OsStr;
615617
use std::os::unix::ffi::OsStrExt;
@@ -664,6 +666,7 @@ fn test_cmd_result_stdout_check_and_stdout_str_check() {
664666
}
665667

666668
#[test]
669+
#[cfg_attr(wasi_runner, ignore = "WASI: no subprocess spawning")]
667670
fn test_cmd_result_stderr_check_and_stderr_str_check() {
668671
let ts = TestScenario::new("echo");
669672

0 commit comments

Comments
 (0)