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 # Linux
* path_rename_trailing_slashes * path_rename_file_trailing_slashes
- trailing slash behavior of files is wrong: trailing slashes are ignored, - trailing slash behavior of files is wrong: trailing slashes are ignored,
should cause an error. should cause an error.
* remove_directory_trailing_slashes * remove_directory_trailing_slashes
- cap-std Dir::remove_dir gives EINVAL when trying to remove dir with - cap-std Dir::remove_dir gives EINVAL when trying to remove dir with
trailing slash. otherwise, everything passes. trailing slash. otherwise, everything passes.
* path_filestat
- symlink mtim doesnt match expectations
# Windows # Windows
@@ -43,7 +41,11 @@
* interesting_paths * interesting_paths
- on windows, opening a directory with a trailing slash fails. - 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 * path_symlink_trailing_slashes
- dangling symlinks are not supported, different errnos in four spots
* remove_directory_trailing_slashes * remove_directory_trailing_slashes
- different errno in one case
* unlink_file_trailing_slashes * 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}; use wasi_tests::{create_file, open_scratch_directory};
unsafe fn test_path_symlink_trailing_slashes(dir_fd: wasi::Fd) { 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!( assert_eq!(
wasi::path_symlink("source", dir_fd, "target/") wasi::path_symlink("source", dir_fd, "target/")
.expect_err("link destination ending with a slash should fail") .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" "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_symlink("source", dir_fd, "target").expect("link destination ending with a slash");
wasi::path_unlink_file(dir_fd, "target").expect("removing a file"); wasi::path_unlink_file(dir_fd, "target").expect("removing a file");
// Link destination already exists, target has trailing slash. // Link destination already exists, target has trailing slash.
wasi::path_create_directory(dir_fd, "target").expect("creating a directory"); wasi::path_create_directory(dir_fd, "target").expect("creating a directory");
// XXX windows gives NOENT
assert_eq!( assert_eq!(
wasi::path_symlink("source", dir_fd, "target/") wasi::path_symlink("source", dir_fd, "target/")
.expect_err("link destination already exists") .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. // Link destination already exists, target has no trailing slash.
wasi::path_create_directory(dir_fd, "target").expect("creating a directory"); wasi::path_create_directory(dir_fd, "target").expect("creating a directory");
// XXX windows gives NOENT
assert_eq!( assert_eq!(
wasi::path_symlink("source", dir_fd, "target") wasi::path_symlink("source", dir_fd, "target")
.expect_err("link destination already exists") .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. // Link destination already exists, target has trailing slash.
create_file(dir_fd, "target"); create_file(dir_fd, "target");
// XXX windows gives NOENT
let dir_symlink_errno = wasi::path_symlink("source", dir_fd, "target/") let dir_symlink_errno = wasi::path_symlink("source", dir_fd, "target/")
.expect_err("link destination already exists") .expect_err("link destination already exists")
.raw_error(); .raw_error();
assert!( assert!(
dir_symlink_errno == wasi::ERRNO_EXIST || dir_symlink_errno == wasi::ERRNO_NOTDIR, 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"); wasi::path_unlink_file(dir_fd, "target").expect("removing a file");
// Link destination already exists, target has no trailing slash. // Link destination already exists, target has no trailing slash.
create_file(dir_fd, "target"); create_file(dir_fd, "target");
// XXX windows gives NOENT
assert_eq!( assert_eq!(
wasi::path_symlink("source", dir_fd, "target") wasi::path_symlink("source", dir_fd, "target")
.expect_err("link destination already exists") .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"); 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. // Test that removing it with a trailing slash succeeds.
wasi::path_remove_directory(dir_fd, "dir/") wasi::path_remove_directory(dir_fd, "dir/")
.expect("remove_directory with a trailing slash on a directory should succeed"); .expect("remove_directory with a trailing slash on a directory should succeed");
*/
// Create a temporary file. // Create a temporary file.
create_file(dir_fd, "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. // Test that removing it with a trailing slash fails.
// XXX windows behavior here is NOENT instead of NOTDIR
assert_eq!( assert_eq!(
wasi::path_remove_directory(dir_fd, "file/") wasi::path_remove_directory(dir_fd, "file/")
.expect_err("remove_directory with a trailing slash on a file should fail") .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"); wasi::path_create_directory(dir_fd, "dir").expect("creating a directory");
// Test that unlinking it fails. // Test that unlinking it fails.
// XXX windows errno here is ACCES
assert_eq!( assert_eq!(
wasi::path_unlink_file(dir_fd, "dir") wasi::path_unlink_file(dir_fd, "dir")
.expect_err("unlink_file on a directory should fail") .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. // Test that unlinking it with a trailing flash fails.
// XXX windows errno here is ACCES
assert_eq!( assert_eq!(
wasi::path_unlink_file(dir_fd, "dir/") wasi::path_unlink_file(dir_fd, "dir/")
.expect_err("unlink_file on a directory should fail") .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"); create_file(dir_fd, "file");
// Test that unlinking it with a trailing flash fails. // Test that unlinking it with a trailing flash fails.
// XXX windows errno here is NOENT
assert_eq!( assert_eq!(
wasi::path_unlink_file(dir_fd, "file/") wasi::path_unlink_file(dir_fd, "file/")
.expect_err("unlink_file with a trailing slash should fail") .expect_err("unlink_file with a trailing slash should fail")