Skip to content

Commit 7427068

Browse files
committed
Annotate more WASI-incompatible tests caught on Linux
1 parent a6187b5 commit 7427068

6 files changed

Lines changed: 57 additions & 0 deletions

File tree

docs/src/wasi-test-gaps.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ The test harness maps the per-test working directory as the guest's `/`. That ma
6868

6969
On WASI, `touch -` returns `UnsupportedPlatformFeature` because the guest cannot reliably locate the host file backing stdout. Tests that exercise `touch -` are skipped.
7070

71+
## WASI: rlimit/setrlimit not supported
72+
73+
WASI has no concept of per-process resource limits, so `setrlimit` (and the `rlimit` crate that wraps it) has no effect. Tests that set `RLIMIT_NOFILE` to verify behaviour under restricted file-descriptor budgets are skipped.
74+
75+
## WASI: sysinfo/meminfo not available
76+
77+
WASI has no `sysinfo`/`/proc/meminfo` equivalent, so features that size buffers as a percentage of system memory (e.g. `sort -S 10%`) cannot resolve the limit and fail. Tests that exercise percentage-based sizing are skipped.
78+
7179
## WASI: errno/error-message mismatches
7280

7381
Several error paths surface different errno values (and therefore different error messages) through wasmtime than on POSIX. Observed cases:

