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 .github/workflows/wasi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
# not(wasi_runner) in the cfg guarding every `mod diagnostics`.
# TODO: add integration tests for these tools as WASI support is extended:
# cksum csplit dircolors fmt ls mv readlink
# realpath rm seq sort split tsort
# 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.
UUTESTS_BINARY_PATH="$(pwd)/target/${{ matrix.job.target }}/debug/coreutils.wasm" \
Expand All @@ -76,7 +76,7 @@ jobs:
test_ls::test_ls_al_no_capabilities_insufficient_on_wasi \
test_md5sum:: test_mkdir:: test_mktemp:: test_nl:: test_nproc:: test_numfmt:: test_od:: \
test_paste:: test_pathchk:: test_pr:: test_printenv:: test_printf:: test_ptx:: \
test_pwd:: test_rmdir:: test_sha1sum:: test_sha224sum:: test_sha256sum:: \
test_pwd:: 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:: \
Expand Down
13 changes: 13 additions & 0 deletions tests/by-util/test_realpath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ use std::path::{MAIN_SEPARATOR, Path};
static GIBBERISH: &str = "supercalifragilisticexpialidocious";

#[test]
#[cfg_attr(wasi_runner, ignore = "WASI sandbox: host paths not visible")]
fn test_realpath_current_directory() {
let (at, mut ucmd) = at_and_ucmd!();
let expect = at.root_dir_resolved() + "\n";
ucmd.arg(".").succeeds().stdout_is(expect);
}

#[test]
#[cfg_attr(wasi_runner, ignore = "WASI sandbox: host paths not visible")]
fn test_realpath_long_redirection_to_current_dir() {
let (at, mut ucmd) = at_and_ucmd!();
// Create a 256-character path to current directory
Expand All @@ -41,6 +43,7 @@ fn test_realpath_long_redirection_to_root() {
}

#[test]
#[cfg_attr(wasi_runner, ignore = "WASI sandbox: absolute symlink targets")]
fn test_realpath_file_and_links() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
Expand All @@ -53,6 +56,7 @@ fn test_realpath_file_and_links() {
}

#[test]
#[cfg_attr(wasi_runner, ignore = "WASI sandbox: absolute symlink targets")]
fn test_realpath_file_and_links_zero() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
Expand Down Expand Up @@ -130,6 +134,7 @@ fn test_realpath_file_and_links_strip_zero() {
}

#[test]
#[cfg_attr(wasi_runner, ignore = "WASI sandbox: absolute symlink targets")]
fn test_realpath_physical_mode() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
Expand Down Expand Up @@ -163,6 +168,7 @@ fn test_realpath_logical_mode() {
}

#[test]
#[cfg_attr(wasi_runner, ignore = "WASI sandbox: host paths not visible")]
fn test_realpath_dangling() {
let (at, mut ucmd) = at_and_ucmd!();
at.symlink_file("nonexistent-file", "link");
Expand All @@ -178,6 +184,7 @@ fn test_realpath_dangling() {
}

#[test]
#[cfg_attr(wasi_runner, ignore = "WASI sandbox: absolute symlink targets")]
fn test_realpath_loop() {
let (at, mut ucmd) = at_and_ucmd!();
at.symlink_file("2", "1");
Expand Down Expand Up @@ -225,6 +232,7 @@ fn test_realpath_symlink_follow_limit() {
}

#[test]
#[cfg_attr(wasi_runner, ignore = "WASI sandbox: host paths not visible")]
fn test_realpath_default_allows_final_non_existent() {
let p = Path::new("").join(GIBBERISH);
let (at, mut ucmd) = at_and_ucmd!();
Expand All @@ -239,6 +247,7 @@ fn test_realpath_default_forbids_non_final_non_existent() {
}

#[test]
#[cfg_attr(wasi_runner, ignore = "WASI sandbox: host paths not visible")]
fn test_realpath_existing() {
let (at, mut ucmd) = at_and_ucmd!();
ucmd.arg("-e")
Expand All @@ -261,6 +270,7 @@ fn test_realpath_existing_error_quiet() {
}

#[test]
#[cfg_attr(wasi_runner, ignore = "WASI sandbox: host paths not visible")]
fn test_realpath_missing() {
let p = Path::new("").join(GIBBERISH).join(GIBBERISH);
let (at, mut ucmd) = at_and_ucmd!();
Expand All @@ -272,6 +282,7 @@ fn test_realpath_missing() {
}

#[test]
#[cfg_attr(wasi_runner, ignore = "WASI sandbox: host paths not visible")]
fn test_realpath_when_symlink_is_absolute_and_enoent() {
let (at, mut ucmd) = at_and_ucmd!();

Expand Down Expand Up @@ -303,6 +314,7 @@ fn test_realpath_when_symlink_is_absolute_and_enoent() {
}

#[test]
#[cfg_attr(wasi_runner, ignore = "WASI sandbox: absolute symlink targets")]
fn test_realpath_when_symlink_part_is_missing() {
let (at, mut ucmd) = at_and_ucmd!();

Expand Down Expand Up @@ -557,6 +569,7 @@ fn test_realpath_empty() {

#[test]
#[cfg(target_os = "linux")]
#[cfg_attr(wasi_runner, ignore = "WASI: argv/filenames must be valid UTF-8")]
fn test_realpath_non_utf8_paths() {
use std::ffi::OsStr;
use std::os::unix::ffi::OsStrExt;
Expand Down
Loading