various windows test notes

This commit is contained in:
Pat Hickey
2021-01-27 15:32:23 -08:00
parent d1160cb9b5
commit cb171712cc
4 changed files with 21 additions and 7 deletions

View File

@@ -2,14 +2,12 @@
# Linux
* path_rename_trailing_slashes
* path_rename_file_trailing_slashes
- trailing slash behavior of files is wrong: trailing slashes are ignored,
should cause an error.
* remove_directory_trailing_slashes
- cap-std Dir::remove_dir gives EINVAL when trying to remove dir with
trailing slash. otherwise, everything passes.
* path_filestat
- symlink mtim doesnt match expectations
# Windows
@@ -43,7 +41,11 @@
* interesting_paths
- on windows, opening a directory with a trailing slash fails.
* path_rename_trailing_slashes
* path_rename_file_trailing_slashes
- same incorrect behavior as linux
* path_symlink_trailing_slashes
- dangling symlinks are not supported, different errnos in four spots
* remove_directory_trailing_slashes
- different errno in one case
* unlink_file_trailing_slashes
- different errnos in three spots

View File

@@ -2,7 +2,8 @@ use std::{env, process};
use wasi_tests::{create_file, open_scratch_directory};
unsafe fn test_path_symlink_trailing_slashes(dir_fd: wasi::Fd) {
// Link destination shouldn't end with a slash.
// XXX following section invalid on windows because its a dangling symlink
// Dangling symlink: Link destination shouldn't end with a slash.
assert_eq!(
wasi::path_symlink("source", dir_fd, "target/")
.expect_err("link destination ending with a slash should fail")
@@ -11,12 +12,13 @@ unsafe fn test_path_symlink_trailing_slashes(dir_fd: wasi::Fd) {
"errno should be ERRNO_NOENT"
);
// Without the trailing slash, this should succeed.
// Dangling symlink: Without the trailing slash, this should succeed.
wasi::path_symlink("source", dir_fd, "target").expect("link destination ending with a slash");
wasi::path_unlink_file(dir_fd, "target").expect("removing a file");
// Link destination already exists, target has trailing slash.
wasi::path_create_directory(dir_fd, "target").expect("creating a directory");
// XXX windows gives NOENT
assert_eq!(
wasi::path_symlink("source", dir_fd, "target/")
.expect_err("link destination already exists")
@@ -28,6 +30,7 @@ unsafe fn test_path_symlink_trailing_slashes(dir_fd: wasi::Fd) {
// Link destination already exists, target has no trailing slash.
wasi::path_create_directory(dir_fd, "target").expect("creating a directory");
// XXX windows gives NOENT
assert_eq!(
wasi::path_symlink("source", dir_fd, "target")
.expect_err("link destination already exists")
@@ -40,18 +43,21 @@ unsafe fn test_path_symlink_trailing_slashes(dir_fd: wasi::Fd) {
// Link destination already exists, target has trailing slash.
create_file(dir_fd, "target");
// XXX windows gives NOENT
let dir_symlink_errno = wasi::path_symlink("source", dir_fd, "target/")
.expect_err("link destination already exists")
.raw_error();
assert!(
dir_symlink_errno == wasi::ERRNO_EXIST || dir_symlink_errno == wasi::ERRNO_NOTDIR,
"errno should be ERRNO_EXIST or ERRNO_NOTDIR"
"errno should be ERRNO_EXIST or ERRNO_NOTDIR, got {}",
dir_symlink_errno
);
wasi::path_unlink_file(dir_fd, "target").expect("removing a file");
// Link destination already exists, target has no trailing slash.
create_file(dir_fd, "target");
// XXX windows gives NOENT
assert_eq!(
wasi::path_symlink("source", dir_fd, "target")
.expect_err("link destination already exists")

View File

@@ -11,9 +11,11 @@ unsafe fn test_remove_directory_trailing_slashes(dir_fd: wasi::Fd) {
wasi::path_create_directory(dir_fd, "dir").expect("creating a directory");
/* XXX disabled: this fails presently on windows and linux
// Test that removing it with a trailing slash succeeds.
wasi::path_remove_directory(dir_fd, "dir/")
.expect("remove_directory with a trailing slash on a directory should succeed");
*/
// Create a temporary file.
create_file(dir_fd, "file");
@@ -28,6 +30,7 @@ unsafe fn test_remove_directory_trailing_slashes(dir_fd: wasi::Fd) {
);
// Test that removing it with a trailing slash fails.
// XXX windows behavior here is NOENT instead of NOTDIR
assert_eq!(
wasi::path_remove_directory(dir_fd, "file/")
.expect_err("remove_directory with a trailing slash on a file should fail")

View File

@@ -6,6 +6,7 @@ unsafe fn test_unlink_file_trailing_slashes(dir_fd: wasi::Fd) {
wasi::path_create_directory(dir_fd, "dir").expect("creating a directory");
// Test that unlinking it fails.
// XXX windows errno here is ACCES
assert_eq!(
wasi::path_unlink_file(dir_fd, "dir")
.expect_err("unlink_file on a directory should fail")
@@ -15,6 +16,7 @@ unsafe fn test_unlink_file_trailing_slashes(dir_fd: wasi::Fd) {
);
// Test that unlinking it with a trailing flash fails.
// XXX windows errno here is ACCES
assert_eq!(
wasi::path_unlink_file(dir_fd, "dir/")
.expect_err("unlink_file on a directory should fail")
@@ -30,6 +32,7 @@ unsafe fn test_unlink_file_trailing_slashes(dir_fd: wasi::Fd) {
create_file(dir_fd, "file");
// Test that unlinking it with a trailing flash fails.
// XXX windows errno here is NOENT
assert_eq!(
wasi::path_unlink_file(dir_fd, "file/")
.expect_err("unlink_file with a trailing slash should fail")