tests/by-util/test_cat.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ fn test_fifo_symlink() {
131131
// TODO(#7542): Re-enable on Android once we figure out why setting limit is broken.
132132
// #[cfg(any(target_os = "linux", target_os = "android"))]
133133
#[cfg(target_os = "linux")]
134+
#[cfg_attr(wasi_runner, ignore = "WASI: rlimit/setrlimit not supported")]
134135
fn test_closes_file_descriptors() {
135136
// Each file creates a pipe, which has two file descriptors.
136137
// If they are not closed then five is certainly too many.
@@ -556,6 +557,7 @@ fn test_dev_random() {
556557
/// Wikipedia says there is support on Linux, FreeBSD, and `NetBSD`.
557558
#[test]
558559
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "netbsd"))]
560+
#[cfg_attr(wasi_runner, ignore = "WASI sandbox: host paths not visible")]
559561
fn test_dev_full() {
560562
let mut proc = new_ucmd!()
561563
.set_stdout(Stdio::piped())
@@ -571,6 +573,7 @@ fn test_dev_full() {
571573

572574
#[test]
573575
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "netbsd"))]
576+
#[cfg_attr(wasi_runner, ignore = "WASI sandbox: host paths not visible")]
574577
fn test_dev_full_show_all() {
575578
let buf_len = 2048;
576579
let mut proc = new_ucmd!()
@@ -593,6 +596,7 @@ fn test_dev_full_show_all() {
593596
// without additional flush output gets reversed.
594597
#[test]
595598
#[cfg(target_os = "linux")]
599+
#[cfg_attr(wasi_runner, ignore = "WASI sandbox: host paths not visible")]
596600
fn test_write_fast_fallthrough_uses_flush() {
597601
const PROC_INIT_CMDLINE: &str = "/proc/1/cmdline";
598602
let cmdline = read_to_string(PROC_INIT_CMDLINE).unwrap();
@@ -746,6 +750,7 @@ fn test_u_ignored() {
746750

747751
#[test]
748752
#[cfg(unix)]
753+
#[cfg_attr(wasi_runner, ignore = "WASI: errno/error-message mismatches")]
749754
fn test_write_fast_read_error() {
750755
use std::os::unix::fs::PermissionsExt;
751756

@@ -766,6 +771,7 @@ fn test_write_fast_read_error() {
766771

767772
#[test]
768773
#[cfg(target_os = "linux")]
774+
#[cfg_attr(wasi_runner, ignore = "WASI: argv/filenames must be valid UTF-8")]
769775
fn test_cat_non_utf8_paths() {
770776
use std::ffi::OsStr;
771777
use std::os::unix::ffi::OsStrExt;
@@ -790,6 +796,7 @@ fn test_cat_non_utf8_paths() {
790796

791797
#[test]
792798
#[cfg(target_os = "linux")]
799+
#[cfg_attr(wasi_runner, ignore = "WASI: cannot detect unsafe overwrite")]
793800
fn test_appending_same_input_output() {
794801
let (at, mut ucmd) = at_and_ucmd!();
795802

tests/by-util/test_comm.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ fn test_is_dir() {
450450
}
451451

452452
#[test]
453+
#[cfg_attr(wasi_runner, ignore = "WASI: no locale data")]
453454
fn test_sorted() {
454455
let scene = TestScenario::new(util_name!());
455456
let at = &scene.fixtures;
@@ -486,6 +487,7 @@ fn test_sorted_check_order() {
486487
}
487488

488489
#[test]
490+
#[cfg_attr(wasi_runner, ignore = "WASI: no locale data")]
489491
fn test_both_inputs_out_of_order() {
490492
let scene = TestScenario::new(util_name!());
491493
let at = &scene.fixtures;
@@ -508,6 +510,7 @@ fn test_both_inputs_out_of_order() {
508510
}
509511

510512
#[test]
513+
#[cfg_attr(wasi_runner, ignore = "WASI: no locale data")]
511514
fn test_both_inputs_out_of_order_last_pair() {
512515
let scene = TestScenario::new(util_name!());
513516
let at = &scene.fixtures;

tests/by-util/test_sort.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ fn test_helper(file_name: &str, possible_args: &[&str]) {
3636
}
3737

3838
#[test]
39+
#[cfg_attr(wasi_runner, ignore = "WASI: sysinfo/meminfo not available")]
3940
fn test_buffer_sizes() {
4041
#[cfg(target_os = "linux")]
4142
let buffer_sizes = ["0", "50K", "50k", "1M", "100M", "0%", "10%"];
@@ -1289,6 +1290,7 @@ fn sort_empty_chunk() {
12891290

12901291
#[test]
12911292
#[cfg(any(target_os = "linux", target_os = "android"))]
1293+
#[cfg_attr(wasi_runner, ignore = "WASI: no subprocess spawning")]
12921294
fn test_compress() {
12931295
new_ucmd!()
12941296
.args(&[
@@ -1305,6 +1307,7 @@ fn test_compress() {
13051307

13061308
#[test]
13071309
#[cfg(any(target_os = "linux", target_os = "android"))]
1310+
#[cfg_attr(wasi_runner, ignore = "WASI: no subprocess spawning")]
13081311
fn test_compress_merge() {
13091312
new_ucmd!()
13101313
.args(&[
@@ -1382,6 +1385,7 @@ fn test_batch_size_invalid() {
13821385
}
13831386

13841387
#[test]
1388+
#[cfg_attr(wasi_runner, ignore = "WASI: rlimit/setrlimit not supported")]
13851389
fn test_batch_size_too_large() {
13861390
let large_batch_size = "18446744073709551616";
13871391
new_ucmd!()
@@ -1418,6 +1422,7 @@ fn test_merge_batch_size() {
14181422
// TODO(#7542): Re-enable on Android once we figure out why setting limit is broken.
14191423
// #[cfg(any(target_os = "linux", target_os = "android"))]
14201424
#[cfg(target_os = "linux")]
1425+
#[cfg_attr(wasi_runner, ignore = "WASI: rlimit/setrlimit not supported")]
14211426
fn test_merge_batch_size_with_limit() {
14221427
use rlimit::Resource;
14231428
// Currently need...
@@ -1782,6 +1787,7 @@ fn test_files0_read_error() {
17821787

17831788
#[cfg(target_os = "linux")]
17841789
#[test]
1790+
#[cfg_attr(wasi_runner, ignore = "WASI sandbox: host paths not visible")]
17851791
// Test for GNU tests/sort/sort-files0-from.pl "empty-non-regular"
17861792
fn test_files0_from_empty_non_regular() {
17871793
new_ucmd!()
@@ -2948,6 +2954,7 @@ fn test_locale_utf8_sort_debug_message() {
29482954

29492955
#[test]
29502956
#[cfg(unix)]
2957+
#[cfg_attr(wasi_runner, ignore = "WASI: no locale data")]
29512958
fn test_failed_to_set_locale_debug_message() {
29522959
let result = new_ucmd!()
29532960
.env("LC_ALL", "not-valid-locale")

tests/by-util/test_tail.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ fn test_n0_with_follow() {
259259
// TODO: Add similar test for windows
260260
#[test]
261261
#[cfg(unix)]
262+
#[cfg_attr(wasi_runner, ignore = "WASI: errno/error-message mismatches")]
262263
fn test_permission_denied() {
263264
use std::os::unix::fs::PermissionsExt;
264265

@@ -279,6 +280,7 @@ fn test_permission_denied() {
279280
// TODO: Add similar test for windows
280281
#[test]
281282
#[cfg(unix)]
283+
#[cfg_attr(wasi_runner, ignore = "WASI: errno/error-message mismatches")]
282284
fn test_permission_denied_multiple() {
283285
use std::os::unix::fs::PermissionsExt;
284286

@@ -327,6 +329,7 @@ fn test_follow_redirect_stdin_name_retry() {
327329
not(target_os = "freebsd"),
328330
not(target_os = "openbsd")
329331
))] // FIXME: for currently not working platforms
332+
#[cfg_attr(wasi_runner, ignore = "WASI: errno/error-message mismatches")]
330333
fn test_stdin_redirect_dir() {
331334
// $ mkdir dir
332335
// $ tail < dir, $ tail - < dir
@@ -765,6 +768,7 @@ fn test_follow_invalid_pid() {
765768
not(target_os = "android"),
766769
not(target_os = "freebsd")
767770
))] // FIXME: for currently not working platforms
771+
#[cfg_attr(wasi_runner, ignore = "WASI: tail follow mode disabled")]
768772
fn test_follow_with_pid() {
769773
use std::process::Command;
770774

@@ -1314,6 +1318,7 @@ fn test_num_with_undocumented_sign_bytes() {
13141318

13151319
#[test]
13161320
#[cfg(unix)]
1321+
#[cfg_attr(wasi_runner, ignore = "WASI sandbox: host paths not visible")]
13171322
fn test_bytes_for_funny_unix_files() {
13181323
// inspired by: gnu/tests/tail-2/tail-c.sh
13191324
let ts = TestScenario::new(util_name!());
@@ -1375,6 +1380,7 @@ fn test_retry2() {
13751380
not(target_os = "freebsd"),
13761381
not(target_os = "openbsd")
13771382
))] // FIXME: for currently not working platforms
1383+
#[cfg_attr(wasi_runner, ignore = "WASI: tail follow mode disabled")]
13781384
fn test_retry3() {
13791385
// inspired by: gnu/tests/tail-2/retry.sh
13801386
// Ensure that `tail --retry --follow=name` waits for the file to appear.
@@ -1420,6 +1426,7 @@ fn test_retry3() {
14201426
not(target_os = "freebsd"),
14211427
not(target_os = "openbsd")
14221428
))] // FIXME: for currently not working platforms
1429+
#[cfg_attr(wasi_runner, ignore = "WASI: tail follow mode disabled")]
14231430
fn test_retry4() {
14241431
// inspired by: gnu/tests/tail-2/retry.sh
14251432
// Ensure that `tail --retry --follow=descriptor` waits for the file to appear.
@@ -1478,6 +1485,7 @@ fn test_retry4() {
14781485
not(target_os = "freebsd"),
14791486
not(target_os = "openbsd")
14801487
))] // FIXME: for currently not working platforms
1488+
#[cfg_attr(wasi_runner, ignore = "WASI: tail follow mode disabled")]
14811489
fn test_retry5() {
14821490
// inspired by: gnu/tests/tail-2/retry.sh
14831491
// Ensure that `tail --follow=descriptor --retry` exits when the file appears untailable.
@@ -1569,6 +1577,7 @@ fn test_retry6() {
15691577
not(target_os = "freebsd"),
15701578
not(target_os = "openbsd")
15711579
))] // FIXME: for currently not working platforms
1580+
#[cfg_attr(wasi_runner, ignore = "WASI: tail follow mode disabled")]
15721581
fn test_retry7() {
15731582
// inspired by: gnu/tests/tail-2/retry.sh
15741583
// Ensure that `tail -F` retries when the file is initially untailable.
@@ -1644,6 +1653,7 @@ fn test_retry7() {
16441653
not(target_os = "freebsd"),
16451654
not(target_os = "openbsd")
16461655
))] // FIXME: for currently not working platforms
1656+
#[cfg_attr(wasi_runner, ignore = "WASI: tail follow mode disabled")]
16471657
fn test_retry8() {
16481658
// Ensure that inotify will switch to polling mode if directory
16491659
// of the watched file was initially missing and later created.
@@ -1713,6 +1723,7 @@ fn test_retry8() {
17131723
not(target_os = "freebsd"),
17141724
not(target_os = "openbsd")
17151725
))] // FIXME: for currently not working platforms
1726+
#[cfg_attr(wasi_runner, ignore = "WASI: tail follow mode disabled")]
17161727
fn test_retry9() {
17171728
// inspired by: gnu/tests/tail-2/inotify-dir-recreate.sh
17181729
// Ensure that inotify will switch to polling mode if directory
@@ -1795,6 +1806,7 @@ fn test_retry9() {
17951806
not(target_os = "freebsd"),
17961807
not(target_os = "openbsd")
17971808
))] // FIXME: for currently not working platforms
1809+
#[cfg_attr(wasi_runner, ignore = "WASI: tail follow mode disabled")]
17981810
fn test_follow_descriptor_vs_rename1() {
17991811
// inspired by: gnu/tests/tail-2/descriptor-vs-rename.sh
18001812
// $ ((rm -f A && touch A && sleep 1 && echo -n "A\n" >> A && sleep 1 && \
@@ -1859,6 +1871,7 @@ fn test_follow_descriptor_vs_rename1() {
18591871
not(target_os = "freebsd"),
18601872
not(target_os = "openbsd")
18611873
))] // FIXME: for currently not working platforms
1874+
#[cfg_attr(wasi_runner, ignore = "WASI: tail follow mode disabled")]
18621875
fn test_follow_descriptor_vs_rename2() {
18631876
// Ensure the headers are correct for --verbose.
18641877
// NOTE: GNU's tail does not update the header from FILE_A to FILE_C after `mv FILE_A FILE_C`
@@ -1912,6 +1925,7 @@ fn test_follow_descriptor_vs_rename2() {
19121925
not(target_os = "freebsd"),
19131926
not(target_os = "openbsd")
19141927
))] // FIXME: for currently not working platforms
1928+
#[cfg_attr(wasi_runner, ignore = "WASI: tail follow mode disabled")]
19151929
fn test_follow_name_retry_headers() {
19161930
// inspired by: "gnu/tests/tail-2/F-headers.sh"
19171931
// Ensure tail -F distinguishes output with the
@@ -2166,6 +2180,7 @@ fn test_follow_name_truncate3() {
21662180
not(target_os = "windows"),
21672181
not(feature = "feat_selinux") // flaky
21682182
))] // FIXME: for currently not working platforms
2183+
#[cfg_attr(wasi_runner, ignore = "WASI: tail follow mode disabled")]
21692184
fn test_follow_name_truncate4() {
21702185
// Truncating a file with the same content it already has should not trigger a truncate event
21712186

@@ -2256,6 +2271,7 @@ fn test_follow_truncate_fast() {
22562271
not(target_os = "freebsd"),
22572272
not(target_os = "openbsd")
22582273
))] // FIXME: for currently not working platforms
2274+
#[cfg_attr(wasi_runner, ignore = "WASI: tail follow mode disabled")]
22592275
fn test_follow_name_move_create1() {
22602276
// This test triggers a move/create event while `tail --follow=name file` is running.
22612277
// ((sleep 2 && mv file backup && sleep 2 && cp backup file &)>/dev/null 2>&1 &) ; tail --follow=name file
@@ -2312,6 +2328,7 @@ fn test_follow_name_move_create1() {
23122328
not(target_os = "freebsd"),
23132329
not(target_os = "openbsd")
23142330
))] // FIXME: for currently not working platforms
2331+
#[cfg_attr(wasi_runner, ignore = "WASI: tail follow mode disabled")]
23152332
fn test_follow_name_move_create2() {
23162333
// inspired by: "gnu/tests/tail-2/inotify-hash-abuse.sh"
23172334
// Exercise an abort-inducing flaw in inotify-enabled tail -F
@@ -2392,6 +2409,7 @@ fn test_follow_name_move_create2() {
23922409
not(target_os = "freebsd"),
23932410
not(target_os = "openbsd")
23942411
))] // FIXME: for currently not working platforms
2412+
#[cfg_attr(wasi_runner, ignore = "WASI: tail follow mode disabled")]
23952413
fn test_follow_name_move1() {
23962414
// This test triggers a move event while `tail --follow=name file` is running.
23972415
// ((sleep 2 && mv file backup &)>/dev/null 2>&1 &) ; tail --follow=name file
@@ -2454,6 +2472,7 @@ fn test_follow_name_move1() {
24542472
not(target_os = "freebsd"),
24552473
not(target_os = "openbsd")
24562474
))] // FIXME: for currently not working platforms
2475+
#[cfg_attr(wasi_runner, ignore = "WASI: tail follow mode disabled")]
24572476
fn test_follow_name_move2() {
24582477
// Like test_follow_name_move1, but move to a name that's already monitored.
24592478

@@ -2542,6 +2561,7 @@ fn test_follow_name_move2() {
25422561
not(target_os = "freebsd"),
25432562
not(target_os = "openbsd")
25442563
))] // FIXME: for currently not working platforms
2564+
#[cfg_attr(wasi_runner, ignore = "WASI: tail follow mode disabled")]
25452565
fn test_follow_name_move_retry1() {
25462566
// Similar to test_follow_name_move1 but with `--retry` (`-F`)
25472567
// This test triggers two move/rename events while `tail --follow=name --retry file` is running.
@@ -2602,6 +2622,7 @@ fn test_follow_name_move_retry1() {
26022622
not(target_os = "freebsd"),
26032623
not(target_os = "openbsd")
26042624
))] // FIXME: for currently not working platforms
2625+
#[cfg_attr(wasi_runner, ignore = "WASI: tail follow mode disabled")]
26052626
fn test_follow_name_move_retry2() {
26062627
// inspired by: "gnu/tests/tail-2/F-vs-rename.sh"
26072628
// Similar to test_follow_name_move2 (move to a name that's already monitored)
@@ -2793,6 +2814,7 @@ fn test_fifo() {
27932814
not(target_os = "freebsd"),
27942815
not(target_os = "openbsd")
27952816
))]
2817+
#[cfg_attr(wasi_runner, ignore = "WASI: no FIFO/mkfifo support")]
27962818
fn test_fifo_with_pid() {
27972819
use std::process::{Command, Stdio};
27982820

@@ -4132,6 +4154,7 @@ fn test_args_when_settings_check_warnings_then_shows_warnings() {
41324154
/// TODO: Write similar tests for windows
41334155
#[test]
41344156
#[cfg(target_os = "linux")]
4157+
#[cfg_attr(wasi_runner, ignore = "WASI: tail follow mode disabled")]
41354158
fn test_args_when_settings_check_warnings_follow_indefinitely_then_warning() {
41364159
let scene = TestScenario::new(util_name!());
41374160

@@ -4632,6 +4655,7 @@ fn test_args_when_directory_given_shorthand_big_f_together_with_retry() {
46324655
not(target_os = "openbsd"),
46334656
not(feature = "feat_selinux") // flaky
46344657
))]
4658+
#[cfg_attr(wasi_runner, ignore = "WASI: tail follow mode disabled")]
46354659
fn test_follow_when_files_are_pointing_to_same_relative_file_and_file_stays_same_size() {
46364660
let scene = TestScenario::new(util_name!());
46374661
let at = &scene.fixtures;
@@ -5002,6 +5026,7 @@ fn test_obsolete_encoding_windows() {
50025026

50035027
#[test]
50045028
#[cfg(not(target_vendor = "apple"))] // FIXME: for currently not working platforms
5029+
#[cfg_attr(wasi_runner, ignore = "WASI: tail follow mode disabled")]
50055030
fn test_following_with_pid() {
50065031
use std::process::Command;
50075032

@@ -5121,6 +5146,7 @@ fn test_failed_write_is_reported() {
51215146

51225147
#[test]
51235148
#[cfg(target_os = "linux")]
5149+
#[cfg_attr(wasi_runner, ignore = "WASI sandbox: host paths not visible")]
51245150
fn test_dev_zero() {
51255151
new_ucmd!()
51265152
.args(&["-c", "1", "/dev/zero"])
@@ -5165,6 +5191,7 @@ fn test_follow_pipe_f() {
51655191

51665192
#[test]
51675193
#[cfg(target_os = "linux")]
5194+
#[cfg_attr(wasi_runner, ignore = "WASI: tail follow mode disabled")]
51685195
fn test_follow_stdout_pipe_close() {
51695196
let (at, mut ucmd) = at_and_ucmd!();
51705197
at.write("f", "line1\nline2\n");
@@ -5201,6 +5228,7 @@ fn test_debug_flag_with_polling() {
52015228

52025229
#[test]
52035230
#[cfg(target_os = "linux")]
5231+
#[cfg_attr(wasi_runner, ignore = "WASI: tail follow mode disabled")]
52045232
fn test_debug_flag_with_inotify() {
52055233
let ts = TestScenario::new(util_name!());
52065234
let at = &ts.fixtures;
@@ -5218,6 +5246,7 @@ fn test_debug_flag_with_inotify() {
52185246

52195247
#[test]
52205248
#[cfg(target_os = "linux")]
5249+
#[cfg_attr(wasi_runner, ignore = "WASI: tail follow mode disabled")]
52215250
fn test_follow_dangling_symlink() {
52225251
let (at, mut ucmd) = at_and_ucmd!();
52235252
at.symlink_file("target", "link");
@@ -5232,6 +5261,7 @@ fn test_follow_dangling_symlink() {
52325261

52335262
#[test]
52345263
#[cfg(target_os = "linux")]
5264+
#[cfg_attr(wasi_runner, ignore = "WASI: tail follow mode disabled")]
52355265
fn test_follow_symlink_target_change() {
52365266
let (at, mut ucmd) = at_and_ucmd!();
52375267
at.write("t1", "A\n");

0 commit comments

Comments
 (0)