From c54ade1fdb1e0cd6d44314a9d0f2532e647f2c38 Mon Sep 17 00:00:00 2001 From: Eduardo Rodrigues <16357187+eduardomourar@users.noreply.github.com> Date: Wed, 14 Oct 2026 01:27:02 +0100 Subject: [PATCH] tests(readlink): enable wasi integration tests --- .github/workflows/wasi.yml | 4 ++-- tests/by-util/test_readlink.rs | 23 ++++++++++++++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/wasi.yml b/.github/workflows/wasi.yml index f9980e56d63..3a8c78f4159 100644 --- a/.github/workflows/wasi.yml +++ b/.github/workflows/wasi.yml @@ -65,7 +65,7 @@ jobs: # caret diagnostics; the host test crate does have them, hence the # not(wasi_runner) in the cfg guarding every `mod diagnostics`. # TODO: add integration tests for these tools as WASI support is extended: - # csplit fmt ls mv readlink + # csplit fmt ls mv # rm seq sort split tsort # nproc is not part of the default feature set, so it needs to be # requested explicitly for the host test crate to compile its tests. @@ -81,7 +81,7 @@ jobs: test_md5sum:: test_mkdir:: test_mktemp:: test_nl:: test_nproc:: test_numfmt:: test_od:: \ test_mv::test_mv_dir_into_file_where_both_are_files \ test_paste:: test_pathchk:: test_pr:: test_printenv:: test_printf:: test_ptx:: \ - test_pwd:: test_realpath:: test_rmdir:: test_sha1sum:: test_sha224sum:: test_sha256sum:: \ + test_pwd:: test_readlink:: test_realpath:: test_rmdir:: test_sha1sum:: test_sha224sum:: test_sha256sum:: \ test_sha384sum:: test_sha512sum:: test_shred:: test_shuf:: test_sleep:: \ test_sum:: test_tail:: test_tee:: \ test_test:: test_touch:: test_tr:: test_true:: test_truncate:: test_uname:: \ diff --git a/tests/by-util/test_readlink.rs b/tests/by-util/test_readlink.rs index e4cbc5ad9b0..c374515df6e 100644 --- a/tests/by-util/test_readlink.rs +++ b/tests/by-util/test_readlink.rs @@ -33,7 +33,7 @@ fn test_resolve() { let (at, mut ucmd) = at_and_ucmd!(); at.touch("foo"); - at.symlink_file("foo", "bar"); + at.relative_symlink_file("foo", "bar"); ucmd.arg("bar").succeeds().stdout_contains("foo\n"); } @@ -81,6 +81,10 @@ fn test_canonicalize_existing_keeps_going_after_a_missing_operand() { } #[test] +#[cfg_attr( + wasi_runner, + ignore = "WASI sandbox: canonicalized path resolves to the guest's virtual root, not the host's absolute path" +)] fn test_canonicalize() { let (at, mut ucmd) = at_and_ucmd!(); let actual = ucmd.arg("-f").arg(".").succeeds().stdout_move_str(); @@ -91,6 +95,10 @@ fn test_canonicalize() { } #[test] +#[cfg_attr( + wasi_runner, + ignore = "WASI sandbox: canonicalized path resolves to the guest's virtual root, not the host's absolute path" +)] fn test_canonicalize_existing() { let (at, mut ucmd) = at_and_ucmd!(); let actual = ucmd.arg("-e").arg(".").succeeds().stdout_move_str(); @@ -101,6 +109,10 @@ fn test_canonicalize_existing() { } #[test] +#[cfg_attr( + wasi_runner, + ignore = "WASI sandbox: canonicalized path resolves to the guest's virtual root, not the host's absolute path" +)] fn test_canonicalize_missing() { let (at, mut ucmd) = at_and_ucmd!(); let actual = ucmd.arg("-m").arg(GIBBERISH).succeeds().stdout_move_str(); @@ -112,6 +124,10 @@ fn test_canonicalize_missing() { #[test] #[cfg(unix)] +#[cfg_attr( + wasi_runner, + ignore = "WASI sandbox: canonicalized path resolves to the guest's virtual root, not the host's absolute path" +)] fn test_canonicalize_symlink_before_parentdir() { // GNU readlink follows the symlink first and only then evaluates `..`. // Logical resolution would collapse `link/..` up front and return the current directory instead. @@ -126,6 +142,10 @@ fn test_canonicalize_symlink_before_parentdir() { } #[test] +#[cfg_attr( + wasi_runner, + ignore = "WASI sandbox: canonicalized path resolves to the guest's virtual root, not the host's absolute path" +)] fn test_long_redirection_to_current_dir() { let (at, mut ucmd) = at_and_ucmd!(); // Create a 256-character path to current directory @@ -488,6 +508,7 @@ fn test_delimiters() { #[test] #[cfg(target_os = "linux")] +#[cfg_attr(wasi_runner, ignore = "WASI: argv/filenames must be valid UTF-8")] fn test_readlink_non_utf8_paths() { use std::ffi::OsStr; use std::os::unix::ffi::OsStrExt;