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 @@ -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.
Expand All @@ -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:: \
Expand Down
23 changes: 22 additions & 1 deletion tests/by-util/test_readlink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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;
Expand Down
Loading