From f730e9f4c2483b9493dfa6fef2bf9977ad3a38f1 Mon Sep 17 00:00:00 2001 From: Sayafdine Said Date: Tue, 26 Mar 2024 13:37:53 +0100 Subject: [PATCH 1/3] refactor: remove old tests files which have been merged --- rust/src/tests/chflags.rs | 11 +- rust/src/tests/chmod.rs | 5 +- rust/src/tests/chown.rs | 21 ++- rust/src/tests/ftruncate.rs | 5 + rust/src/tests/link.rs | 2 + rust/src/tests/mkdir.rs | 4 + rust/src/tests/mkfifo.rs | 3 + rust/src/tests/mknod.rs | 11 +- rust/src/tests/open.rs | 13 +- rust/src/tests/posix_fallocate.rs | 5 + rust/src/tests/rename.rs | 7 +- rust/src/tests/rmdir.rs | 2 + rust/src/tests/symlink.rs | 3 +- rust/src/tests/truncate.rs | 5 +- tests/chflags/00.t | 179 ------------------------- tests/chflags/01.t | 29 ---- tests/chflags/02.t | 29 ---- tests/chflags/03.t | 33 ----- tests/chflags/04.t | 20 --- tests/chflags/06.t | 22 --- tests/chflags/09.t | 67 ---------- tests/chflags/12.t | 69 ---------- tests/chflags/13.t | 15 --- tests/chmod/00.t | 139 ------------------- tests/chmod/01.t | 21 --- tests/chmod/02.t | 31 ----- tests/chmod/03.t | 35 ----- tests/chmod/04.t | 30 ----- tests/chmod/06.t | 30 ----- tests/chmod/09.t | 38 ------ tests/chmod/10.t | 21 --- tests/chmod/11.t | 129 ------------------ tests/chown/01.t | 22 --- tests/chown/02.t | 25 ---- tests/chown/03.t | 29 ---- tests/chown/04.t | 24 ---- tests/chown/06.t | 24 ---- tests/chown/09.t | 33 ----- tests/chown/10.t | 15 --- tests/ftruncate/00.t | 61 --------- tests/ftruncate/13.t | 17 --- tests/granular/00.t | 113 ---------------- tests/granular/01.t | 38 ------ tests/granular/02.t | 145 -------------------- tests/granular/03.t | 135 ------------------- tests/granular/04.t | 46 ------- tests/granular/05.t | 150 --------------------- tests/granular/06.t | 63 --------- tests/link/00.t | 96 -------------- tests/link/01.t | 27 ---- tests/link/02.t | 28 ---- tests/link/03.t | 34 ----- tests/link/04.t | 23 ---- tests/link/05.t | 39 ------ tests/link/08.t | 27 ---- tests/link/09.t | 21 --- tests/link/10.t | 29 ---- tests/link/14.t | 32 ----- tests/link/16.t | 37 ------ tests/link/17.t | 23 ---- tests/mkdir/00.t | 74 ----------- tests/mkdir/01.t | 21 --- tests/mkdir/02.t | 17 --- tests/mkdir/03.t | 21 --- tests/mkdir/04.t | 17 --- tests/mkdir/07.t | 20 --- tests/mkdir/09.t | 30 ----- tests/mkdir/10.t | 22 --- tests/mkdir/12.t | 13 -- tests/mkfifo/00.t | 74 ----------- tests/mkfifo/01.t | 21 --- tests/mkfifo/02.t | 18 --- tests/mkfifo/03.t | 22 --- tests/mkfifo/04.t | 17 --- tests/mkfifo/07.t | 20 --- tests/mkfifo/08.t | 30 ----- tests/mkfifo/09.t | 22 --- tests/mkfifo/12.t | 13 -- tests/mknod/00.t | 76 ----------- tests/mknod/01.t | 25 ---- tests/mknod/02.t | 30 ----- tests/mknod/03.t | 34 ----- tests/mknod/04.t | 19 --- tests/mknod/07.t | 22 --- tests/mknod/08.t | 26 ---- tests/mknod/10.t | 15 --- tests/mknod/11.t | 82 ------------ tests/open/00.t | 100 -------------- tests/open/02.t | 18 --- tests/open/03.t | 22 --- tests/open/04.t | 18 --- tests/open/12.t | 20 --- tests/open/13.t | 25 ---- tests/open/14.t | 33 ----- tests/open/15.t | 28 ---- tests/open/16.t | 25 ---- tests/open/17.t | 16 --- tests/open/18.t | 21 --- tests/open/20.t | 22 --- tests/open/21.t | 13 -- tests/open/22.t | 22 --- tests/open/23.t | 18 --- tests/open/24.t | 32 ----- tests/open/25.t | 24 ---- tests/posix_fallocate/00.t | 59 --------- tests/rename/00.t | 77 ----------- tests/rename/01.t | 24 ---- tests/rename/02.t | 25 ---- tests/rename/03.t | 21 --- tests/rename/11.t | 25 ---- tests/rename/12.t | 25 ---- tests/rename/13.t | 25 ---- tests/rename/14.t | 25 ---- tests/rename/15.t | 35 ----- tests/rename/16.t | 33 ----- tests/rename/17.t | 21 --- tests/rename/18.t | 23 ---- tests/rename/19.t | 23 ---- tests/rename/20.t | 30 ----- tests/rename/21.t | 48 ------- tests/rename/22.t | 38 ------ tests/rename/23.t | 40 ------ tests/rename/24.t | 38 ------ tests/rmdir/00.t | 29 ---- tests/rmdir/01.t | 31 ----- tests/rmdir/02.t | 18 --- tests/rmdir/03.t | 23 ---- tests/rmdir/04.t | 18 --- tests/rmdir/05.t | 20 --- tests/rmdir/06.t | 25 ---- tests/rmdir/12.t | 21 --- tests/rmdir/13.t | 23 ---- tests/rmdir/14.t | 28 ---- tests/rmdir/15.t | 13 -- tests/symlink/00.t | 33 ----- tests/symlink/01.t | 19 --- tests/symlink/02.t | 23 ---- tests/symlink/03.t | 23 ---- tests/symlink/04.t | 17 --- tests/symlink/08.t | 22 --- tests/symlink/10.t | 33 ----- tests/symlink/12.t | 19 --- tests/truncate/00.t | 52 -------- tests/truncate/01.t | 19 --- tests/truncate/02.t | 19 --- tests/truncate/03.t | 23 ---- tests/truncate/04.t | 18 --- tests/truncate/07.t | 20 --- tests/truncate/09.t | 16 --- tests/truncate/10.t | 33 ----- tests/truncate/11.t | 20 --- tests/truncate/13.t | 17 --- tests/truncate/14.t | 13 -- tests/unlink/00.t | 213 ------------------------------ tests/unlink/01.t | 19 --- tests/unlink/02.t | 18 --- tests/unlink/03.t | 22 --- tests/unlink/04.t | 18 --- tests/unlink/07.t | 20 --- tests/unlink/12.t | 28 ---- tests/unlink/13.t | 13 -- tests/unlink/14.t | 33 ----- tests/utimensat/00.t | 36 ----- tests/utimensat/01.t | 56 -------- tests/utimensat/02.t | 35 ----- tests/utimensat/03.t | 39 ------ tests/utimensat/04.t | 36 ----- tests/utimensat/05.t | 53 -------- tests/utimensat/06.t | 46 ------- tests/utimensat/07.t | 51 ------- tests/utimensat/08.t | 40 ------ tests/utimensat/09.t | 35 ----- 172 files changed, 77 insertions(+), 5705 deletions(-) delete mode 100644 tests/chflags/00.t delete mode 100644 tests/chflags/01.t delete mode 100644 tests/chflags/02.t delete mode 100644 tests/chflags/03.t delete mode 100644 tests/chflags/04.t delete mode 100644 tests/chflags/06.t delete mode 100644 tests/chflags/09.t delete mode 100644 tests/chflags/12.t delete mode 100644 tests/chflags/13.t delete mode 100644 tests/chmod/00.t delete mode 100644 tests/chmod/01.t delete mode 100644 tests/chmod/02.t delete mode 100644 tests/chmod/03.t delete mode 100644 tests/chmod/04.t delete mode 100644 tests/chmod/06.t delete mode 100644 tests/chmod/09.t delete mode 100644 tests/chmod/10.t delete mode 100644 tests/chmod/11.t delete mode 100644 tests/chown/01.t delete mode 100644 tests/chown/02.t delete mode 100644 tests/chown/03.t delete mode 100644 tests/chown/04.t delete mode 100644 tests/chown/06.t delete mode 100644 tests/chown/09.t delete mode 100644 tests/chown/10.t delete mode 100644 tests/ftruncate/00.t delete mode 100644 tests/ftruncate/13.t delete mode 100644 tests/granular/00.t delete mode 100644 tests/granular/01.t delete mode 100644 tests/granular/02.t delete mode 100644 tests/granular/03.t delete mode 100644 tests/granular/04.t delete mode 100644 tests/granular/05.t delete mode 100644 tests/granular/06.t delete mode 100644 tests/link/00.t delete mode 100644 tests/link/01.t delete mode 100644 tests/link/02.t delete mode 100644 tests/link/03.t delete mode 100644 tests/link/04.t delete mode 100644 tests/link/05.t delete mode 100644 tests/link/08.t delete mode 100644 tests/link/09.t delete mode 100644 tests/link/10.t delete mode 100644 tests/link/14.t delete mode 100644 tests/link/16.t delete mode 100644 tests/link/17.t delete mode 100644 tests/mkdir/00.t delete mode 100644 tests/mkdir/01.t delete mode 100644 tests/mkdir/02.t delete mode 100644 tests/mkdir/03.t delete mode 100644 tests/mkdir/04.t delete mode 100644 tests/mkdir/07.t delete mode 100644 tests/mkdir/09.t delete mode 100644 tests/mkdir/10.t delete mode 100644 tests/mkdir/12.t delete mode 100644 tests/mkfifo/00.t delete mode 100644 tests/mkfifo/01.t delete mode 100644 tests/mkfifo/02.t delete mode 100644 tests/mkfifo/03.t delete mode 100644 tests/mkfifo/04.t delete mode 100644 tests/mkfifo/07.t delete mode 100644 tests/mkfifo/08.t delete mode 100644 tests/mkfifo/09.t delete mode 100644 tests/mkfifo/12.t delete mode 100644 tests/mknod/00.t delete mode 100644 tests/mknod/01.t delete mode 100644 tests/mknod/02.t delete mode 100644 tests/mknod/03.t delete mode 100644 tests/mknod/04.t delete mode 100644 tests/mknod/07.t delete mode 100644 tests/mknod/08.t delete mode 100644 tests/mknod/10.t delete mode 100644 tests/mknod/11.t delete mode 100644 tests/open/00.t delete mode 100644 tests/open/02.t delete mode 100644 tests/open/03.t delete mode 100644 tests/open/04.t delete mode 100644 tests/open/12.t delete mode 100644 tests/open/13.t delete mode 100644 tests/open/14.t delete mode 100644 tests/open/15.t delete mode 100644 tests/open/16.t delete mode 100644 tests/open/17.t delete mode 100644 tests/open/18.t delete mode 100644 tests/open/20.t delete mode 100644 tests/open/21.t delete mode 100644 tests/open/22.t delete mode 100644 tests/open/23.t delete mode 100644 tests/open/24.t delete mode 100644 tests/open/25.t delete mode 100644 tests/posix_fallocate/00.t delete mode 100644 tests/rename/00.t delete mode 100644 tests/rename/01.t delete mode 100644 tests/rename/02.t delete mode 100644 tests/rename/03.t delete mode 100644 tests/rename/11.t delete mode 100644 tests/rename/12.t delete mode 100644 tests/rename/13.t delete mode 100644 tests/rename/14.t delete mode 100644 tests/rename/15.t delete mode 100644 tests/rename/16.t delete mode 100644 tests/rename/17.t delete mode 100644 tests/rename/18.t delete mode 100644 tests/rename/19.t delete mode 100644 tests/rename/20.t delete mode 100644 tests/rename/21.t delete mode 100644 tests/rename/22.t delete mode 100644 tests/rename/23.t delete mode 100644 tests/rename/24.t delete mode 100644 tests/rmdir/00.t delete mode 100644 tests/rmdir/01.t delete mode 100644 tests/rmdir/02.t delete mode 100644 tests/rmdir/03.t delete mode 100644 tests/rmdir/04.t delete mode 100644 tests/rmdir/05.t delete mode 100644 tests/rmdir/06.t delete mode 100644 tests/rmdir/12.t delete mode 100644 tests/rmdir/13.t delete mode 100644 tests/rmdir/14.t delete mode 100644 tests/rmdir/15.t delete mode 100644 tests/symlink/00.t delete mode 100644 tests/symlink/01.t delete mode 100644 tests/symlink/02.t delete mode 100644 tests/symlink/03.t delete mode 100644 tests/symlink/04.t delete mode 100644 tests/symlink/08.t delete mode 100644 tests/symlink/10.t delete mode 100644 tests/symlink/12.t delete mode 100644 tests/truncate/00.t delete mode 100644 tests/truncate/01.t delete mode 100644 tests/truncate/02.t delete mode 100644 tests/truncate/03.t delete mode 100644 tests/truncate/04.t delete mode 100644 tests/truncate/07.t delete mode 100644 tests/truncate/09.t delete mode 100644 tests/truncate/10.t delete mode 100644 tests/truncate/11.t delete mode 100644 tests/truncate/13.t delete mode 100644 tests/truncate/14.t delete mode 100644 tests/unlink/00.t delete mode 100644 tests/unlink/01.t delete mode 100644 tests/unlink/02.t delete mode 100644 tests/unlink/03.t delete mode 100644 tests/unlink/04.t delete mode 100644 tests/unlink/07.t delete mode 100644 tests/unlink/12.t delete mode 100644 tests/unlink/13.t delete mode 100644 tests/unlink/14.t delete mode 100644 tests/utimensat/00.t delete mode 100644 tests/utimensat/01.t delete mode 100644 tests/utimensat/02.t delete mode 100644 tests/utimensat/03.t delete mode 100644 tests/utimensat/04.t delete mode 100644 tests/utimensat/05.t delete mode 100644 tests/utimensat/06.t delete mode 100644 tests/utimensat/07.t delete mode 100644 tests/utimensat/08.t delete mode 100644 tests/utimensat/09.t diff --git a/rust/src/tests/chflags.rs b/rust/src/tests/chflags.rs index 2ab42098..7bde02bd 100644 --- a/rust/src/tests/chflags.rs +++ b/rust/src/tests/chflags.rs @@ -75,6 +75,7 @@ fn get_flags(ctx: &TestContext) -> (FileFlag, FileFlag, FileFlag) { crate::test_case! { /// chflags(2) set the flags provided for the file. + // chflags/00.t set_flags, root, FileSystemFeature::Chflags => [Regular, Dir, Fifo, Block, Char, Socket] } fn set_flags(ctx: &mut TestContext, ft: FileType) { @@ -106,6 +107,7 @@ fn set_flags(ctx: &mut TestContext, ft: FileType) { crate::test_case! { /// chflags changes flags while following symlinks + // chflags/00.t set_flags_symlink, root, FileSystemFeature::Chflags } fn set_flags_symlink(ctx: &mut TestContext) { @@ -129,6 +131,7 @@ fn set_flags_symlink(ctx: &mut TestContext) { #[cfg(any(target_os = "netbsd", target_os = "freebsd", target_os = "dragonfly"))] crate::test_case! { /// lchflags changes flags without following symlinks + // chflags/00.t lchflags_set_flags_no_follow_symlink, root, FileSystemFeature::Chflags } #[cfg(any(target_os = "netbsd", target_os = "freebsd", target_os = "dragonfly"))] @@ -151,7 +154,8 @@ fn lchflags_set_flags_no_follow_symlink(ctx: &mut TestContext) { } crate::test_case! { - // successful chflags(2) updates ctime + /// successful chflags(2) updates ctime + // chflags/00.t changed_ctime_success, root => [Regular, Dir, Fifo, Block, Char, Socket] } fn changed_ctime_success(ctx: &mut TestContext, ft: FileType) { @@ -181,7 +185,8 @@ fn changed_ctime_success(ctx: &mut TestContext, ft: FileType) { } } crate::test_case! { - // unsuccessful chflags(2) does not update ctime + /// unsuccessful chflags(2) does not update ctime + // chflags/00.t unchanged_ctime_failed, serialized, root => [Regular, Dir, Fifo, Block, Char, Socket] } fn unchanged_ctime_failed(ctx: &mut SerializedTestContext, ft: FileType) { @@ -222,6 +227,8 @@ enotdir_comp_test_case!(chflags(~path, FileFlag::empty())); // chflags/02.t enametoolong_comp_test_case!(chflags(~path, FileFlag::empty())); + +// chflags/03.t enametoolong_path_test_case!(chflags(~path, FileFlag::empty())); // chflags/04.t diff --git a/rust/src/tests/chmod.rs b/rust/src/tests/chmod.rs index df5059bd..ad10ba7b 100644 --- a/rust/src/tests/chmod.rs +++ b/rust/src/tests/chmod.rs @@ -149,7 +149,7 @@ crate::test_case! { /// chmod returns EFTYPE if the effective user ID is not the super-user, /// the mode includes the sticky bit (S_ISVTX), /// and path does not refer to a directory - // chmod/12.t + // chmod/11.t eftype, serialized, root => [Regular, Fifo, Block, Char, Socket] } #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] @@ -198,7 +198,10 @@ fn eftype(ctx: &mut SerializedTestContext, ft: FileType) { mod lchmod { use super::*; + // chmod/01.t enotdir_comp_test_case!(lchmod(~path, Mode::empty())); + + // chmod/04.t enoent_named_file_test_case!(lchmod(~path, Mode::empty())); enoent_comp_test_case!(lchmod(~path, Mode::empty())); diff --git a/rust/src/tests/chown.rs b/rust/src/tests/chown.rs index a19458a4..7b821554 100644 --- a/rust/src/tests/chown.rs +++ b/rust/src/tests/chown.rs @@ -16,8 +16,15 @@ fn chown_wrapper(ctx: &mut TestContext, path: &std::path::Path) -> nix::Result<( chown(path, Some(user.uid), None) } +// chown/01.t enotdir_comp_test_case!(chown, chown_wrapper); +// chown/02.t +enametoolong_comp_test_case!(chown, chown_wrapper); + +// chown/03.t +enametoolong_path_test_case!(chown, chown_wrapper); + // chown/04.t enoent_named_file_test_case!(chown, chown_wrapper); @@ -33,12 +40,6 @@ eloop_comp_test_case!(chown, chown_wrapper); // chown/06.t eloop_final_comp_test_case!(chown, chown_wrapper); -// chown/02.t -enametoolong_comp_test_case!(chown, chown_wrapper); - -// chown/03.t -enametoolong_path_test_case!(chown, chown_wrapper); - // chown/09.t erofs_named_test_case!(chown, chown_wrapper); @@ -56,14 +57,20 @@ mod lchown { lchown(path, Some(user.uid), Some(user.gid)) } + // chown/01.t enotdir_comp_test_case!(lchown, lchown_wrapper); + + // chown/04.t enoent_named_file_test_case!(lchown, lchown_wrapper); enoent_comp_test_case!(lchown, lchown_wrapper); // chown/06.t#L25 eloop_comp_test_case!(lchown, lchown_wrapper); - + + // chown/02.t enametoolong_comp_test_case!(lchown, lchown_wrapper); + + // chown/03.t enametoolong_path_test_case!(lchown, lchown_wrapper); // chown/09.t diff --git a/rust/src/tests/ftruncate.rs b/rust/src/tests/ftruncate.rs index 9453399b..f1fc46c4 100644 --- a/rust/src/tests/ftruncate.rs +++ b/rust/src/tests/ftruncate.rs @@ -17,6 +17,7 @@ use crate::{ crate::test_case! { /// ftruncate should extend a file, and shrink a sparse file + // ftruncate/00.t extend_file_shrink_sparse } fn extend_file_shrink_sparse(ctx: &mut TestContext) { @@ -37,6 +38,7 @@ fn extend_file_shrink_sparse(ctx: &mut TestContext) { crate::test_case! { /// ftruncate should shrink the file if the specified size is less than the actual one + // ftruncate/00.t shrink_not_empty } fn shrink_not_empty(ctx: &mut TestContext) { @@ -62,6 +64,7 @@ fn shrink_not_empty(ctx: &mut TestContext) { crate::test_case! { /// ftruncate should update ctime if it succeeds + // ftruncate/00.t update_ctime_success } fn update_ctime_success(ctx: &mut TestContext) { @@ -74,6 +77,7 @@ fn update_ctime_success(ctx: &mut TestContext) { crate::test_case! { /// ftruncate should not update ctime if it fails + // ftruncate/00.t unchanged_ctime_failed } fn unchanged_ctime_failed(ctx: &mut TestContext) { @@ -88,6 +92,7 @@ crate::test_case! { /// The file mode of a newly created file should not affect whether ftruncate /// will work, only the create args /// https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=154873 + // ftruncate/00.t affected_create_flags_only, serialized, root } fn affected_create_flags_only(ctx: &mut SerializedTestContext) { diff --git a/rust/src/tests/link.rs b/rust/src/tests/link.rs index 9152437d..dd114a5f 100644 --- a/rust/src/tests/link.rs +++ b/rust/src/tests/link.rs @@ -186,6 +186,7 @@ fn has_reasonable_link_max(_: &Config, base_path: &Path) -> anyhow::Result<()> { crate::test_case! { /// link returns EMLINK if the link count of the file named by name1 would exceed {LINK_MAX} + // link/05.t link_count_max; has_reasonable_link_max } fn link_count_max(ctx: &mut TestContext) { @@ -233,6 +234,7 @@ fn enoent_source_not_exists(ctx: &mut TestContext) { crate::test_case! { /// link returns EEXIST if the destination file exists + // link/10.t eexist_dest_exists => [Regular, Dir, Fifo, Block, Char, Socket, Symlink(None)] } fn eexist_dest_exists(ctx: &mut TestContext, ft: FileType) { diff --git a/rust/src/tests/mkdir.rs b/rust/src/tests/mkdir.rs index 033660d6..1e390718 100644 --- a/rust/src/tests/mkdir.rs +++ b/rust/src/tests/mkdir.rs @@ -17,6 +17,7 @@ crate::test_case! { /// POSIX: The file permission bits of the new directory shall be initialized from /// mode. These file permission bits of the mode argument shall be modified by the /// process' file creation mask. + // mkdir/00.t permission_bits_from_mode, serialized } fn permission_bits_from_mode(ctx: &mut SerializedTestContext) { @@ -27,6 +28,7 @@ crate::test_case! { /// POSIX: The directory's user ID shall be set to the process' effective user ID. /// The directory's group ID shall be set to the group ID of the parent directory /// or to the effective group ID of the process. + // mkdir/00.t uid_gid_eq_euid_egid, serialized, root } fn uid_gid_eq_euid_egid(ctx: &mut SerializedTestContext) { @@ -38,6 +40,7 @@ crate::test_case! { /// st_ctime, and st_mtime fields of the directory. Also, the st_ctime and /// st_mtime fields of the directory that contains the new entry shall be marked /// for update. + // mkdir/00.t changed_time_fields_success } fn changed_time_fields_success(ctx: &mut TestContext) { @@ -51,6 +54,7 @@ fn changed_time_fields_success(ctx: &mut TestContext) { }); } +// mkdir/01.t enotdir_comp_test_case!(mkdir(~path, Mode::empty())); // mkdir/02.t diff --git a/rust/src/tests/mkfifo.rs b/rust/src/tests/mkfifo.rs index 4c5d03ed..212c082a 100644 --- a/rust/src/tests/mkfifo.rs +++ b/rust/src/tests/mkfifo.rs @@ -18,6 +18,7 @@ crate::test_case! { /// POSIX: The file permission bits of the new FIFO shall be initialized from /// mode. The file permission bits of the mode argument shall be modified by the /// process' file creation mask. + // mkfifo/00.t permission_bits_from_mode, serialized } fn permission_bits_from_mode(ctx: &mut SerializedTestContext) { @@ -28,6 +29,7 @@ crate::test_case! { /// POSIX: The FIFO's user ID shall be set to the process' effective user ID. /// The FIFO's group ID shall be set to the group ID of the parent directory or to /// the effective group ID of the process. + // mkfifo/00.t uid_gid_eq_euid_egid, serialized, root } fn uid_gid_eq_euid_egid(ctx: &mut SerializedTestContext) { @@ -39,6 +41,7 @@ crate::test_case! { /// st_ctime, and st_mtime fields of the file. Also, the st_ctime and /// st_mtime fields of the directory that contains the new entry shall be marked /// for update. + // mkfifo/00.t changed_time_fields_success } fn changed_time_fields_success(ctx: &mut TestContext) { diff --git a/rust/src/tests/mknod.rs b/rust/src/tests/mknod.rs index 3e34dafb..27dd6c1d 100644 --- a/rust/src/tests/mknod.rs +++ b/rust/src/tests/mknod.rs @@ -22,6 +22,7 @@ crate::test_case! { /// POSIX: The file permission bits of the new FIFO shall be initialized from /// mode. The file permission bits of the mode argument shall be modified by the /// process' file creation mask. + // mknod/00.t permission_bits_from_mode, serialized } fn permission_bits_from_mode(ctx: &mut SerializedTestContext) { @@ -32,6 +33,7 @@ crate::test_case! { /// POSIX: The FIFO's user ID shall be set to the process' effective user ID. /// The FIFO's group ID shall be set to the group ID of the parent directory or to /// the effective group ID of the process. + // mknod/00.t uid_gid_eq_euid_egid, serialized, root } fn uid_gid_eq_euid_egid(ctx: &mut SerializedTestContext) { @@ -43,6 +45,7 @@ crate::test_case! { /// st_ctime, and st_mtime fields of the file. Also, the st_ctime and /// st_mtime fields of the directory that contains the new entry shall be marked /// for update. + // mknod/00.t changed_time_fields_success } fn changed_time_fields_success(ctx: &mut TestContext) { @@ -59,16 +62,17 @@ fn changed_time_fields_success(ctx: &mut TestContext) { // mknod/01.t enotdir_comp_test_case!(mknod(~path, SFlag::S_IFIFO, Mode::empty(), 0)); +// TODO: Move to privileged module crate::test_case! { /// mknod returns ENOTDIR if a component of the path prefix is not a directory /// when trying to create char/block files + // mknod/01.t enotdir_comp_char_block, root => [Regular, Fifo, Block, Char, Socket] } fn enotdir_comp_char_block(ctx: &mut TestContext, ft: FileType) { let base_path = ctx.create(ft).unwrap(); let path = base_path.join("previous_not_dir"); - // mknod/01.t assert_eq!( mknod(&path, SFlag::S_IFCHR, Mode::empty(), 0).unwrap_err(), Errno::ENOTDIR @@ -125,10 +129,12 @@ fn device_files(ctx: &mut TestContext, ft: FileType) { assert!(check(&stat.file_type())); } +// TODO: Move to privileged module and precise that it concerns only block and char crate::test_case! { /// mknod changes st_ctime and st_mtime of the parent directory /// and marks for update the st_atime, st_ctime and st_mtime fields /// of the new file + // mknod/00.t changed_times_success, root => [Block, Char] } fn changed_times_success(ctx: &mut TestContext, ft: FileType) { @@ -157,7 +163,8 @@ fn changed_times_success(ctx: &mut TestContext, ft: FileType) { #[cfg(target_os = "illumos")] crate::test_case! { - /// mknod creates devices with old and new numbers + /// mknod creates devices with old and new-style numbers + // mknod/11.t create_old_new_device, root } #[cfg(target_os = "illumos")] diff --git a/rust/src/tests/open.rs b/rust/src/tests/open.rs index 07eba198..51d23a0a 100644 --- a/rust/src/tests/open.rs +++ b/rust/src/tests/open.rs @@ -20,7 +20,6 @@ use super::errors::etxtbsy::etxtbsy_test_case; use super::mksyscalls::{assert_perms_from_mode_and_umask, assert_uid_gid}; use super::{assert_times_changed, assert_times_unchanged, ATIME, CTIME, MTIME}; -// open/00.t fn open_wrapper(path: &Path, mode: Mode) -> nix::Result<()> { open(path, OFlag::O_CREAT | OFlag::O_WRONLY, mode).and_then(close) @@ -33,6 +32,7 @@ crate::test_case! { /// on the file-mode bits and the corresponding bits in the complement of the /// process' file mode creation mask. Thus, all bits in the file mode whose /// corresponding bit in the file mode creation mask is set are cleared. + // open/00.t permission_bits_from_mode, serialized } fn permission_bits_from_mode(ctx: &mut SerializedTestContext) { @@ -44,6 +44,7 @@ crate::test_case! { /// of the file shall be set to the effective user ID of the process; the group ID /// of the file shall be set to the group ID of the file's parent directory or to /// the effective group ID of the process [...] + // open/00.t uid_gid_eq_euid_egid, serialized, root } fn uid_gid_eq_euid_egid(ctx: &mut SerializedTestContext) { @@ -55,6 +56,7 @@ crate::test_case! { /// st_ctime, and st_mtime fields of the directory. Also, the st_ctime and /// st_mtime fields of the directory that contains the new entry shall be marked /// for update. + // open/00.t changed_time_fields_success } fn changed_time_fields_success(ctx: &mut TestContext) { @@ -71,6 +73,7 @@ fn changed_time_fields_success(ctx: &mut TestContext) { crate::test_case! { /// open do not update parent directory ctime and mtime fields if /// the file previously existed. + // open/00.t exists_no_update } fn exists_no_update(ctx: &mut TestContext) { @@ -85,6 +88,7 @@ fn exists_no_update(ctx: &mut TestContext) { crate::test_case! { /// open with O_TRUNC should truncate an exisiting file. + // open/00.t open_trunc } fn open_trunc(ctx: &mut TestContext) { @@ -124,6 +128,7 @@ fn interact_2gb(ctx: &mut TestContext) { } // POSIX states that open should return ELOOP, but FreeBSD returns EMLINK instead +// open/16.t #[cfg(not(target_os = "freebsd"))] crate::test_case! { /// open returns ELOOP when O_NOFOLLOW was specified and the target is a symbolic link @@ -168,6 +173,7 @@ crate::test_case! { #[cfg(target_os = "linux")] crate::test_case! { /// open returns ENXIO when trying to open UNIX domain socket + // open/24.t socket_error } fn socket_error(ctx: &mut TestContext) { @@ -190,6 +196,7 @@ fn socket_error(ctx: &mut TestContext) { crate::test_case! { /// open returns ENXIO when O_NONBLOCK is set, the named file is a fifo, O_WRONLY is set, /// and no process has the file open for reading + // open/17.t fifo_nonblock_wronly } fn fifo_nonblock_wronly(ctx: &mut TestContext) { @@ -227,7 +234,7 @@ erofs_named_test_case!( // open/15.t erofs_new_file_test_case!( open, - open_flag_wrapper_ctx(OFlag::O_RDONLY | OFlag::O_CREAT,) + open_flag_wrapper_ctx(OFlag::O_RDONLY | OFlag::O_CREAT) ); // open/12.t @@ -235,12 +242,12 @@ eloop_comp_test_case!(open(~path, OFlag::empty(), Mode::empty())); crate::test_case! { /// open returns EISDIR if the named file is a directory + // open/13.t eisdir } fn eisdir(ctx: &mut TestContext) { let path = ctx.create(FileType::Dir).unwrap(); - // open/13.t assert_eq!( open(&path, OFlag::O_WRONLY, Mode::empty()), Err(Errno::EISDIR) diff --git a/rust/src/tests/posix_fallocate.rs b/rust/src/tests/posix_fallocate.rs index f6d5fc44..93e59e3d 100644 --- a/rust/src/tests/posix_fallocate.rs +++ b/rust/src/tests/posix_fallocate.rs @@ -15,6 +15,7 @@ use crate::{ crate::test_case! { /// posix_fallocate should allocate even if the file is empty + // posix_fallocate/00.t increase_empty, FileSystemFeature::PosixFallocate } fn increase_empty(ctx: &mut TestContext) { @@ -29,6 +30,7 @@ fn increase_empty(ctx: &mut TestContext) { crate::test_case! { /// posix_fallocate should allocate even if the file is not empty + // posix_fallocate/00.t increase_not_empty, FileSystemFeature::PosixFallocate } fn increase_not_empty(ctx: &mut TestContext) { @@ -48,6 +50,7 @@ fn increase_not_empty(ctx: &mut TestContext) { crate::test_case! { /// posix_fallocate should update ctime when it succeeds + // posix_fallocate/00.t update_ctime_success, FileSystemFeature::PosixFallocate } fn update_ctime_success(ctx: &mut TestContext) { @@ -60,6 +63,7 @@ fn update_ctime_success(ctx: &mut TestContext) { crate::test_case! { /// posix_fallocate should not update ctime when it fails + // posix_fallocate/00.t no_update_ctime_fail, FileSystemFeature::PosixFallocate } fn no_update_ctime_fail(ctx: &mut TestContext) { @@ -74,6 +78,7 @@ crate::test_case! { /// The file mode of a newly created file should not affect whether /// posix_fallocate will work, only the create args /// https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=154873 + // posix_fallocate/00.t affected_only_create_flags, serialized, root, FileSystemFeature::PosixFallocate } fn affected_only_create_flags(ctx: &mut SerializedTestContext) { diff --git a/rust/src/tests/rename.rs b/rust/src/tests/rename.rs index 4fd4df96..c1ee3db3 100644 --- a/rust/src/tests/rename.rs +++ b/rust/src/tests/rename.rs @@ -267,6 +267,7 @@ fn updates_link_parent(ctx: &mut TestContext) { assert!(rename(&src, &dst).is_ok()); + // The .. link and parents' nlinks values should be updated let src_parent_stat = lstat(&src_parent).unwrap(); let dst_parent_stat = lstat(&dst_parent).unwrap(); assert_eq!(src_parent_stat.st_nlink, 2); @@ -282,9 +283,9 @@ crate::test_case! { /// rename returns ENOTDIR when the 'from' argument is a directory, /// but 'to' is not a directory // rename/13.t - enotdir_from_to => [Regular, Fifo, Block, Char, Socket] + enotdir_from_dir_to_not_dir => [Regular, Fifo, Block, Char, Socket] } -fn enotdir_from_to(ctx: &mut TestContext, ft: FileType) { +fn enotdir_from_dir_to_not_dir(ctx: &mut TestContext, ft: FileType) { let path = ctx.create(ft).unwrap(); let dir = ctx.create(FileType::Dir).unwrap(); @@ -300,7 +301,7 @@ enametoolong_either_path_test_case!(rename); // rename/03.t enoent_either_named_file_test_case!(rename); -// reanme/11.t +// rename/11.t eloop_either_test_case!(rename); crate::test_case! { diff --git a/rust/src/tests/rmdir.rs b/rust/src/tests/rmdir.rs index aa3519ea..b6579999 100644 --- a/rust/src/tests/rmdir.rs +++ b/rust/src/tests/rmdir.rs @@ -20,6 +20,7 @@ use super::{ crate::test_case! { /// rmdir remove directory + // rmdir/00.t remove_dir } fn remove_dir(ctx: &mut TestContext) { @@ -31,6 +32,7 @@ fn remove_dir(ctx: &mut TestContext) { crate::test_case! { /// rmdir updates parent ctime and mtime on success + // rmdir/00.t changed_time_parent_success } fn changed_time_parent_success(ctx: &mut TestContext) { diff --git a/rust/src/tests/symlink.rs b/rust/src/tests/symlink.rs index 6354cac2..30a161de 100644 --- a/rust/src/tests/symlink.rs +++ b/rust/src/tests/symlink.rs @@ -72,6 +72,7 @@ fn create_symlink_to_symlink(ctx: &mut TestContext) { crate::test_case! { /// symlink should update parent's ctime and mtime on success + // symlink/00.t changed_parent_time_success } fn changed_parent_time_success(ctx: &mut TestContext) { @@ -103,5 +104,5 @@ eexist_file_exists_test_case!(symlink(Path::new("test"), ~path)); // symlink/10.t erofs_new_file_test_case!(symlink(Path::new("test"), ~path)); -// symlink/13.t +// symlink/12.t efault_either_test_case!(symlink, nix::libc::symlink); diff --git a/rust/src/tests/truncate.rs b/rust/src/tests/truncate.rs index c2daa7ef..601e487a 100644 --- a/rust/src/tests/truncate.rs +++ b/rust/src/tests/truncate.rs @@ -19,10 +19,10 @@ use super::errors::{ etxtbsy::etxtbsy_test_case, }; -// tests/truncate/00.t crate::test_case! { /// truncate should extend a file, and shrink a sparse file + // truncate/00.t extend_file_shrink_sparse } fn extend_file_shrink_sparse(ctx: &mut TestContext) { @@ -42,6 +42,7 @@ fn extend_file_shrink_sparse(ctx: &mut TestContext) { crate::test_case! { /// truncate should shrink the file if the specified size is less than the actual one + // truncate/00.t shrink_not_empty } fn shrink_not_empty(ctx: &mut TestContext) { @@ -65,6 +66,7 @@ fn shrink_not_empty(ctx: &mut TestContext) { crate::test_case! { /// truncate should update ctime if it succeeds + // truncate/00.t update_ctime_success } fn update_ctime_success(ctx: &mut TestContext) { @@ -77,6 +79,7 @@ fn update_ctime_success(ctx: &mut TestContext) { crate::test_case! { /// truncate should not update ctime if it fails + // truncate/00.t unchanged_ctime_failed, serialized, root } fn unchanged_ctime_failed(ctx: &mut SerializedTestContext) { diff --git a/tests/chflags/00.t b/tests/chflags/00.t deleted file mode 100644 index ec1ae243..00000000 --- a/tests/chflags/00.t +++ /dev/null @@ -1,179 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/00.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="chflags changes flags" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -case "${os}:${fs}" in -FreeBSD:UFS) - allflags="UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK" - userflags="UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE" - systemflags="SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK" - - echo "1..742" - ;; -FreeBSD:ZFS) - allflags="UF_NODUMP,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK" - userflags="UF_NODUMP" - systemflags="SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK" - - echo "1..482" - ;; -*) - quick_exit - ;; -esac - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n2} 0755 -cdir=`pwd` -cd ${n2} - -for type in regular dir fifo block char socket; do - create_file ${type} ${n0} - expect none stat ${n0} flags - expect 0 chflags ${n0} ${allflags} - expect ${allflags} stat ${n0} flags - expect 0 chflags ${n0} ${userflags} - expect ${userflags} stat ${n0} flags - expect 0 chflags ${n0} ${systemflags} - expect ${systemflags} stat ${n0} flags - expect 0 chflags ${n0} none - expect none stat ${n0} flags - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - - create_file ${type} ${n0} - expect none stat ${n0} flags - expect 0 lchflags ${n0} ${allflags} - expect ${allflags} stat ${n0} flags - expect 0 lchflags ${n0} ${userflags} - expect ${userflags} stat ${n0} flags - expect 0 lchflags ${n0} ${systemflags} - expect ${systemflags} stat ${n0} flags - expect 0 lchflags ${n0} none - expect none stat ${n0} flags - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi -done - -expect 0 create ${n0} 0644 -expect 0 symlink ${n0} ${n1} -expect none stat ${n1} flags -expect none lstat ${n1} flags -expect 0 chflags ${n1} ${allflags} -expect ${allflags} stat ${n1} flags -expect none lstat ${n1} flags -expect 0 chflags ${n1} ${userflags} -expect ${userflags} stat ${n1} flags -expect none lstat ${n1} flags -expect 0 chflags ${n1} ${systemflags} -expect ${systemflags} stat ${n1} flags -expect none lstat ${n1} flags -expect 0 chflags ${n1} none -expect none stat ${n1} flags -expect none lstat ${n1} flags -expect 0 unlink ${n1} -expect 0 unlink ${n0} - -expect 0 create ${n0} 0644 -expect 0 symlink ${n0} ${n1} -expect none stat ${n1} flags -expect none lstat ${n1} flags -expect 0 lchflags ${n1} ${allflags} -expect ${allflags} lstat ${n1} flags -expect none stat ${n1} flags -expect 0 lchflags ${n1} ${userflags} -expect ${userflags} lstat ${n1} flags -expect none stat ${n1} flags -expect 0 lchflags ${n1} ${systemflags} -expect ${systemflags} lstat ${n1} flags -expect none stat ${n1} flags -expect 0 lchflags ${n1} none -expect none lstat ${n1} flags -expect none stat ${n1} flags -expect 0 unlink ${n1} -expect 0 unlink ${n0} - -# successful chflags(2) updates ctime. -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n0} - for flag in `echo ${allflags},none | tr ',' ' '`; do - ctime1=`${fstest} stat ${n0} ctime` - sleep 1 - expect 0 chflags ${n0} ${flag} - ctime2=`${fstest} stat ${n0} ctime` - test_check $ctime1 -lt $ctime2 - done - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi - - create_file ${type} ${n0} - for flag in `echo ${allflags},none | tr ',' ' '`; do - ctime1=`${fstest} lstat ${n0} ctime` - sleep 1 - expect 0 lchflags ${n0} ${flag} - ctime2=`${fstest} lstat ${n0} ctime` - test_check $ctime1 -lt $ctime2 - done - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi -done - -# unsuccessful chflags(2) does not update ctime. -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n0} - for flag in `echo ${allflags},none | tr ',' ' '`; do - ctime1=`${fstest} stat ${n0} ctime` - sleep 1 - expect EPERM -u 65534 chflags ${n0} ${flag} - ctime2=`${fstest} stat ${n0} ctime` - test_check $ctime1 -eq $ctime2 - done - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi - - create_file ${type} ${n0} - for flag in `echo ${allflags},none | tr ',' ' '`; do - ctime1=`${fstest} lstat ${n0} ctime` - sleep 1 - expect EPERM -u 65534 lchflags ${n0} ${flag} - ctime2=`${fstest} lstat ${n0} ctime` - test_check $ctime1 -eq $ctime2 - done - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi -done - -cd ${cdir} -expect 0 rmdir ${n2} diff --git a/tests/chflags/01.t b/tests/chflags/01.t deleted file mode 100644 index 21246783..00000000 --- a/tests/chflags/01.t +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/01.t 211474 2010-08-18 22:06:43Z pjd $ - -desc="chflags returns ENOTDIR if a component of the path prefix is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags -if requires_root -then - -echo "1..17" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -for type in regular fifo block char socket; do - create_file ${type} ${n0}/${n1} - expect ENOTDIR chflags ${n0}/${n1}/test SF_IMMUTABLE - expect 0 unlink ${n0}/${n1} -done -expect 0 rmdir ${n0} - -else -echo "1..1" -fi diff --git a/tests/chflags/02.t b/tests/chflags/02.t deleted file mode 100644 index 096370e7..00000000 --- a/tests/chflags/02.t +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/02.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="chflags returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -echo "1..12" - -nx=`namegen_max` -nxx="${nx}x" - -expect 0 create ${nx} 0644 -expect 0 chflags ${nx} SF_IMMUTABLE -expect SF_IMMUTABLE stat ${nx} flags -expect 0 chflags ${nx} none -expect 0 unlink ${nx} -expect ENAMETOOLONG chflags ${nxx} SF_IMMUTABLE - -expect 0 create ${nx} 0644 -expect 0 lchflags ${nx} SF_IMMUTABLE -expect SF_IMMUTABLE stat ${nx} flags -expect 0 lchflags ${nx} none -expect 0 unlink ${nx} -expect ENAMETOOLONG lchflags ${nxx} SF_IMMUTABLE diff --git a/tests/chflags/03.t b/tests/chflags/03.t deleted file mode 100644 index 8389fc12..00000000 --- a/tests/chflags/03.t +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/03.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="chflags returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -echo "1..12" - -nx=`dirgen_max` -nxx="${nx}x" - -mkdir -p "${nx%/*}" - -expect 0 create ${nx} 0644 -expect 0 chflags ${nx} SF_IMMUTABLE -expect SF_IMMUTABLE stat ${nx} flags -expect 0 chflags ${nx} none -expect 0 unlink ${nx} -expect ENAMETOOLONG chflags ${nxx} SF_IMMUTABLE - -expect 0 create ${nx} 0644 -expect 0 lchflags ${nx} SF_IMMUTABLE -expect SF_IMMUTABLE stat ${nx} flags -expect 0 lchflags ${nx} none -expect 0 unlink ${nx} -expect ENAMETOOLONG lchflags ${nxx} SF_IMMUTABLE - -rm -rf "${nx%%/*}" diff --git a/tests/chflags/04.t b/tests/chflags/04.t deleted file mode 100644 index a58fdc3c..00000000 --- a/tests/chflags/04.t +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/04.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="chflags returns ENOENT if the named file does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -echo "1..4" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect ENOENT chflags ${n0}/${n1}/test SF_IMMUTABLE -expect ENOENT chflags ${n0}/${n1} SF_IMMUTABLE -expect 0 rmdir ${n0} diff --git a/tests/chflags/06.t b/tests/chflags/06.t deleted file mode 100644 index 635e42c3..00000000 --- a/tests/chflags/06.t +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/06.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="chflags returns ELOOP if too many symbolic links were encountered in translating the pathname" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -echo "1..6" - -n0=`namegen` -n1=`namegen` - -expect 0 symlink ${n0} ${n1} -expect 0 symlink ${n1} ${n0} -expect ELOOP chflags ${n0}/test SF_IMMUTABLE -expect ELOOP chflags ${n1}/test SF_IMMUTABLE -expect 0 unlink ${n0} -expect 0 unlink ${n1} diff --git a/tests/chflags/09.t b/tests/chflags/09.t deleted file mode 100644 index 9b5f4b6b..00000000 --- a/tests/chflags/09.t +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/09.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="chflags returns EPERM when one of SF_IMMUTABLE, SF_APPEND, or SF_NOUNLINK is set and securelevel is greater than 0" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -echo "1..327" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -old=`sysctl -n security.jail.chflags_allowed` -sysctl security.jail.chflags_allowed=1 >/dev/null - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} - -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n1} - expect 0 chown ${n1} 65534 65534 - for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do - expect 0 chflags ${n1} ${flag} - jexpect 1 `pwd` EPERM chflags ${n1} UF_NODUMP - expect ${flag} stat ${n1} flags - jexpect 1 `pwd` EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP - expect ${flag} stat ${n1} flags - jexpect 1 `pwd` EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP - expect ${flag} stat ${n1} flags - done - expect 0 chflags ${n1} none - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1} - else - expect 0 unlink ${n1} - fi - fi - - create_file ${type} ${n1} - expect 0 lchown ${n1} 65534 65534 - for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do - expect 0 lchflags ${n1} ${flag} - jexpect 1 `pwd` EPERM lchflags ${n1} UF_NODUMP - expect ${flag} lstat ${n1} flags - jexpect 1 `pwd` EPERM -u 65533 -g 65533 lchflags ${n1} UF_NODUMP - expect ${flag} lstat ${n1} flags - jexpect 1 `pwd` EPERM -u 65534 -g 65534 lchflags ${n1} UF_NODUMP - expect ${flag} lstat ${n1} flags - done - expect 0 lchflags ${n1} none - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1} - else - expect 0 unlink ${n1} - fi -done - -sysctl security.jail.chflags_allowed=${old} >/dev/null -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tests/chflags/12.t b/tests/chflags/12.t deleted file mode 100644 index 2b561868..00000000 --- a/tests/chflags/12.t +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/12.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="chflags returns EROFS if the named file resides on a read-only file system" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -case "${os}:${fs}" in -FreeBSD:UFS) - echo "1..14" - - n0=`namegen` - n1=`namegen` - - expect 0 mkdir ${n0} 0755 - n=`mdconfig -a -n -t malloc -s 1m` || exit - newfs /dev/md${n} >/dev/null || exit - mount /dev/md${n} ${n0} - expect 0 create ${n0}/${n1} 0644 - expect 0 chflags ${n0}/${n1} UF_IMMUTABLE - expect UF_IMMUTABLE stat ${n0}/${n1} flags - expect 0 chflags ${n0}/${n1} none - expect none stat ${n0}/${n1} flags - mount -ur /dev/md${n} - expect EROFS chflags ${n0}/${n1} UF_IMMUTABLE - expect none stat ${n0}/${n1} flags - mount -uw /dev/md${n} - expect 0 chflags ${n0}/${n1} UF_IMMUTABLE - expect UF_IMMUTABLE stat ${n0}/${n1} flags - expect 0 chflags ${n0}/${n1} none - expect none stat ${n0}/${n1} flags - expect 0 unlink ${n0}/${n1} - umount /dev/md${n} - mdconfig -d -u ${n} || exit - expect 0 rmdir ${n0} - ;; -FreeBSD:ZFS) - echo "1..12" - - n0=`namegen` - n1=`namegen` - - n=`mdconfig -a -n -t malloc -s 128m` || exit - zpool create ${n0} /dev/md${n} - expect 0 create /${n0}/${n1} 0644 - expect 0 chflags /${n0}/${n1} UF_NODUMP - expect UF_NODUMP stat /${n0}/${n1} flags - expect 0 chflags /${n0}/${n1} none - expect none stat /${n0}/${n1} flags - zfs set readonly=on ${n0} - expect EROFS chflags /${n0}/${n1} UF_NODUMP - expect none stat /${n0}/${n1} flags - zfs set readonly=off ${n0} - expect 0 chflags /${n0}/${n1} UF_NODUMP - expect UF_NODUMP stat /${n0}/${n1} flags - expect 0 chflags /${n0}/${n1} none - expect none stat /${n0}/${n1} flags - expect 0 unlink /${n0}/${n1} - zpool destroy ${n0} - mdconfig -d -u ${n} || exit - ;; -*) - quick_exit - ;; -esac diff --git a/tests/chflags/13.t b/tests/chflags/13.t deleted file mode 100644 index 56054141..00000000 --- a/tests/chflags/13.t +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/13.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="chflags returns EFAULT if the path argument points outside the process's allocated address space" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -echo "1..2" - -expect EFAULT chflags NULL UF_NODUMP -expect EFAULT chflags DEADCODE UF_NODUMP diff --git a/tests/chmod/00.t b/tests/chmod/00.t deleted file mode 100644 index f7ab7a67..00000000 --- a/tests/chmod/00.t +++ /dev/null @@ -1,139 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/chmod/00.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="chmod changes permission" - -dir=`dirname $0` -. ${dir}/../misc.sh - -if supported lchmod; then - echo "1..203" -else - echo "1..119" -fi - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n2} 0755 -cdir=`pwd` -cd ${n2} - -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n0} - expect 0 chmod ${n0} 0111 - expect 0111 stat ${n0} mode - - expect 0 symlink ${n0} ${n1} - mode=`${fstest} lstat ${n1} mode` - expect 0 chmod ${n1} 0222 - expect 0222 stat ${n1} mode - expect 0222 stat ${n0} mode - expect ${mode} lstat ${n1} mode - expect 0 unlink ${n1} - - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi - - if supported lchmod; then - create_file ${type} ${n0} - expect 0 lchmod ${n0} 0111 - expect 0111 lstat ${n0} mode - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi -done - -# successful chmod(2) updates ctime. -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n0} - ctime1=`${fstest} stat ${n0} ctime` - sleep 1 - expect 0 chmod ${n0} 0111 - ctime2=`${fstest} stat ${n0} ctime` - test_check $ctime1 -lt $ctime2 - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi - - if supported lchmod; then - create_file ${type} ${n0} - ctime1=`${fstest} lstat ${n0} ctime` - sleep 1 - expect 0 lchmod ${n0} 0111 - ctime2=`${fstest} lstat ${n0} ctime` - test_check $ctime1 -lt $ctime2 - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi -done - -# unsuccessful chmod(2) does not update ctime. -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n0} - ctime1=`${fstest} stat ${n0} ctime` - sleep 1 - expect EPERM -u 65534 chmod ${n0} 0111 - ctime2=`${fstest} stat ${n0} ctime` - test_check $ctime1 -eq $ctime2 - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi - - if supported lchmod; then - create_file ${type} ${n0} - ctime1=`${fstest} lstat ${n0} ctime` - sleep 1 - expect EPERM -u 65534 lchmod ${n0} 0321 - ctime2=`${fstest} lstat ${n0} ctime` - test_check $ctime1 -eq $ctime2 - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi -done - -# POSIX: If the calling process does not have appropriate privileges, and if -# the group ID of the file does not match the effective group ID or one of the -# supplementary group IDs and if the file is a regular file, bit S_ISGID -# (set-group-ID on execution) in the file's mode shall be cleared upon -# successful return from chmod(). - -expect 0 create ${n0} 0755 -expect 0 chown ${n0} 65535 65535 -expect 0 -u 65535 -g 65535 chmod ${n0} 02755 -expect 02755 stat ${n0} mode -expect 0 -u 65535 -g 65535 chmod ${n0} 0755 -expect 0755 stat ${n0} mode - -todo FreeBSD "S_ISGID should be removed and chmod(2) should success and FreeBSD returns EPERM." -expect 0 -u 65535 -g 65534 chmod ${n0} 02755 -expect 0755 stat ${n0} mode - -expect 0 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n2} diff --git a/tests/chmod/01.t b/tests/chmod/01.t deleted file mode 100644 index aa629cf6..00000000 --- a/tests/chmod/01.t +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/chmod/01.t 211474 2010-08-18 22:06:43Z pjd $ - -desc="chmod returns ENOTDIR if a component of the path prefix is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..17" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -for type in regular fifo block char socket; do - create_file ${type} ${n0}/${n1} - expect ENOTDIR chmod ${n0}/${n1}/test 0644 - expect 0 unlink ${n0}/${n1} -done -expect 0 rmdir ${n0} diff --git a/tests/chmod/02.t b/tests/chmod/02.t deleted file mode 100644 index 83558ba8..00000000 --- a/tests/chmod/02.t +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/chmod/02.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="chmod returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -if supported lchmod; then - echo "1..10" -else - echo "1..5" -fi - -nx=`namegen_max` -nxx="${nx}x" - -expect 0 create ${nx} 0644 -expect 0 chmod ${nx} 0620 -expect 0620 stat ${nx} mode -expect 0 unlink ${nx} -expect ENAMETOOLONG chmod ${nxx} 0620 - -if supported lchmod; then - expect 0 create ${nx} 0644 - expect 0 lchmod ${nx} 0620 - expect 0620 stat ${nx} mode - expect 0 unlink ${nx} - expect ENAMETOOLONG lchmod ${nxx} 0620 -fi diff --git a/tests/chmod/03.t b/tests/chmod/03.t deleted file mode 100644 index 157f28d3..00000000 --- a/tests/chmod/03.t +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/chmod/03.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="chmod returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -if supported lchmod; then - echo "1..10" -else - echo "1..5" -fi - -nx=`dirgen_max` -nxx="${nx}x" - -mkdir -p "${nx%/*}" - -expect 0 create ${nx} 0644 -expect 0 chmod ${nx} 0642 -expect 0642 stat ${nx} mode -expect 0 unlink ${nx} -expect ENAMETOOLONG chmod ${nxx} 0642 - -if supported lchmod; then - expect 0 create ${nx} 0644 - expect 0 lchmod ${nx} 0642 - expect 0642 stat ${nx} mode - expect 0 unlink ${nx} - expect ENAMETOOLONG lchmod ${nxx} 0642 -fi - -rm -rf "${nx%%/*}" diff --git a/tests/chmod/04.t b/tests/chmod/04.t deleted file mode 100644 index 757e9d72..00000000 --- a/tests/chmod/04.t +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/chmod/04.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="chmod returns ENOENT if the named file does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -if supported lchmod; then - echo "1..9" -else - echo "1..7" -fi - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -expect ENOENT chmod ${n0}/${n1}/test 0644 -expect ENOENT chmod ${n0}/${n1} 0644 -if supported lchmod; then - expect ENOENT lchmod ${n0}/${n1}/test 0644 - expect ENOENT lchmod ${n0}/${n1} 0644 -fi -expect 0 symlink ${n2} ${n0}/${n1} -expect ENOENT chmod ${n0}/${n1} 0644 -expect 0 unlink ${n0}/${n1} -expect 0 rmdir ${n0} diff --git a/tests/chmod/06.t b/tests/chmod/06.t deleted file mode 100644 index a925dad2..00000000 --- a/tests/chmod/06.t +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/chmod/06.t 211474 2010-08-18 22:06:43Z pjd $ - -desc="chmod returns ELOOP if too many symbolic links were encountered in translating the pathname" - -dir=`dirname $0` -. ${dir}/../misc.sh - -if supported lchmod; then - echo "1..10" -else - echo "1..8" -fi - -n0=`namegen` -n1=`namegen` - -expect 0 symlink ${n0} ${n1} -expect 0 symlink ${n1} ${n0} -expect ELOOP chmod ${n0} 0644 -expect ELOOP chmod ${n1} 0644 -expect ELOOP chmod ${n0}/test 0644 -expect ELOOP chmod ${n1}/test 0644 -if supported lchmod; then - expect ELOOP lchmod ${n0}/test 0644 - expect ELOOP lchmod ${n1}/test 0644 -fi -expect 0 unlink ${n0} -expect 0 unlink ${n1} diff --git a/tests/chmod/09.t b/tests/chmod/09.t deleted file mode 100644 index 000e0e35..00000000 --- a/tests/chmod/09.t +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/chmod/09.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="chmod returns EROFS if the named file resides on a read-only file system" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..15" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` || exit -newfs /dev/md${n} >/dev/null || exit -mount /dev/md${n} ${n0} || exit -expect 0 create ${n0}/${n1} 0644 -expect 0 chmod ${n0}/${n1} 0640 -expect 0640 stat ${n0}/${n1} mode -expect 0 lchmod ${n0}/${n1} 0530 -expect 0530 stat ${n0}/${n1} mode -mount -ur /dev/md${n} -expect EROFS chmod ${n0}/${n1} 0600 -expect EROFS lchmod ${n0}/${n1} 0600 -expect 0530 stat ${n0}/${n1} mode -mount -uw /dev/md${n} -expect 0 chmod ${n0}/${n1} 0600 -expect 0600 stat ${n0}/${n1} mode -expect 0 lchmod ${n0}/${n1} 0640 -expect 0640 stat ${n0}/${n1} mode -expect 0 unlink ${n0}/${n1} -umount /dev/md${n} -mdconfig -d -u ${n} || exit -expect 0 rmdir ${n0} diff --git a/tests/chmod/10.t b/tests/chmod/10.t deleted file mode 100644 index f37a94be..00000000 --- a/tests/chmod/10.t +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/chmod/10.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="chmod returns EFAULT if the path argument points outside the process's allocated address space" - -dir=`dirname $0` -. ${dir}/../misc.sh - -if supported lchmod; then - echo "1..4" -else - echo "1..2" -fi - -expect EFAULT chmod NULL 0644 -expect EFAULT chmod DEADCODE 0644 -if supported lchmod; then - expect EFAULT lchmod NULL 0644 - expect EFAULT lchmod DEADCODE 0644 -fi diff --git a/tests/chmod/11.t b/tests/chmod/11.t deleted file mode 100644 index c68d939b..00000000 --- a/tests/chmod/11.t +++ /dev/null @@ -1,129 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/chmod/11.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="chmod returns EFTYPE if the effective user ID is not the super-user, the mode includes the sticky bit (S_ISVTX), and path does not refer to a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -if supported lchmod; then - echo "1..173" -else - echo "1..109" -fi - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} - -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n1} - expect 0 chmod ${n1} 01621 - expect 01621 stat ${n1} mode - expect 0 symlink ${n1} ${n2} - expect 0 chmod ${n2} 01700 - expect 01700 stat ${n1} mode - expect 0 unlink ${n2} - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1} - else - expect 0 unlink ${n1} - fi - fi - - if supported lchmod; then - create_file ${type} ${n1} - expect 0 lchmod ${n1} 01621 - expect 01621 lstat ${n1} mode - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1} - else - expect 0 unlink ${n1} - fi - fi -done - -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 -expect 0 -u 65534 -g 65534 chmod ${n1} 01755 -expect 01755 stat ${n1} mode -expect 0 symlink ${n1} ${n2} -expect 0 chmod ${n2} 01700 -expect 01700 stat ${n1} mode -expect 0 unlink ${n2} -expect 0 rmdir ${n1} - -for type in regular fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n1} 0640 65534 65534 - expect 0 symlink ${n1} ${n2} - case "${os}" in - Darwin) - expect 0 -u 65534 -g 65534 chmod ${n1} 01644 - expect 01644 stat ${n1} mode - expect 0 -u 65534 -g 65534 chmod ${n2} 01640 - expect 01640 stat ${n1} mode - ;; - FreeBSD) - expect EFTYPE -u 65534 -g 65534 chmod ${n1} 01644 - expect 0640 stat ${n1} mode - expect EFTYPE -u 65534 -g 65534 chmod ${n2} 01644 - expect 0640 stat ${n1} mode - ;; - SunOS) - expect 0 -u 65534 -g 65534 chmod ${n1} 01644 - expect 0644 stat ${n1} mode - expect 0 -u 65534 -g 65534 chmod ${n2} 01640 - expect 0640 stat ${n1} mode - ;; - Linux) - expect 0 -u 65534 -g 65534 chmod ${n1} 01644 - expect 01644 stat ${n1} mode - expect 0 -u 65534 -g 65534 chmod ${n2} 01640 - expect 01640 stat ${n1} mode - ;; - esac - expect 0 unlink ${n2} - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1} - else - expect 0 unlink ${n1} - fi - fi - - if supported lchmod; then - create_file ${type} ${n1} 0640 65534 65534 - case "${os}" in - Darwin) - expect 0 -u 65534 -g 65534 lchmod ${n1} 01644 - expect 01644 lstat ${n1} mode - ;; - FreeBSD) - expect EFTYPE -u 65534 -g 65534 lchmod ${n1} 01644 - expect 0640 lstat ${n1} mode - ;; - SunOS) - expect 0 -u 65534 -g 65534 lchmod ${n1} 01644 - expect 0644 lstat ${n1} mode - ;; - Linux) - expect 0 -u 65534 -g 65534 lchmod ${n1} 01644 - expect 01644 lstat ${n1} mode - ;; - esac - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1} - else - expect 0 unlink ${n1} - fi - fi -done - -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tests/chown/01.t b/tests/chown/01.t deleted file mode 100644 index a60126a4..00000000 --- a/tests/chown/01.t +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/01.t 211474 2010-08-18 22:06:43Z pjd $ - -desc="chown returns ENOTDIR if a component of the path prefix is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..22" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -for type in regular fifo block char socket; do - create_file ${type} ${n0}/${n1} - expect ENOTDIR chown ${n0}/${n1}/test 65534 65534 - expect ENOTDIR lchown ${n0}/${n1}/test 65534 65534 - expect 0 unlink ${n0}/${n1} -done -expect 0 rmdir ${n0} diff --git a/tests/chown/02.t b/tests/chown/02.t deleted file mode 100644 index e65d38ee..00000000 --- a/tests/chown/02.t +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/02.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="chown returns ENAMETOOLONG if a component of a pathname exceeded ${NAME_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..10" - -nx=`namegen_max` -nxx="${nx}x" - -expect 0 create ${nx} 0644 -expect 0 chown ${nx} 65534 65534 -expect 65534,65534 stat ${nx} uid,gid -expect 0 unlink ${nx} -expect ENAMETOOLONG chown ${nxx} 65534 65534 - -expect 0 create ${nx} 0644 -expect 0 lchown ${nx} 65534 65534 -expect 65534,65534 stat ${nx} uid,gid -expect 0 unlink ${nx} -expect ENAMETOOLONG lchown ${nxx} 65534 65534 diff --git a/tests/chown/03.t b/tests/chown/03.t deleted file mode 100644 index 3cb1ded0..00000000 --- a/tests/chown/03.t +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/03.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="chown returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..10" - -nx=`dirgen_max` -nxx="${nx}x" - -mkdir -p "${nx%/*}" - -expect 0 create ${nx} 0644 -expect 0 chown ${nx} 65534 65534 -expect 65534,65534 stat ${nx} uid,gid -expect 0 unlink ${nx} -expect ENAMETOOLONG chown ${nxx} 65534 65534 - -expect 0 create ${nx} 0644 -expect 0 lchown ${nx} 65534 65534 -expect 65534,65534 stat ${nx} uid,gid -expect 0 unlink ${nx} -expect ENAMETOOLONG lchown ${nxx} 65534 65534 - -rm -rf "${nx%%/*}" diff --git a/tests/chown/04.t b/tests/chown/04.t deleted file mode 100644 index 4b66bacb..00000000 --- a/tests/chown/04.t +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/04.t 211410 2010-08-17 06:08:09Z pjd $ - -desc="chown returns ENOENT if the named file does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..9" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -expect ENOENT chown ${n0}/${n1}/test 65534 65534 -expect ENOENT chown ${n0}/${n1} 65534 65534 -expect ENOENT lchown ${n0}/${n1}/test 65534 65534 -expect ENOENT lchown ${n0}/${n1} 65534 65534 -expect 0 symlink ${n2} ${n0}/${n1} -expect ENOENT chown ${n0}/${n1} 65534 65534 -expect 0 unlink ${n0}/${n1} -expect 0 rmdir ${n0} diff --git a/tests/chown/06.t b/tests/chown/06.t deleted file mode 100644 index aaec6177..00000000 --- a/tests/chown/06.t +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/06.t 211410 2010-08-17 06:08:09Z pjd $ - -desc="chown returns ELOOP if too many symbolic links were encountered in translating the pathname" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..10" - -n0=`namegen` -n1=`namegen` - -expect 0 symlink ${n0} ${n1} -expect 0 symlink ${n1} ${n0} -expect ELOOP chown ${n0} 65534 65534 -expect ELOOP chown ${n1} 65534 65534 -expect ELOOP chown ${n0}/test 65534 65534 -expect ELOOP chown ${n1}/test 65534 65534 -expect ELOOP lchown ${n0}/test 65534 65534 -expect ELOOP lchown ${n1}/test 65534 65534 -expect 0 unlink ${n0} -expect 0 unlink ${n1} diff --git a/tests/chown/09.t b/tests/chown/09.t deleted file mode 100644 index 9fd44df5..00000000 --- a/tests/chown/09.t +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/09.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="chown returns EROFS if the named file resides on a read-only file system" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..10" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` || exit -newfs /dev/md${n} >/dev/null || exit -mount /dev/md${n} ${n0} || exit -expect 0 create ${n0}/${n1} 0644 -expect 0 chown ${n0}/${n1} 65534 65534 -expect 65534,65534 stat ${n0}/${n1} uid,gid -mount -ur /dev/md${n} -expect EROFS chown ${n0}/${n1} 65533 65533 -expect 65534,65534 stat ${n0}/${n1} uid,gid -mount -uw /dev/md${n} -expect 0 chown ${n0}/${n1} 65533 65533 -expect 65533,65533 stat ${n0}/${n1} uid,gid -expect 0 unlink ${n0}/${n1} -umount /dev/md${n} -mdconfig -d -u ${n} || exit -expect 0 rmdir ${n0} diff --git a/tests/chown/10.t b/tests/chown/10.t deleted file mode 100644 index 6e7f8207..00000000 --- a/tests/chown/10.t +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/10.t 211410 2010-08-17 06:08:09Z pjd $ - -desc="chown returns EFAULT if the path argument points outside the process's allocated address space" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -expect EFAULT chown NULL 65534 65534 -expect EFAULT chown DEADCODE 65534 65534 -expect EFAULT lchown NULL 65534 65534 -expect EFAULT lchown DEADCODE 65534 65534 diff --git a/tests/ftruncate/00.t b/tests/ftruncate/00.t deleted file mode 100644 index 730d563d..00000000 --- a/tests/ftruncate/00.t +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/ftruncate/00.t 219439 2011-03-09 23:11:30Z pjd $ - -desc="ftruncate descrease/increase file size" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..26" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n1} 0755 -cdir=`pwd` -cd ${n1} - -expect 0 create ${n0} 0644 -expect 0 open ${n0} O_RDWR : ftruncate 0 1234567 -expect 1234567 lstat ${n0} size -expect 0 open ${n0} O_WRONLY : ftruncate 0 567 -expect 567 lstat ${n0} size -expect 0 unlink ${n0} - -dd if=/dev/random of=${n0} bs=12345 count=1 >/dev/null 2>&1 -expect 0 open ${n0} O_RDWR : ftruncate 0 23456 -expect 23456 lstat ${n0} size -expect 0 open ${n0} O_WRONLY : ftruncate 0 1 -expect 1 lstat ${n0} size -expect 0 unlink ${n0} - -# successful ftruncate(2) updates ctime. -expect 0 create ${n0} 0644 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 open ${n0} O_RDWR : ftruncate 0 123 -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n0} - -# unsuccessful ftruncate(2) does not update ctime. -expect 0 create ${n0} 0644 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect EINVAL -u 65534 open ${n0} O_RDONLY : ftruncate 0 123 -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 unlink ${n0} - -# The file mode of a newly created file should not affect whether ftruncate -# will work, only the create args -# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=154873 -expect 0 open ${n0} O_CREAT,O_RDWR 0 : ftruncate 0 0 -expect 0 unlink ${n0} -expect 0 chmod . 0777 -expect 0 -u 65534 open ${n0} O_CREAT,O_RDWR 0 : ftruncate 0 0 -expect 0 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n1} diff --git a/tests/ftruncate/13.t b/tests/ftruncate/13.t deleted file mode 100644 index 21929551..00000000 --- a/tests/ftruncate/13.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/13.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="ftruncate returns EINVAL if the length argument was less than 0" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -n0=`namegen` - -expect 0 create ${n0} 0644 -expect EINVAL -- open ${n0} O_RDWR : ftruncate 0 -1 -expect EINVAL -- open ${n0} O_WRONLY : ftruncate 0 -999999 -expect 0 unlink ${n0} diff --git a/tests/granular/00.t b/tests/granular/00.t deleted file mode 100644 index fcf4c02d..00000000 --- a/tests/granular/00.t +++ /dev/null @@ -1,113 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/granular/00.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="NFSv4 granular permissions checking - WRITE_DATA vs APPEND_DATA on directories" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:ZFS" ] || quick_exit - -echo "1..49" - -n0=`namegen` -n1=`namegen` -n2=`namegen` -n3=`namegen` - -expect 0 mkdir ${n2} 0755 -expect 0 mkdir ${n3} 0777 -cdir=`pwd` -cd ${n2} - -# Tests 2..7 - check out whether root user can do stuff. -# Can create files? -expect 0 create ${n0} 0644 - -# Can create symlinks? -expect 0 link ${n0} ${n1} -expect 0 unlink ${n1} -expect 0 unlink ${n0} - -# Can create directories? -expect 0 mkdir ${n0} 0755 -expect 0 rmdir ${n0} - -# Check whether user 65534 is permitted to create and remove -# files, but not subdirectories. -expect 0 prependacl . user:65534:write_data::allow,user:65534:append_data::deny - -# Can create files? -expect 0 -u 65534 -g 65534 create ${n0} 0644 - -# Can create symlinks? -expect 0 -u 65534 -g 65534 link ${n0} ${n1} -expect 0 -u 65534 -g 65534 unlink ${n1} -expect 0 -u 65534 -g 65534 unlink ${n0} - -# Can create directories? -expect EACCES -u 65534 -g 65534 mkdir ${n0} 0755 -expect ENOENT -u 65534 -g 65534 rmdir ${n0} -expect 0 mkdir ${n0} 0755 -expect 0 -u 65534 -g 65534 rmdir ${n0} - -# Can move files from other directory? -expect 0 create ../${n3}/${n1} 0644 -expect 0 -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} - -# Can move files from other directory overwriting existing files? -expect 0 create ../${n3}/${n1} 0644 -expect 0 -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} - -expect 0 -u 65534 -g 65534 unlink ${n0} - -# Can move directories from other directory? -expect 0 mkdir ../${n3}/${n1} 0777 -expect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} - -# Can move directories from other directory overwriting existing directory? -expect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} -expect 0 -u 65534 -g 65534 rmdir ../${n3}/${n1} - -# Check whether user 65534 is permitted to create -# subdirectories, but not files - and to remove neither of them. -expect 0 prependacl . user:65534:write_data::deny,user:65534:append_data::allow - -# Can create files? -expect EACCES -u 65534 -g 65534 create ${n0} 0644 - -# Can create symlinks? -expect 0 create ${n0} 0644 -expect EACCES -u 65534 -g 65534 link ${n0} ${n1} -expect ENOENT -u 65534 -g 65534 unlink ${n1} -expect EACCES -u 65534 -g 65534 unlink ${n0} -expect 0 unlink ${n0} - -# Can create directories? -expect 0 -u 65534 -g 65534 mkdir ${n0} 0755 -expect EACCES -u 65534 -g 65534 rmdir ${n0} -expect 0 rmdir ${n0} - -# Can move files from other directory? -expect 0 create ../${n3}/${n1} 0644 -expect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} - -# Can move files from other directory overwriting existing files? -expect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} -expect 0 -u 65534 -g 65534 unlink ../${n3}/${n1} - -# Can move directories from other directory? -expect 0 mkdir ../${n3}/${n1} 0777 -expect 0 -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} - -# Can move directories from other directory overwriting existing directory? -expect 0 mkdir ../${n3}/${n1} 0777 -expect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} -expect 0 prependacl . user:65534:delete_child::allow -expect 0 -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} -expect 0 -u 65534 -g 65534 rmdir ${n0} - -cd ${cdir} -expect 0 rmdir ${n2} -expect 0 rmdir ${n3} diff --git a/tests/granular/01.t b/tests/granular/01.t deleted file mode 100644 index 34453b71..00000000 --- a/tests/granular/01.t +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/granular/01.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="NFSv4 granular permissions checking - ACL_READ_ATTRIBUTES and ACL_WRITE_ATTRIBUTES" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:ZFS" ] || quick_exit - -echo "1..12" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n2} 0755 -cdir=`pwd` -cd ${n2} - -# Tests 1..12 - check out whether user 65534 is permitted to read attributes. -expect 0 create ${n0} 0644 -expect 0 lstat ${n0} size -expect 0 -u 65534 -g 65534 stat ${n0} size -expect 0 prependacl ${n0} user:65534:read_attributes::deny -expect 0 lstat ${n0} size -expect EACCES -u 65534 -g 65534 stat ${n0} size -expect 0 prependacl ${n0} user:65534:read_attributes::allow -expect 0 -u 65534 -g 65534 stat ${n0} size -expect 0 lstat ${n0} size -expect 0 unlink ${n0} - -# Tests 12..12 - check out whether user 65534 is permitted to write attributes. -# XXX: Check if ACL_WRITE_ATTRIBUTES allows for modifying access times. - -cd ${cdir} -expect 0 rmdir ${n2} diff --git a/tests/granular/02.t b/tests/granular/02.t deleted file mode 100644 index 6b8e26d4..00000000 --- a/tests/granular/02.t +++ /dev/null @@ -1,145 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/granular/02.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="NFSv4 granular permissions checking - ACL_READ_ACL and ACL_WRITE_ACL" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:ZFS" ] || quick_exit - -echo "1..83" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n2} 0755 -cdir=`pwd` -cd ${n2} - -# Check whether user 65534 is permitted to read ACL. -expect 0 create ${n0} 0644 -expect 0 readacl ${n0} -expect 0 -u 65534 -g 65534 readacl ${n0} -expect 0 prependacl ${n0} user:65534:read_acl::deny -expect 0 readacl ${n0} -expect EACCES -u 65534 -g 65534 readacl ${n0} -expect 0 prependacl ${n0} user:65534:read_acl::allow -expect 0 -u 65534 -g 65534 readacl ${n0} -expect 0 readacl ${n0} -expect 0 unlink ${n0} - -# Check whether user 65534 is permitted to write ACL. -expect 0 create ${n0} 0644 -expect EPERM -u 65534 -g 65534 prependacl ${n0} user:65534:read_data::allow -expect 0 prependacl ${n0} user:65534:write_acl::allow -expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:read_data::allow -expect 0 unlink ${n0} - -# Check whether user 65534 is permitted to write mode. -expect 0 create ${n0} 0755 -expect EPERM -u 65534 -g 65534 chmod ${n0} 0777 -expect 0 prependacl ${n0} user:65534:write_acl::allow -expect 0 -u 65534 -g 65534 chmod ${n0} 0777 -expect 0 unlink ${n0} - -# There is an interesting problem with interaction between ACL_WRITE_ACL -# and SUID/SGID bits. In case user does have ACL_WRITE_ACL, but is not -# a file owner, Solaris does the following: -# 1. Setting SUID fails with EPERM. -# 2. Setting SGID succeeds, but mode is not changed. -# 3. Modifying ACL does not clear SUID nor SGID bits. -# 4. Writing the file does clear both SUID and SGID bits. -# -# What we are doing is the following: -# 1. Setting SUID or SGID fails with EPERM. -# 2. Modifying ACL does not clear SUID nor SGID bits. -# 3. Writing the file does clear both SUID and SGID bits. -# -# Check whether user 65534 is denied to write mode with SUID bit. -expect 0 create ${n0} 0755 -expect EPERM -u 65534 -g 65534 chmod ${n0} 04777 -expect 0 prependacl ${n0} user:65534:write_acl::allow -expect EPERM -u 65534 -g 65534 chmod ${n0} 04777 -expect 0 unlink ${n0} - -# Check whether user 65534 is denied to write mode with SGID bit. -expect 0 create ${n0} 0755 -expect EPERM -u 65534 -g 65534 chmod ${n0} 02777 -expect 0 prependacl ${n0} user:65534:write_acl::allow -expect EPERM -u 65534 -g 65534 chmod ${n0} 02777 -expect 0 unlink ${n0} - -# Check whether user 65534 is allowed to write mode with sticky bit. -expect 0 mkdir ${n0} 0755 -expect EPERM -u 65534 -g 65534 chmod ${n0} 01777 -expect 0 prependacl ${n0} user:65534:write_acl::allow -expect 0 -u 65534 -g 65534 chmod ${n0} 01777 -expect 0 rmdir ${n0} - -# Check whether modifying the ACL by not-owner preserves the SUID. -expect 0 create ${n0} 04755 -expect 0 prependacl ${n0} user:65534:write_acl::allow -expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:write_data::allow -expect 04755 stat ${n0} mode -expect 0 unlink ${n0} - -# Check whether modifying the ACL by not-owner preserves the SGID. -expect 0 create ${n0} 02755 -expect 0 prependacl ${n0} user:65534:write_acl::allow -expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:write_data::allow -expect 02755 stat ${n0} mode -expect 0 unlink ${n0} - -# Check whether modifying the ACL by not-owner preserves the sticky bit. -expect 0 mkdir ${n0} 0755 -expect 0 chmod ${n0} 01755 -expect 0 prependacl ${n0} user:65534:write_acl::allow -expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:write_data::allow -expect 01755 stat ${n0} mode -expect 0 rmdir ${n0} - -# Clearing the SUID and SGID bits when being written to by non-owner -# is checked in chmod/12.t. - -# Check whether the file owner is always permitted to get and set -# ACL and file mode, even if ACL_{READ,WRITE}_ACL would deny it. -expect 0 chmod . 0777 -expect 0 -u 65534 -g 65534 create ${n0} 0600 -expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:write_acl::deny -expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:read_acl::deny -expect 0 -u 65534 -g 65534 readacl ${n0} -expect 0600 -u 65534 -g 65534 stat ${n0} mode -expect 0 -u 65534 -g 65534 chmod ${n0} 0777 -expect 0 unlink ${n0} - -expect 0 -u 65534 -g 65534 mkdir ${n0} 0600 -expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:write_acl::deny -expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:read_acl::deny -expect 0 -u 65534 -g 65534 readacl ${n0} -expect 0600 -u 65534 -g 65534 stat ${n0} mode -expect 0 -u 65534 -g 65534 chmod ${n0} 0777 -expect 0 rmdir ${n0} - -# Check whether the root is allowed for these as well. -expect 0 -u 65534 -g 65534 create ${n0} 0600 -expect 0 prependacl ${n0} everyone@:write_acl::deny -expect 0 prependacl ${n0} everyone@:read_acl::deny -expect 0 readacl ${n0} -expect 0600 stat ${n0} mode -expect 0 chmod ${n0} 0777 -expect 0 unlink ${n0} - -expect 0 -u 65534 -g 65534 mkdir ${n0} 0600 -expect 0 prependacl ${n0} everyone@:write_acl::deny -expect 0 prependacl ${n0} everyone@:read_acl::deny -expect 0600 stat ${n0} mode -expect 0 readacl ${n0} -expect 0600 stat ${n0} mode -expect 0 chmod ${n0} 0777 -expect 0 rmdir ${n0} - -cd ${cdir} -expect 0 rmdir ${n2} diff --git a/tests/granular/03.t b/tests/granular/03.t deleted file mode 100644 index fe778ea4..00000000 --- a/tests/granular/03.t +++ /dev/null @@ -1,135 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/granular/03.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="NFSv4 granular permissions checking - DELETE and DELETE_CHILD" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:ZFS" ] || quick_exit - -echo "1..65" - -n0=`namegen` -n1=`namegen` -n2=`namegen` -n3=`namegen` - -expect 0 mkdir ${n2} 0755 -expect 0 mkdir ${n3} 0777 -cdir=`pwd` -cd ${n2} - -# Unlink allowed on writable directory. -expect 0 create ${n0} 0644 -expect EACCES -u 65534 -g 65534 unlink ${n0} -expect 0 prependacl . user:65534:write_data::allow -expect 0 -u 65534 -g 65534 unlink ${n0} - -# Moving file elsewhere allowed on writable directory. -expect 0 create ${n0} 0644 -expect 0 prependacl . user:65534:write_data::deny -expect EACCES -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} -expect 0 prependacl . user:65534:write_data::allow -expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} - -# Moving file from elsewhere allowed on writable directory. -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 -u 65534 -g 65534 unlink ${n0} - -# Moving file from elsewhere overwriting local file allowed -# on writable directory. -expect 0 create ${n0} 0644 -expect 0 create ../${n3}/${n0} 0644 -expect 0 prependacl . user:65534:write_data::deny -expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 prependacl . user:65534:write_data::allow -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 -u 65534 -g 65534 unlink ${n0} - -# Denied DELETE changes nothing wrt removing. -expect 0 create ${n0} 0644 -expect 0 prependacl ${n0} user:65534:delete::deny -expect 0 -u 65534 -g 65534 unlink ${n0} - -# Denied DELETE changes nothing wrt moving elsewhere or from elsewhere. -expect 0 create ${n0} 0644 -expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 -u 65534 -g 65534 unlink ${n0} - -# DELETE_CHILD denies unlink on writable directory. -expect 0 create ${n0} 0644 -expect 0 prependacl . user:65534:delete_child::deny -expect EPERM -u 65534 -g 65534 unlink ${n0} -expect 0 unlink ${n0} - -# DELETE_CHILD denies moving file elsewhere. -expect 0 create ${n0} 0644 -expect EPERM -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} -expect 0 rename ${n0} ../${n3}/${n0} - -# DELETE_CHILD does not deny moving file from elsewhere -# to a writable directory. -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} - -# DELETE_CHILD denies moving file from elsewhere -# to a writable directory overwriting local file. -expect 0 create ../${n3}/${n0} 0644 -expect EPERM -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} - -# DELETE allowed on file allows for unlinking, no matter -# what permissions on containing directory are. -expect 0 prependacl ${n0} user:65534:delete::allow -expect 0 -u 65534 -g 65534 unlink ${n0} - -# Same for moving the file elsewhere. -expect 0 create ${n0} 0644 -expect 0 prependacl ${n0} user:65534:delete::allow -expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} - -# Same for moving the file from elsewhere into a writable -# directory with DELETE_CHILD denied. -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 unlink ${n0} - -# DELETE does not allow for overwriting a file in a unwritable -# directory with DELETE_CHILD denied. -expect 0 create ${n0} 0644 -expect 0 create ../${n3}/${n0} 0644 -expect 0 prependacl . user:65534:write_data::deny -expect 0 prependacl . user:65534:delete_child::deny -expect EPERM -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 prependacl ${n0} user:65534:delete::allow -expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} - -# But it allows for plain deletion. -expect 0 -u 65534 -g 65534 unlink ${n0} - -# DELETE_CHILD allowed on unwritable directory. -expect 0 create ${n0} 0644 -expect 0 prependacl . user:65534:delete_child::allow -expect 0 -u 65534 -g 65534 unlink ${n0} - -# Moving things elsewhere is allowed. -expect 0 create ${n0} 0644 -expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} - -# Moving things back is not. -expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} - -# Even if we're overwriting. -expect 0 create ${n0} 0644 -expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} - -# Even if we have DELETE on the existing file. -expect 0 prependacl ${n0} user:65534:delete::allow -expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} - -# Denied DELETE changes nothing wrt removing. -expect 0 prependacl ${n0} user:65534:delete::deny -expect 0 -u 65534 -g 65534 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n2} diff --git a/tests/granular/04.t b/tests/granular/04.t deleted file mode 100644 index fccb05c6..00000000 --- a/tests/granular/04.t +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/granular/04.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="NFSv4 granular permissions checking - ACL_WRITE_OWNER" - -dir=`dirname $0` -. ${dir}/../misc.sh - -nfsv4acls || quick_exit - -echo "1..22" - -n0=`namegen` -n2=`namegen` - -expect 0 mkdir ${n2} 0755 -cdir=`pwd` -cd ${n2} - -# ACL_WRITE_OWNER permits to set gid to our own only. -expect 0 create ${n0} 0644 -expect 0,0 lstat ${n0} uid,gid -expect EPERM -u 65534 -g 65532,65531 chown ${n0} -1 65532 -expect 0,0 lstat ${n0} uid,gid -expect 0 prependacl ${n0} user:65534:write_owner::allow -expect EPERM -u 65534 -g 65532,65531 chown ${n0} -1 65530 -expect 0,0 lstat ${n0} uid,gid -expect 0 -u 65534 -g 65532,65531 chown ${n0} -1 65532 -expect 0,65532 lstat ${n0} uid,gid -expect 0 unlink ${n0} - -# ACL_WRITE_OWNER permits to set uid to our own only. -expect 0 create ${n0} 0644 -expect 0,0 lstat ${n0} uid,gid -expect EPERM -u 65534 -g 65532,65531 chown ${n0} 65534 65531 -expect 0,0 lstat ${n0} uid,gid -expect 0 prependacl ${n0} user:65534:write_owner::allow -expect EPERM -u 65534 -g 65532,65531 chown ${n0} 65530 65531 -expect 0,0 lstat ${n0} uid,gid -expect 0 -u 65534 -g 65532,65531 chown ${n0} 65534 65531 -expect 65534,65531 lstat ${n0} uid,gid -expect 0 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n2} diff --git a/tests/granular/05.t b/tests/granular/05.t deleted file mode 100644 index 23e89710..00000000 --- a/tests/granular/05.t +++ /dev/null @@ -1,150 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/granular/05.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="NFSv4 granular permissions checking - DELETE and DELETE_CHILD with directories" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:ZFS" ] || quick_exit - -echo "1..68" - -n0=`namegen` -n1=`namegen` -n2=`namegen` -n3=`namegen` - -expect 0 mkdir ${n2} 0755 -expect 0 mkdir ${n3} 0777 -cdir=`pwd` -cd ${n2} - -# Unlink allowed on writable directory. -expect 0 mkdir ${n0} 0755 -expect EACCES -u 65534 -g 65534 rmdir ${n0} -expect 0 prependacl . user:65534:write_data::allow -expect 0 -u 65534 -g 65534 rmdir ${n0} - -# Moving directory elsewhere allowed on writable directory. -expect 0 mkdir ${n0} 0777 -expect 0 prependacl . user:65534:write_data::deny -expect EACCES -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} -expect 0 prependacl . user:65534:write_data::allow -expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} - -# 12 -# Moving directory from elsewhere allowed on writable directory. -expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 prependacl . user:65534:append_data::allow -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 -u 65534 -g 65534 rmdir ${n0} - -# Moving directory from elsewhere overwriting local directory allowed -# on writable directory. -expect 0 mkdir ${n0} 0755 -expect 0 mkdir ../${n3}/${n0} 0777 -expect 0 prependacl . user:65534:write_data::deny -expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 prependacl . user:65534:write_data::allow -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 -u 65534 -g 65534 rmdir ${n0} - -# 23 -# Denied DELETE changes nothing wrt removing. -expect 0 mkdir ${n0} 0755 -expect 0 prependacl ${n0} user:65534:delete::deny -expect 0 -u 65534 -g 65534 rmdir ${n0} - -# Denied DELETE changes nothing wrt moving elsewhere or from elsewhere. -expect 0 mkdir ${n0} 0777 -expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 -u 65534 -g 65534 rmdir ${n0} - -# DELETE_CHILD denies unlink on writable directory. -expect 0 mkdir ${n0} 0755 -expect 0 prependacl . user:65534:delete_child::deny -expect EPERM -u 65534 -g 65534 rmdir ${n0} -expect 0 rmdir ${n0} - -# 35 -# DELETE_CHILD denies moving directory elsewhere. -expect 0 mkdir ${n0} 0777 -expect EPERM -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} -expect 0 rename ${n0} ../${n3}/${n0} - -# DELETE_CHILD does not deny moving directory from elsewhere -# to a writable directory. -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} - -# DELETE_CHILD denies moving directory from elsewhere -# to a writable directory overwriting local directory. -expect 0 mkdir ../${n3}/${n0} 0755 -expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} - -# DELETE allowed on directory allows for unlinking, no matter -# what permissions on containing directory are. -expect 0 prependacl ${n0} user:65534:delete::allow -expect 0 -u 65534 -g 65534 rmdir ${n0} - -# Same for moving the directory elsewhere. -expect 0 mkdir ${n0} 0777 -expect 0 prependacl ${n0} user:65534:delete::allow -expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} - -# 46 -# Same for moving the directory from elsewhere into a writable -# directory with DELETE_CHILD denied. -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 rmdir ${n0} - -# DELETE does not allow for overwriting a directory in a unwritable -# directory with DELETE_CHILD denied. -expect 0 mkdir ${n0} 0755 -expect 0 mkdir ../${n3}/${n0} 0777 -expect 0 prependacl . user:65534:write_data::deny -expect 0 prependacl . user:65534:delete_child::deny -expect EPERM -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 prependacl ${n0} user:65534:delete::allow -# XXX: expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} - -# 54 -# But it allows for plain deletion. -# XXX: expect 0 -u 65534 -g 65534 rmdir ${n0} -expect 0 rmdir ${n0} - -# DELETE_CHILD allowed on unwritable directory. -expect 0 mkdir ${n0} 0755 -expect 0 prependacl . user:65534:delete_child::allow -expect 0 -u 65534 -g 65534 rmdir ${n0} - -# Moving things elsewhere is allowed. -expect 0 mkdir ${n0} 0777 -expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} - -# 60 -# Moving things back is not. -# XXX: expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} - -# Even if we're overwriting. -# XXX: expect 0 mkdir ${n0} 0755 -expect 0 mkdir ../${n3}/${n0} 0777 -# XXX: expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 mkdir ../${n3}/${n0} 0777 - -# Even if we have DELETE on the existing directory. -expect 0 prependacl ${n0} user:65534:delete::allow -# XXX: expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} - -# Denied DELETE changes nothing wrt removing. -expect 0 prependacl ${n0} user:65534:delete::deny -expect 0 -u 65534 -g 65534 rmdir ${n0} - -cd ${cdir} -expect 0 rmdir ${n2} diff --git a/tests/granular/06.t b/tests/granular/06.t deleted file mode 100644 index 48f2a8b2..00000000 --- a/tests/granular/06.t +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD:$ - -desc="NFSv4 granular permissions checking - setuid and setgid are cleared when non-owner calls chown" - -dir=`dirname $0` -. ${dir}/../misc.sh - -nfsv4acls || quick_exit -# ZFS's default aclmode is discard, which prevents non-owners from chowning a -# file -if [ "${fs}" != "ZFS" -o \ - $(zfs get -Hp aclmode $(get_mountpoint) | cut -wf3) != passthrough ] -then - quick_exit -fi - -echo "1..32" - -n0=`namegen` -n2=`namegen` - -expect 0 mkdir ${n2} 0755 -cdir=`pwd` -cd ${n2} - -# When non-owner calls chown(2) successfully, set-uid and set-gid bits are -# removed, except when both uid and gid are equal to -1. -expect 0 create ${n0} 0644 -expect 0 prependacl ${n0} user:65534:write_owner::allow -expect 0 chmod ${n0} 06555 -expect 06555 lstat ${n0} mode -expect 0 -u 65534 -g 65533,65532 chown ${n0} 65534 65532 -expect 0555,65534,65532 lstat ${n0} mode,uid,gid -expect 0 chmod ${n0} 06555 -expect 06555 lstat ${n0} mode -expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 65533 -expect 0555,65534,65533 lstat ${n0} mode,uid,gid -expect 0 chmod ${n0} 06555 -expect 06555 lstat ${n0} mode -expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 -1 -expect 06555,65534,65533 lstat ${n0} mode,uid,gid -expect 0 unlink ${n0} - -expect 0 mkdir ${n0} 0755 -expect 0 prependacl ${n0} user:65534:write_owner::allow -expect 0 chmod ${n0} 06555 -expect 06555 lstat ${n0} mode -expect 0 -u 65534 -g 65533,65532 chown ${n0} 65534 65532 -expect 0555,65534,65532 lstat ${n0} mode,uid,gid -expect 0 chmod ${n0} 06555 -expect 06555 lstat ${n0} mode -expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 65533 -expect 0555,65534,65533 lstat ${n0} mode,uid,gid -expect 0 chmod ${n0} 06555 -expect 06555 lstat ${n0} mode -expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 -1 -expect 06555,65534,65533 lstat ${n0} mode,uid,gid -expect 0 rmdir ${n0} - -cd ${cdir} -expect 0 rmdir ${n2} diff --git a/tests/link/00.t b/tests/link/00.t deleted file mode 100644 index 6d037e31..00000000 --- a/tests/link/00.t +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/link/00.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="link creates hardlinks" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require link - -echo "1..202" - -n0=`namegen` -n1=`namegen` -n2=`namegen` -n3=`namegen` - -expect 0 mkdir ${n3} 0755 -cdir=`pwd` -cd ${n3} - -for type in regular fifo block char socket; do - create_file ${type} ${n0} - expect ${type},1 lstat ${n0} type,nlink - - expect 0 link ${n0} ${n1} - expect ${type},2 lstat ${n0} type,nlink - expect ${type},2 lstat ${n1} type,nlink - - expect 0 link ${n1} ${n2} - expect ${type},3 lstat ${n0} type,nlink - expect ${type},3 lstat ${n1} type,nlink - expect ${type},3 lstat ${n2} type,nlink - - expect 0 chmod ${n1} 0201 - expect 0 chown ${n1} 65534 65533 - - expect ${type},0201,3,65534,65533 lstat ${n0} type,mode,nlink,uid,gid - expect ${type},0201,3,65534,65533 lstat ${n1} type,mode,nlink,uid,gid - expect ${type},0201,3,65534,65533 lstat ${n2} type,mode,nlink,uid,gid - - expect 0 unlink ${n0} - expect ENOENT lstat ${n0} type,mode,nlink,uid,gid - expect ${type},0201,2,65534,65533 lstat ${n1} type,mode,nlink,uid,gid - expect ${type},0201,2,65534,65533 lstat ${n2} type,mode,nlink,uid,gid - - expect 0 unlink ${n2} - expect ENOENT lstat ${n0} type,mode,nlink,uid,gid - expect ${type},0201,1,65534,65533 lstat ${n1} type,mode,nlink,uid,gid - expect ENOENT lstat ${n2} type,mode,nlink,uid,gid - - expect 0 unlink ${n1} - expect ENOENT lstat ${n0} type,mode,nlink,uid,gid - expect ENOENT lstat ${n1} type,mode,nlink,uid,gid - expect ENOENT lstat ${n2} type,mode,nlink,uid,gid -done - -# successful link(2) updates ctime. -for type in regular fifo block char socket; do - create_file ${type} ${n0} - ctime1=`${fstest} stat ${n0} ctime` - dctime1=`${fstest} stat . ctime` - dmtime1=`${fstest} stat . mtime` - sleep 1 - expect 0 link ${n0} ${n1} - ctime2=`${fstest} stat ${n0} ctime` - test_check $ctime1 -lt $ctime2 - dctime2=`${fstest} stat . ctime` - test_check $dctime1 -lt $dctime2 - dmtime2=`${fstest} stat . mtime` - test_check $dctime1 -lt $dmtime2 - expect 0 unlink ${n0} - expect 0 unlink ${n1} -done - -# unsuccessful link(2) does not update ctime. -for type in regular fifo block char socket; do - create_file ${type} ${n0} - expect 0 -- chown ${n0} 65534 -1 - ctime1=`${fstest} stat ${n0} ctime` - dctime1=`${fstest} stat . ctime` - dmtime1=`${fstest} stat . mtime` - sleep 1 - expect EACCES -u 65534 link ${n0} ${n1} - ctime2=`${fstest} stat ${n0} ctime` - test_check $ctime1 -eq $ctime2 - dctime2=`${fstest} stat . ctime` - test_check $dctime1 -eq $dctime2 - dmtime2=`${fstest} stat . mtime` - test_check $dctime1 -eq $dmtime2 - expect 0 unlink ${n0} -done - -cd ${cdir} -expect 0 rmdir ${n3} diff --git a/tests/link/01.t b/tests/link/01.t deleted file mode 100644 index 6fd87c7a..00000000 --- a/tests/link/01.t +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/link/01.t 211474 2010-08-18 22:06:43Z pjd $ - -desc="link returns ENOTDIR if a component of either path prefix is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require link - -echo "1..32" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -for type in regular fifo block char socket; do - create_file ${type} ${n0}/${n1} - expect ENOTDIR link ${n0}/${n1}/test ${n0}/${n2} - create_file ${type} ${n0}/${n2} - expect ENOTDIR link ${n0}/${n2} ${n0}/${n1}/test - expect 0 unlink ${n0}/${n1} - expect 0 unlink ${n0}/${n2} -done -expect 0 rmdir ${n0} diff --git a/tests/link/02.t b/tests/link/02.t deleted file mode 100644 index 87be596c..00000000 --- a/tests/link/02.t +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/link/02.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="link returns ENAMETOOLONG if a component of either pathname exceeded {NAME_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require link - -echo "1..10" - -n0=`namegen` -nx=`namegen_max` -nxx="${nx}x" - -expect 0 create ${nx} 0644 -expect 0 link ${nx} ${n0} -expect 0 unlink ${nx} -expect 0 link ${n0} ${nx} -expect 0 unlink ${n0} -expect 0 unlink ${nx} - -expect 0 create ${n0} 0644 -expect ENAMETOOLONG link ${n0} ${nxx} -expect 0 unlink ${n0} -expect ENAMETOOLONG link ${nxx} ${n0} diff --git a/tests/link/03.t b/tests/link/03.t deleted file mode 100644 index b917bf8e..00000000 --- a/tests/link/03.t +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/link/03.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="link returns ENAMETOOLONG if an entire length of either path name exceeded {PATH_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require link - -echo "1..13" - -n0=`namegen` -nx=`dirgen_max` -nxx="${nx}x" - -mkdir -p "${nx%/*}" - -expect 0 create ${nx} 0644 -expect 0 link ${nx} ${n0} -expect 2 stat ${n0} nlink -expect 2 stat ${nx} nlink -expect 0 unlink ${nx} -expect 0 link ${n0} ${nx} -expect 2 stat ${n0} nlink -expect 2 stat ${nx} nlink -expect 0 unlink ${nx} -expect ENAMETOOLONG link ${n0} ${nxx} -expect 1 stat ${n0} nlink -expect 0 unlink ${n0} -expect ENAMETOOLONG link ${nxx} ${n0} - -rm -rf "${nx%%/*}" diff --git a/tests/link/04.t b/tests/link/04.t deleted file mode 100644 index 255ab322..00000000 --- a/tests/link/04.t +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/link/04.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="link returns ENOENT if a component of either path prefix does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require link - -echo "1..6" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -expect ENOENT link ${n0}/${n1}/test ${n2} -expect 0 create ${n2} 0644 -expect ENOENT link ${n2} ${n0}/${n1}/test -expect 0 unlink ${n2} -expect 0 rmdir ${n0} diff --git a/tests/link/05.t b/tests/link/05.t deleted file mode 100644 index 23fadf40..00000000 --- a/tests/link/05.t +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/link/05.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="link returns EMLINK if the link count of the file named by name1 would exceed 32767" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -require link - -echo "1..5" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` || exit -newfs -i 1 /dev/md${n} >/dev/null || exit -mount /dev/md${n} ${n0} || exit -expect 0 create ${n0}/${n1} 0644 -i=1 -while :; do - link ${n0}/${n1} ${n0}/${i} >/dev/null 2>&1 - if [ $? -ne 0 ]; then - break - fi - i=`expr $i + 1` -done -test_check $i -eq 32767 - -expect EMLINK link ${n0}/${n1} ${n0}/${n2} - -umount /dev/md${n} -mdconfig -d -u ${n} || exit -expect 0 rmdir ${n0} diff --git a/tests/link/08.t b/tests/link/08.t deleted file mode 100644 index 12f4b557..00000000 --- a/tests/link/08.t +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/link/08.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="link returns ELOOP if too many symbolic links were encountered in translating one of the pathnames" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require link - -echo "1..10" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 symlink ${n0} ${n1} -expect 0 symlink ${n1} ${n0} -expect ELOOP link ${n0}/test ${n2} -expect ELOOP link ${n1}/test ${n2} -expect 0 create ${n2} 0644 -expect ELOOP link ${n2} ${n0}/test -expect ELOOP link ${n2} ${n1}/test -expect 0 unlink ${n0} -expect 0 unlink ${n1} -expect 0 unlink ${n2} diff --git a/tests/link/09.t b/tests/link/09.t deleted file mode 100644 index 99db42ee..00000000 --- a/tests/link/09.t +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/link/09.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="link returns ENOENT if the source file does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require link - -echo "1..5" - -n0=`namegen` -n1=`namegen` - -expect 0 create ${n0} 0644 -expect 0 link ${n0} ${n1} -expect 0 unlink ${n0} -expect 0 unlink ${n1} -expect ENOENT link ${n0} ${n1} diff --git a/tests/link/10.t b/tests/link/10.t deleted file mode 100644 index 7013af8a..00000000 --- a/tests/link/10.t +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/link/10.t 211474 2010-08-18 22:06:43Z pjd $ - -desc="link returns EEXIST if the destination file does exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require link - -echo "1..23" - -n0=`namegen` -n1=`namegen` - -expect 0 create ${n0} 0644 - -for type in regular dir fifo block char socket symlink; do - create_file ${type} ${n1} - expect EEXIST link ${n0} ${n1} - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1} - else - expect 0 unlink ${n1} - fi -done - -expect 0 unlink ${n0} diff --git a/tests/link/14.t b/tests/link/14.t deleted file mode 100644 index f068222d..00000000 --- a/tests/link/14.t +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/link/14.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="link returns EXDEV if the source and the destination files are on different file systems" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}" = "FreeBSD" ] || quick_exit - -require link - -echo "1..8" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` || exit -newfs /dev/md${n} >/dev/null || exit -mount /dev/md${n} ${n0} || exit -expect 0 create ${n0}/${n1} 0644 -expect EXDEV link ${n0}/${n1} ${n2} -expect 0 unlink ${n0}/${n1} -expect 0 create ${n1} 0644 -expect EXDEV link ${n1} ${n0}/${n2} -expect 0 unlink ${n1} -umount /dev/md${n} -mdconfig -d -u ${n} || exit -expect 0 rmdir ${n0} diff --git a/tests/link/16.t b/tests/link/16.t deleted file mode 100644 index edb4af2f..00000000 --- a/tests/link/16.t +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/link/16.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="link returns EROFS if the requested link requires writing in a directory on a read-only file system" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}" = "FreeBSD" ] || quick_exit - -require link - -echo "1..9" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` || exit -newfs /dev/md${n} >/dev/null || exit -mount /dev/md${n} ${n0} || exit -expect 0 create ${n0}/${n1} 0644 - -expect 0 link ${n0}/${n1} ${n0}/${n2} -expect 0 unlink ${n0}/${n2} -mount -ur /dev/md${n} -expect EROFS link ${n0}/${n1} ${n0}/${n2} -mount -uw /dev/md${n} -expect 0 link ${n0}/${n1} ${n0}/${n2} -expect 0 unlink ${n0}/${n2} - -expect 0 unlink ${n0}/${n1} -umount /dev/md${n} -mdconfig -d -u ${n} || exit -expect 0 rmdir ${n0} diff --git a/tests/link/17.t b/tests/link/17.t deleted file mode 100644 index ed11a201..00000000 --- a/tests/link/17.t +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/link/17.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="link returns EFAULT if one of the pathnames specified is outside the process's allocated address space" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require link - -echo "1..8" - -n0=`namegen` - -expect 0 create ${n0} 0644 -expect EFAULT link ${n0} NULL -expect EFAULT link ${n0} DEADCODE -expect 0 unlink ${n0} -expect EFAULT link NULL ${n0} -expect EFAULT link DEADCODE ${n0} -expect EFAULT link NULL DEADCODE -expect EFAULT link DEADCODE NULL diff --git a/tests/mkdir/00.t b/tests/mkdir/00.t deleted file mode 100644 index 470b433b..00000000 --- a/tests/mkdir/00.t +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mkdir/00.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="mkdir creates directories" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..36" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n1} 0755 -cdir=`pwd` -cd ${n1} - -# POSIX: The file permission bits of the new directory shall be initialized from -# mode. These file permission bits of the mode argument shall be modified by the -# process' file creation mask. -expect 0 mkdir ${n0} 0755 -expect dir,0755 lstat ${n0} type,mode -expect 0 rmdir ${n0} -expect 0 mkdir ${n0} 0151 -expect dir,0151 lstat ${n0} type,mode -expect 0 rmdir ${n0} -expect 0 -U 077 mkdir ${n0} 0151 -expect dir,0100 lstat ${n0} type,mode -expect 0 rmdir ${n0} -expect 0 -U 070 mkdir ${n0} 0345 -expect dir,0305 lstat ${n0} type,mode -expect 0 rmdir ${n0} -expect 0 -U 0501 mkdir ${n0} 0345 -expect dir,0244 lstat ${n0} type,mode -expect 0 rmdir ${n0} - -# POSIX: The directory's user ID shall be set to the process' effective user ID. -# The directory's group ID shall be set to the group ID of the parent directory -# or to the effective group ID of the process. -expect 0 chown . 65535 65535 -expect 0 -u 65535 -g 65535 mkdir ${n0} 0755 -expect 65535,65535 lstat ${n0} uid,gid -expect 0 rmdir ${n0} -expect 0 -u 65535 -g 65534 mkdir ${n0} 0755 -expect "65535,6553[45]" lstat ${n0} uid,gid -expect 0 rmdir ${n0} -expect 0 chmod . 0777 -expect 0 -u 65534 -g 65533 mkdir ${n0} 0755 -expect "65534,6553[35]" lstat ${n0} uid,gid -expect 0 rmdir ${n0} - -# POSIX: Upon successful completion, mkdir() shall mark for update the st_atime, -# st_ctime, and st_mtime fields of the directory. Also, the st_ctime and -# st_mtime fields of the directory that contains the new entry shall be marked -# for update. -expect 0 chown . 0 0 -time=`${fstest} stat . ctime` -sleep 1 -expect 0 mkdir ${n0} 0755 -atime=`${fstest} stat ${n0} atime` -test_check $time -lt $atime -mtime=`${fstest} stat ${n0} mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat ${n0} ctime` -test_check $time -lt $ctime -mtime=`${fstest} stat . mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat . ctime` -test_check $time -lt $ctime -expect 0 rmdir ${n0} - -cd ${cdir} -expect 0 rmdir ${n1} diff --git a/tests/mkdir/01.t b/tests/mkdir/01.t deleted file mode 100644 index 02a19584..00000000 --- a/tests/mkdir/01.t +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mkdir/01.t 211474 2010-08-18 22:06:43Z pjd $ - -desc="mkdir returns ENOTDIR if a component of the path prefix is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..17" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -for type in regular fifo block char socket; do - create_file ${type} ${n0}/${n1} - expect ENOTDIR mkdir ${n0}/${n1}/test 0755 - expect 0 unlink ${n0}/${n1} -done -expect 0 rmdir ${n0} diff --git a/tests/mkdir/02.t b/tests/mkdir/02.t deleted file mode 100644 index 8197e2ed..00000000 --- a/tests/mkdir/02.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mkdir/02.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="mkdir returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..3" - -nx=`namegen_max` -nxx="${nx}x" - -expect 0 mkdir ${nx} 0755 -expect 0 rmdir ${nx} -expect ENAMETOOLONG mkdir ${nxx} 0755 diff --git a/tests/mkdir/03.t b/tests/mkdir/03.t deleted file mode 100644 index bac61c66..00000000 --- a/tests/mkdir/03.t +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mkdir/03.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="mkdir returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..3" - -nx=`dirgen_max` -nxx="${nx}x" - -mkdir -p "${nx%/*}" - -expect 0 mkdir ${nx} 0755 -expect 0 rmdir ${nx} -expect ENAMETOOLONG mkdir ${nxx} 0755 - -rm -rf "${nx%%/*}" diff --git a/tests/mkdir/04.t b/tests/mkdir/04.t deleted file mode 100644 index da8fbaae..00000000 --- a/tests/mkdir/04.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mkdir/04.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="mkdir returns ENOENT if a component of the path prefix does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..3" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect ENOENT mkdir ${n0}/${n1}/test 0755 -expect 0 rmdir ${n0} diff --git a/tests/mkdir/07.t b/tests/mkdir/07.t deleted file mode 100644 index 611bfdab..00000000 --- a/tests/mkdir/07.t +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mkdir/07.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="mkdir returns ELOOP if too many symbolic links were encountered in translating the pathname" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -n1=`namegen` - -expect 0 symlink ${n0} ${n1} -expect 0 symlink ${n1} ${n0} -expect ELOOP mkdir ${n0}/test 0755 -expect ELOOP mkdir ${n1}/test 0755 -expect 0 unlink ${n0} -expect 0 unlink ${n1} diff --git a/tests/mkdir/09.t b/tests/mkdir/09.t deleted file mode 100644 index a964c74d..00000000 --- a/tests/mkdir/09.t +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mkdir/09.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="mkdir returns EROFS if the named file resides on a read-only file system" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..7" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` || exit -newfs /dev/md${n} >/dev/null || exit -mount /dev/md${n} ${n0} || exit -expect 0 mkdir ${n0}/${n1} 0755 -expect 0 rmdir ${n0}/${n1} -mount -ur /dev/md${n} -expect EROFS mkdir ${n0}/${n1} 0755 -mount -uw /dev/md${n} -expect 0 mkdir ${n0}/${n1} 0755 -expect 0 rmdir ${n0}/${n1} -umount /dev/md${n} -mdconfig -d -u ${n} || exit -expect 0 rmdir ${n0} diff --git a/tests/mkdir/10.t b/tests/mkdir/10.t deleted file mode 100644 index a8c4fefa..00000000 --- a/tests/mkdir/10.t +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mkdir/10.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="mkdir returns EEXIST if the named file exists" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..21" - -n0=`namegen` - -for type in regular dir fifo block char socket symlink; do - create_file ${type} ${n0} - expect EEXIST mkdir ${n0} 0755 - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi -done diff --git a/tests/mkdir/12.t b/tests/mkdir/12.t deleted file mode 100644 index 47dea53c..00000000 --- a/tests/mkdir/12.t +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mkdir/12.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="mkdir returns EFAULT if the path argument points outside the process's allocated address space" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..2" - -expect EFAULT mkdir NULL 0755 -expect EFAULT mkdir DEADCODE 0755 diff --git a/tests/mkfifo/00.t b/tests/mkfifo/00.t deleted file mode 100644 index 59825172..00000000 --- a/tests/mkfifo/00.t +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mkfifo/00.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="mkfifo creates fifo files" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..36" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n1} 0755 -cdir=`pwd` -cd ${n1} - -# POSIX: The file permission bits of the new FIFO shall be initialized from -# mode. The file permission bits of the mode argument shall be modified by the -# process' file creation mask. -expect 0 mkfifo ${n0} 0755 -expect fifo,0755 lstat ${n0} type,mode -expect 0 unlink ${n0} -expect 0 mkfifo ${n0} 0151 -expect fifo,0151 lstat ${n0} type,mode -expect 0 unlink ${n0} -expect 0 -U 077 mkfifo ${n0} 0151 -expect fifo,0100 lstat ${n0} type,mode -expect 0 unlink ${n0} -expect 0 -U 070 mkfifo ${n0} 0345 -expect fifo,0305 lstat ${n0} type,mode -expect 0 unlink ${n0} -expect 0 -U 0501 mkfifo ${n0} 0345 -expect fifo,0244 lstat ${n0} type,mode -expect 0 unlink ${n0} - -# POSIX: The FIFO's user ID shall be set to the process' effective user ID. -# The FIFO's group ID shall be set to the group ID of the parent directory or to -# the effective group ID of the process. -expect 0 chown . 65535 65535 -expect 0 -u 65535 -g 65535 mkfifo ${n0} 0755 -expect 65535,65535 lstat ${n0} uid,gid -expect 0 unlink ${n0} -expect 0 -u 65535 -g 65534 mkfifo ${n0} 0755 -expect "65535,6553[45]" lstat ${n0} uid,gid -expect 0 unlink ${n0} -expect 0 chmod . 0777 -expect 0 -u 65534 -g 65533 mkfifo ${n0} 0755 -expect "65534,6553[35]" lstat ${n0} uid,gid -expect 0 unlink ${n0} - -# POSIX: Upon successful completion, mkfifo() shall mark for update the -# st_atime, st_ctime, and st_mtime fields of the file. Also, the st_ctime and -# st_mtime fields of the directory that contains the new entry shall be marked -# for update. -expect 0 chown . 0 0 -time=`${fstest} stat . ctime` -sleep 1 -expect 0 mkfifo ${n0} 0755 -atime=`${fstest} stat ${n0} atime` -test_check $time -lt $atime -mtime=`${fstest} stat ${n0} mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat ${n0} ctime` -test_check $time -lt $ctime -mtime=`${fstest} stat . mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat . ctime` -test_check $time -lt $ctime -expect 0 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n1} diff --git a/tests/mkfifo/01.t b/tests/mkfifo/01.t deleted file mode 100644 index b3156e95..00000000 --- a/tests/mkfifo/01.t +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mkfifo/01.t 211474 2010-08-18 22:06:43Z pjd $ - -desc="mkfifo returns ENOTDIR if a component of the path prefix is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..17" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -for type in regular fifo block char socket; do - create_file ${type} ${n0}/${n1} - expect ENOTDIR mkfifo ${n0}/${n1}/test 0644 - expect 0 unlink ${n0}/${n1} -done -expect 0 rmdir ${n0} diff --git a/tests/mkfifo/02.t b/tests/mkfifo/02.t deleted file mode 100644 index f6fb3f1f..00000000 --- a/tests/mkfifo/02.t +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mkfifo/02.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="mkfifo returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -nx=`namegen_max` -nxx="${nx}x" - -expect 0 mkfifo ${nx} 0644 -expect fifo,0644 stat ${nx} type,mode -expect 0 unlink ${nx} -expect ENAMETOOLONG mkfifo ${nxx} 0644 diff --git a/tests/mkfifo/03.t b/tests/mkfifo/03.t deleted file mode 100644 index 397640a9..00000000 --- a/tests/mkfifo/03.t +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mkfifo/03.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="mkfifo returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -nx=`dirgen_max` -nxx="${nx}x" - -mkdir -p "${nx%/*}" - -expect 0 mkfifo ${nx} 0644 -expect fifo stat ${nx} type -expect 0 unlink ${nx} -expect ENAMETOOLONG mkfifo ${nxx} 0644 - -rm -rf "${nx%%/*}" diff --git a/tests/mkfifo/04.t b/tests/mkfifo/04.t deleted file mode 100644 index 0e0a4b76..00000000 --- a/tests/mkfifo/04.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mkfifo/04.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="mkfifo returns ENOENT if a component of the path prefix does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..3" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect ENOENT mkfifo ${n0}/${n1}/test 0644 -expect 0 rmdir ${n0} diff --git a/tests/mkfifo/07.t b/tests/mkfifo/07.t deleted file mode 100644 index 1a11eb39..00000000 --- a/tests/mkfifo/07.t +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mkfifo/07.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="mkfifo returns ELOOP if too many symbolic links were encountered in translating the pathname" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -n1=`namegen` - -expect 0 symlink ${n0} ${n1} -expect 0 symlink ${n1} ${n0} -expect ELOOP mkfifo ${n0}/test 0644 -expect ELOOP mkfifo ${n1}/test 0644 -expect 0 unlink ${n0} -expect 0 unlink ${n1} diff --git a/tests/mkfifo/08.t b/tests/mkfifo/08.t deleted file mode 100644 index 7ac6f8b5..00000000 --- a/tests/mkfifo/08.t +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mkfifo/08.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="mkfifo returns EROFS if the named file resides on a read-only file system" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..7" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` || exit -newfs /dev/md${n} >/dev/null || exit -mount /dev/md${n} ${n0} || exit -expect 0 mkfifo ${n0}/${n1} 0644 -expect 0 unlink ${n0}/${n1} -mount -ur /dev/md${n} -expect EROFS mkfifo ${n0}/${n1} 0644 -mount -uw /dev/md${n} -expect 0 mkfifo ${n0}/${n1} 0644 -expect 0 unlink ${n0}/${n1} -umount /dev/md${n} -mdconfig -d -u ${n} || exit -expect 0 rmdir ${n0} diff --git a/tests/mkfifo/09.t b/tests/mkfifo/09.t deleted file mode 100644 index 80437d33..00000000 --- a/tests/mkfifo/09.t +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mkfifo/09.t 211474 2010-08-18 22:06:43Z pjd $ - -desc="mkfifo returns EEXIST if the named file exists" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..21" - -n0=`namegen` - -for type in regular dir fifo block char socket symlink; do - create_file ${type} ${n0} - expect EEXIST mkfifo ${n0} 0644 - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi -done diff --git a/tests/mkfifo/12.t b/tests/mkfifo/12.t deleted file mode 100644 index c7f8107b..00000000 --- a/tests/mkfifo/12.t +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mkfifo/12.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="mkfifo returns EFAULT if the path argument points outside the process's allocated address space" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..2" - -expect EFAULT mkfifo NULL 0644 -expect EFAULT mkfifo DEADCODE 0644 diff --git a/tests/mknod/00.t b/tests/mknod/00.t deleted file mode 100644 index 2ff8c2af..00000000 --- a/tests/mknod/00.t +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mknod/00.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="mknod creates fifo files" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require mknod - -echo "1..36" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n1} 0755 -cdir=`pwd` -cd ${n1} - -# POSIX: The file permission bits of the new FIFO shall be initialized from -# mode. The file permission bits of the mode argument shall be modified by the -# process' file creation mask. -expect 0 mknod ${n0} f 0755 0 0 -expect fifo,0755 lstat ${n0} type,mode -expect 0 unlink ${n0} -expect 0 mknod ${n0} f 0151 0 0 -expect fifo,0151 lstat ${n0} type,mode -expect 0 unlink ${n0} -expect 0 -U 077 mknod ${n0} f 0151 0 0 -expect fifo,0100 lstat ${n0} type,mode -expect 0 unlink ${n0} -expect 0 -U 070 mknod ${n0} f 0345 0 0 -expect fifo,0305 lstat ${n0} type,mode -expect 0 unlink ${n0} -expect 0 -U 0501 mknod ${n0} f 0345 0 0 -expect fifo,0244 lstat ${n0} type,mode -expect 0 unlink ${n0} - -# POSIX: The FIFO's user ID shall be set to the process' effective user ID. -# The FIFO's group ID shall be set to the group ID of the parent directory or to -# the effective group ID of the process. -expect 0 chown . 65535 65535 -expect 0 -u 65535 -g 65535 mknod ${n0} f 0755 0 0 -expect 65535,65535 lstat ${n0} uid,gid -expect 0 unlink ${n0} -expect 0 -u 65535 -g 65534 mknod ${n0} f 0755 0 0 -expect "65535,6553[45]" lstat ${n0} uid,gid -expect 0 unlink ${n0} -expect 0 chmod . 0777 -expect 0 -u 65534 -g 65533 mknod ${n0} f 0755 0 0 -expect "65534,6553[35]" lstat ${n0} uid,gid -expect 0 unlink ${n0} - -# POSIX: Upon successful completion, mknod() shall mark for update the -# st_atime, st_ctime, and st_mtime fields of the file. Also, the st_ctime and -# st_mtime fields of the directory that contains the new entry shall be marked -# for update. -expect 0 chown . 0 0 -time=`${fstest} stat . ctime` -sleep 1 -expect 0 mknod ${n0} f 0755 0 0 -atime=`${fstest} stat ${n0} atime` -test_check $time -lt $atime -mtime=`${fstest} stat ${n0} mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat ${n0} ctime` -test_check $time -lt $ctime -mtime=`${fstest} stat . mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat . ctime` -test_check $time -lt $ctime -expect 0 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n1} diff --git a/tests/mknod/01.t b/tests/mknod/01.t deleted file mode 100644 index 92e21ce8..00000000 --- a/tests/mknod/01.t +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mknod/01.t 211474 2010-08-18 22:06:43Z pjd $ - -desc="mknod returns ENOTDIR if a component of the path prefix is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require mknod - -echo "1..27" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -for type in regular fifo block char socket; do - create_file ${type} ${n0}/${n1} - expect ENOTDIR mknod ${n0}/${n1}/test b 0644 1 2 - expect ENOTDIR mknod ${n0}/${n1}/test c 0644 1 2 - expect ENOTDIR mknod ${n0}/${n1}/test f 0644 0 0 - expect 0 unlink ${n0}/${n1} -done -expect 0 rmdir ${n0} diff --git a/tests/mknod/02.t b/tests/mknod/02.t deleted file mode 100644 index c6a8abcc..00000000 --- a/tests/mknod/02.t +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mknod/02.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="mknod returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require mknod - -echo "1..12" - -nx=`namegen_max` -nxx="${nx}x" - -expect 0 mknod ${nx} f 0644 0 0 -expect fifo,0644 stat ${nx} type,mode -expect 0 unlink ${nx} -expect ENAMETOOLONG mknod ${nxx} f 0644 0 0 - -expect 0 mknod ${nx} b 0644 1 2 -expect block,0644 stat ${nx} type,mode -expect 0 unlink ${nx} -expect ENAMETOOLONG mknod ${nxx} b 0644 0 0 - -expect 0 mknod ${nx} c 0644 1 2 -expect char,0644 stat ${nx} type,mode -expect 0 unlink ${nx} -expect ENAMETOOLONG mknod ${nxx} c 0644 0 0 diff --git a/tests/mknod/03.t b/tests/mknod/03.t deleted file mode 100644 index 0dadadf7..00000000 --- a/tests/mknod/03.t +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mknod/03.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="mknod returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require mknod - -echo "1..12" - -nx=`dirgen_max` -nxx="${nx}x" - -mkdir -p "${nx%/*}" - -expect 0 mknod ${nx} f 0644 0 0 -expect fifo stat ${nx} type -expect 0 unlink ${nx} -expect ENAMETOOLONG mknod ${nxx} f 0644 0 0 - -expect 0 mknod ${nx} b 0644 1 2 -expect block stat ${nx} type -expect 0 unlink ${nx} -expect ENAMETOOLONG mknod ${nxx} b 0644 1 2 - -expect 0 mknod ${nx} c 0644 1 2 -expect char stat ${nx} type -expect 0 unlink ${nx} -expect ENAMETOOLONG mknod ${nxx} c 0644 1 2 - -rm -rf "${nx%%/*}" diff --git a/tests/mknod/04.t b/tests/mknod/04.t deleted file mode 100644 index 5ab25bdf..00000000 --- a/tests/mknod/04.t +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mknod/04.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="mknod returns ENOENT if a component of the path prefix does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require mknod - -echo "1..3" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect ENOENT mknod ${n0}/${n1}/test f 0644 0 0 -expect 0 rmdir ${n0} diff --git a/tests/mknod/07.t b/tests/mknod/07.t deleted file mode 100644 index 7e5e2b71..00000000 --- a/tests/mknod/07.t +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mknod/07.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="mknod returns ELOOP if too many symbolic links were encountered in translating the pathname" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require mknod - -echo "1..6" - -n0=`namegen` -n1=`namegen` - -expect 0 symlink ${n0} ${n1} -expect 0 symlink ${n1} ${n0} -expect ELOOP mknod ${n0}/test f 0644 0 0 -expect ELOOP mknod ${n1}/test f 0644 0 0 -expect 0 unlink ${n0} -expect 0 unlink ${n1} diff --git a/tests/mknod/08.t b/tests/mknod/08.t deleted file mode 100644 index d101277b..00000000 --- a/tests/mknod/08.t +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mknod/08.t 211474 2010-08-18 22:06:43Z pjd $ - -desc="mknod returns EEXIST if the named file exists" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require mknod - -echo "1..35" - -n0=`namegen` - -for type in regular dir fifo block char socket symlink; do - create_file ${type} ${n0} - expect EEXIST mknod ${n0} b 0644 0 0 - expect EEXIST mknod ${n0} c 0644 0 0 - expect EEXIST mknod ${n0} f 0644 0 0 - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi -done diff --git a/tests/mknod/10.t b/tests/mknod/10.t deleted file mode 100644 index e46b735d..00000000 --- a/tests/mknod/10.t +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mknod/10.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="mknod returns EFAULT if the path argument points outside the process's allocated address space" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require mknod - -echo "1..2" - -expect EFAULT mknod NULL f 0644 0 0 -expect EFAULT mknod DEADCODE f 0644 0 0 diff --git a/tests/mknod/11.t b/tests/mknod/11.t deleted file mode 100644 index d48f5af2..00000000 --- a/tests/mknod/11.t +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/mknod/11.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="mknod creates device files" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require mknod - -case "${os}" in -SunOS) - echo "1..40" - ;; -*) - echo "1..28" - ;; -esac - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n1} 0755 -cdir=`pwd` -cd ${n1} - -for type in c b; do - case "${type}" in - c) - stattype="char" - ;; - b) - stattype="block" - ;; - esac - - # Create char special with old-style numbers - expect 0 mknod ${n0} ${type} 0755 1 2 - expect ${stattype},0755 lstat ${n0} type,mode - expect 1,2 lstat ${n0} major,minor - expect EEXIST mknod ${n0} ${type} 0777 3 4 - expect 0 unlink ${n0} - - case "${os}" in - SunOS) - # Create char special with new-style numbers - expect 0 mknod ${n0} ${type} 0755 4095 4095 - expect ${stattype},0755 lstat ${n0} type,mode - expect 4095,4095 lstat ${n0} major,minor - expect EEXIST mknod ${n0} ${type} 0777 4000 4000 - expect 0 unlink ${n0} - - # mknod returns EINVAL if device's numbers are too big - # for 32-bit solaris !! - expect EINVAL mknod ${n0} ${type} 0755 4096 262144 - ;; - esac - - # POSIX: Upon successful completion, mknod(2) shall mark for update the - # st_atime, st_ctime, and st_mtime fields of the file. Also, the st_ctime and - # st_mtime fields of the directory that contains the new entry shall be marked - # for update. - expect 0 chown . 0 0 - time=`${fstest} stat . ctime` - sleep 1 - expect 0 mknod ${n0} ${type} 0755 1 2 - atime=`${fstest} stat ${n0} atime` - test_check $time -lt $atime - mtime=`${fstest} stat ${n0} mtime` - test_check $time -lt $mtime - ctime=`${fstest} stat ${n0} ctime` - test_check $time -lt $ctime - mtime=`${fstest} stat . mtime` - test_check $time -lt $mtime - ctime=`${fstest} stat . ctime` - test_check $time -lt $ctime - expect 0 unlink ${n0} -done - -cd ${cdir} -expect 0 rmdir ${n1} diff --git a/tests/open/00.t b/tests/open/00.t deleted file mode 100644 index 1256761a..00000000 --- a/tests/open/00.t +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/open/00.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="open opens (and eventually creates) a file" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..47" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n1} 0755 -cdir=`pwd` -cd ${n1} - -# POSIX: (If O_CREAT is specified and the file doesn't exist) [...] the access -# permission bits of the file mode shall be set to the value of the third -# argument taken as type mode_t modified as follows: a bitwise AND is performed -# on the file-mode bits and the corresponding bits in the complement of the -# process' file mode creation mask. Thus, all bits in the file mode whose -# corresponding bit in the file mode creation mask is set are cleared. -expect 0 open ${n0} O_CREAT,O_WRONLY 0755 -expect regular,0755 lstat ${n0} type,mode -expect 0 unlink ${n0} -expect 0 open ${n0} O_CREAT,O_WRONLY 0151 -expect regular,0151 lstat ${n0} type,mode -expect 0 unlink ${n0} -expect 0 -U 077 open ${n0} O_CREAT,O_WRONLY 0151 -expect regular,0100 lstat ${n0} type,mode -expect 0 unlink ${n0} -expect 0 -U 070 open ${n0} O_CREAT,O_WRONLY 0345 -expect regular,0305 lstat ${n0} type,mode -expect 0 unlink ${n0} -expect 0 -U 0501 open ${n0} O_CREAT,O_WRONLY 0345 -expect regular,0244 lstat ${n0} type,mode -expect 0 unlink ${n0} - -# POSIX: (If O_CREAT is specified and the file doesn't exist) [...] the user ID -# of the file shall be set to the effective user ID of the process; the group ID -# of the file shall be set to the group ID of the file's parent directory or to -# the effective group ID of the process [...] -expect 0 chown . 65535 65535 -expect 0 -u 65535 -g 65535 open ${n0} O_CREAT,O_WRONLY 0644 -expect 65535,65535 lstat ${n0} uid,gid -expect 0 unlink ${n0} -expect 0 -u 65535 -g 65534 open ${n0} O_CREAT,O_WRONLY 0644 -expect "65535,6553[45]" lstat ${n0} uid,gid -expect 0 unlink ${n0} -expect 0 chmod . 0777 -expect 0 -u 65534 -g 65533 open ${n0} O_CREAT,O_WRONLY 0644 -expect "65534,6553[35]" lstat ${n0} uid,gid -expect 0 unlink ${n0} - -# Update parent directory ctime/mtime if file didn't exist. -expect 0 chown . 0 0 -time=`${fstest} stat . ctime` -sleep 1 -expect 0 open ${n0} O_CREAT,O_WRONLY 0644 -atime=`${fstest} stat ${n0} atime` -test_check $time -lt $atime -mtime=`${fstest} stat ${n0} mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat ${n0} ctime` -test_check $time -lt $ctime -mtime=`${fstest} stat . mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat . ctime` -test_check $time -lt $ctime -expect 0 unlink ${n0} - -# Don't update parent directory ctime/mtime if file existed. -expect 0 create ${n0} 0644 -dmtime=`${fstest} stat . mtime` -dctime=`${fstest} stat . ctime` -sleep 1 -expect 0 open ${n0} O_CREAT,O_RDONLY 0644 -mtime=`${fstest} stat . mtime` -test_check $dmtime -eq $mtime -ctime=`${fstest} stat . ctime` -test_check $dctime -eq $ctime -expect 0 unlink ${n0} - -echo test > ${n0} -expect 5 stat ${n0} size -mtime1=`${fstest} stat ${n0} mtime` -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 open ${n0} O_WRONLY,O_TRUNC -mtime2=`${fstest} stat ${n0} mtime` -test_check $mtime1 -lt $mtime2 -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 stat ${n0} size -expect 0 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n1} diff --git a/tests/open/02.t b/tests/open/02.t deleted file mode 100644 index 292a0073..00000000 --- a/tests/open/02.t +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/open/02.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="open returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -nx=`namegen_max` -nxx="${nx}x" - -expect 0 open ${nx} O_CREAT 0620 -expect regular,0620 stat ${nx} type,mode -expect 0 unlink ${nx} -expect ENAMETOOLONG open ${nxx} O_CREAT 0620 diff --git a/tests/open/03.t b/tests/open/03.t deleted file mode 100644 index 9137cc7a..00000000 --- a/tests/open/03.t +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/open/03.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="open returns ENAMETOOLONG if an entire path name exceeded ${PATH_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -nx=`dirgen_max` -nxx="${nx}x" - -mkdir -p "${nx%/*}" - -expect 0 open ${nx} O_CREAT 0642 -expect regular,0642 stat ${nx} type,mode -expect 0 unlink ${nx} -expect ENAMETOOLONG open ${nxx} O_CREAT 0642 - -rm -rf "${nx%%/*}" diff --git a/tests/open/04.t b/tests/open/04.t deleted file mode 100644 index faaeaf24..00000000 --- a/tests/open/04.t +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/open/04.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="open returns ENOENT if a component of the path name that must exist does not exist or O_CREAT is not set and the named file does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect ENOENT open ${n0}/${n1}/test O_CREAT 0644 -expect ENOENT open ${n0}/${n1} O_RDONLY -expect 0 rmdir ${n0} diff --git a/tests/open/12.t b/tests/open/12.t deleted file mode 100644 index 289c93bc..00000000 --- a/tests/open/12.t +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/open/12.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="open returns ELOOP if too many symbolic links were encountered in translating the pathname" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -n1=`namegen` - -expect 0 symlink ${n0} ${n1} -expect 0 symlink ${n1} ${n0} -expect ELOOP open ${n0}/test O_RDONLY -expect ELOOP open ${n1}/test O_RDONLY -expect 0 unlink ${n0} -expect 0 unlink ${n1} diff --git a/tests/open/13.t b/tests/open/13.t deleted file mode 100644 index b37bf663..00000000 --- a/tests/open/13.t +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/open/13.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="open returns EISDIR when trying to open a directory for writing" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -echo "1..8" - -n0=`namegen` - -expect 0 mkdir ${n0} 0755 - -expect 0 open ${n0} O_RDONLY -expect EISDIR open ${n0} O_WRONLY -expect EISDIR open ${n0} O_RDWR -expect EISDIR open ${n0} O_RDONLY,O_TRUNC -expect EISDIR open ${n0} O_WRONLY,O_TRUNC -expect EISDIR open ${n0} O_RDWR,O_TRUNC - -expect 0 rmdir ${n0} diff --git a/tests/open/14.t b/tests/open/14.t deleted file mode 100644 index 9e085d6d..00000000 --- a/tests/open/14.t +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/open/14.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="open returns EROFS if the named file resides on a read-only file system, and the file is to be modified" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..10" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` || exit -newfs /dev/md${n} >/dev/null || exit -mount /dev/md${n} ${n0} || exit -expect 0 create ${n0}/${n1} 0644 -expect 0 open ${n0}/${n1} O_WRONLY -expect 0 open ${n0}/${n1} O_RDWR -expect 0 open ${n0}/${n1} O_RDONLY,O_TRUNC -mount -ur /dev/md${n} -expect EROFS open ${n0}/${n1} O_WRONLY -expect EROFS open ${n0}/${n1} O_RDWR -expect EROFS open ${n0}/${n1} O_RDONLY,O_TRUNC -mount -uw /dev/md${n} -expect 0 unlink ${n0}/${n1} -umount /dev/md${n} -mdconfig -d -u ${n} || exit -expect 0 rmdir ${n0} diff --git a/tests/open/15.t b/tests/open/15.t deleted file mode 100644 index 336f99f4..00000000 --- a/tests/open/15.t +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/open/15.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="open returns EROFS when O_CREAT is specified and the named file would reside on a read-only file system" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..5" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` || exit -newfs /dev/md${n} >/dev/null || exit -mount /dev/md${n} ${n0} || exit -expect 0 open ${n0}/${n1} O_RDONLY,O_CREAT 0644 -expect 0 unlink ${n0}/${n1} -mount -ur /dev/md${n} -expect EROFS open ${n0}/${n1} O_RDONLY,O_CREAT 0644 -mount -uw /dev/md${n} -umount /dev/md${n} -mdconfig -d -u ${n} || exit -expect 0 rmdir ${n0} diff --git a/tests/open/16.t b/tests/open/16.t deleted file mode 100644 index ed674ab3..00000000 --- a/tests/open/16.t +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/open/16.t 219621 2011-03-13 19:35:13Z pjd $ - -dir=`dirname $0` -. ${dir}/../misc.sh - -if [ "${os}" = "FreeBSD" ]; then - error=EMLINK -else - error=ELOOP -fi -desc="open returns $error when O_NOFOLLOW was specified and the target is a symbolic link" - -echo "1..6" - -n0=`namegen` -n1=`namegen` - -expect 0 symlink ${n0} ${n1} -expect $error open ${n1} O_RDONLY,O_CREAT,O_NOFOLLOW 0644 -expect $error open ${n1} O_RDONLY,O_NOFOLLOW -expect $error open ${n1} O_WRONLY,O_NOFOLLOW -expect $error open ${n1} O_RDWR,O_NOFOLLOW -expect 0 unlink ${n1} diff --git a/tests/open/17.t b/tests/open/17.t deleted file mode 100644 index 27ac9a8c..00000000 --- a/tests/open/17.t +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/open/17.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="open returns ENXIO when O_NONBLOCK is set, the named file is a fifo, O_WRONLY is set, and no process has the file open for reading" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..3" - -n0=`namegen` - -expect 0 mkfifo ${n0} 0644 -expect ENXIO open ${n0} O_WRONLY,O_NONBLOCK -expect 0 unlink ${n0} diff --git a/tests/open/18.t b/tests/open/18.t deleted file mode 100644 index 8fecfdea..00000000 --- a/tests/open/18.t +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/open/18.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="open returns EWOULDBLOCK when O_NONBLOCK and one of O_SHLOCK or O_EXLOCK is specified and the file is locked" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}" = "FreeBSD" ] || quick_exit - -echo "1..6" - -n0=`namegen` - -expect 0 create ${n0} 0644 -expect 0 open ${n0} O_RDONLY,O_SHLOCK : open ${n0} O_RDONLY,O_SHLOCK,O_NONBLOCK -expect "EWOULDBLOCK|EAGAIN" open ${n0} O_RDONLY,O_EXLOCK : open ${n0} O_RDONLY,O_EXLOCK,O_NONBLOCK -expect "EWOULDBLOCK|EAGAIN" open ${n0} O_RDONLY,O_SHLOCK : open ${n0} O_RDONLY,O_EXLOCK,O_NONBLOCK -expect "EWOULDBLOCK|EAGAIN" open ${n0} O_RDONLY,O_EXLOCK : open ${n0} O_RDONLY,O_SHLOCK,O_NONBLOCK -expect 0 unlink ${n0} diff --git a/tests/open/20.t b/tests/open/20.t deleted file mode 100644 index 974f8b5c..00000000 --- a/tests/open/20.t +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/open/20.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="open returns ETXTBSY when the file is a pure procedure (shared text) file that is being executed and the open() system call requests write access" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit -noexec && quick_exit - -echo "1..4" - -n0=`namegen` - -cp -pf `which sleep` ${n0} -./${n0} 3 & -expect ETXTBSY open ${n0} O_WRONLY -expect ETXTBSY open ${n0} O_RDWR -expect ETXTBSY open ${n0} O_RDONLY,O_TRUNC -expect 0 unlink ${n0} diff --git a/tests/open/21.t b/tests/open/21.t deleted file mode 100644 index f8436da9..00000000 --- a/tests/open/21.t +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/open/21.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="open returns EFAULT if the path argument points outside the process's allocated address space" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..2" - -expect EFAULT open NULL O_RDONLY -expect EFAULT open DEADCODE O_RDONLY diff --git a/tests/open/22.t b/tests/open/22.t deleted file mode 100644 index b0444aff..00000000 --- a/tests/open/22.t +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/open/22.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="open returns EEXIST when O_CREAT and O_EXCL were specified and the file exists" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..21" - -n0=`namegen` - -for type in regular dir fifo block char socket symlink; do - create_file ${type} ${n0} - expect EEXIST open ${n0} O_CREAT,O_EXCL 0644 - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi -done diff --git a/tests/open/23.t b/tests/open/23.t deleted file mode 100644 index 78709d75..00000000 --- a/tests/open/23.t +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/open/23.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="open may return EINVAL when an attempt was made to open a descriptor with an illegal combination of O_RDONLY, O_WRONLY, and O_RDWR" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..5" - -n0=`namegen` - -expect 0 create ${n0} 0644 -expect "0|EINVAL" open ${n0} O_RDONLY,O_RDWR -expect "0|EINVAL" open ${n0} O_WRONLY,O_RDWR -expect "0|EINVAL" open ${n0} O_RDONLY,O_WRONLY,O_RDWR -expect 0 unlink ${n0} diff --git a/tests/open/24.t b/tests/open/24.t deleted file mode 100644 index c899be00..00000000 --- a/tests/open/24.t +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/open/24.t 211352 2010-08-15 21:24:17Z pjd $ - -dir=`dirname $0` -. ${dir}/../misc.sh - -# POSIX doesn't explicitly state the errno for open(2)'ing sockets. -case ${os} in -Darwin|FreeBSD) - expected_error=EOPNOTSUPP - ;; -Linux) - expected_error=ENXIO - ;; -*) - echo "1..0 # SKIP: unsupported OS: ${os}" - exit 0 - ;; -esac - -desc="open returns $expected_error when trying to open UNIX domain socket" - -echo "1..5" - -n0=`namegen` - -expect 0 bind ${n0} -expect $expected_error open ${n0} O_RDONLY -expect $expected_error open ${n0} O_WRONLY -expect $expected_error open ${n0} O_RDWR -expect 0 unlink ${n0} diff --git a/tests/open/25.t b/tests/open/25.t deleted file mode 100644 index ec3a3aa3..00000000 --- a/tests/open/25.t +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 - -desc="interact with > 2 GB files" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n1} 0755 -cdir=`pwd` -cd ${n1} - -expect 0 open ${n0} O_CREAT,O_WRONLY 0755 : pwrite 0 "a" $((2 * 1024 * 1024 * 1024 + 1)) -expect $((2 * 1024 * 1024 * 1024 + 2)) lstat ${n0} size -expect "a" open ${n0} O_RDONLY : pread 0 1 $((2 * 1024 * 1024 * 1024 + 1)) -expect 0 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n1} diff --git a/tests/posix_fallocate/00.t b/tests/posix_fallocate/00.t deleted file mode 100644 index 163de0cf..00000000 --- a/tests/posix_fallocate/00.t +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/ftruncate/00.t 219439 2011-03-09 23:11:30Z pjd $ - -desc="posix_fallocate descrease/increase file size" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require posix_fallocate - -echo "1..22" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n1} 0755 -cdir=`pwd` -cd ${n1} - -expect 0 create ${n0} 0644 -expect 0 open ${n0} O_RDWR : posix_fallocate 0 0 567 -expect 567 lstat ${n0} size -expect 0 unlink ${n0} - -dd if=/dev/random of=${n0} bs=12345 count=1 >/dev/null 2>&1 -expect 0 open ${n0} O_RDWR : posix_fallocate 0 20000 3456 -expect 23456 lstat ${n0} size -expect 0 unlink ${n0} - -# successful posix_fallocate(2) updates ctime. -expect 0 create ${n0} 0644 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 open ${n0} O_RDWR : posix_fallocate 0 0 123 -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n0} - -# unsuccessful posix_fallocate(2) does not update ctime. -expect 0 create ${n0} 0644 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect EINVAL open ${n0} O_WRONLY : posix_fallocate 0 0 0 -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 unlink ${n0} - -# The file mode of a newly created file should not affect whether ftruncate -# will work, only the create args -# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=154873 -expect 0 open ${n0} O_CREAT,O_RDWR 0 : posix_fallocate 0 0 1 -expect 0 unlink ${n0} -expect 0 chmod . 0777 -expect 0 -u 65534 open ${n0} O_CREAT,O_RDWR 0 : posix_fallocate 0 0 1 -expect 0 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n1} diff --git a/tests/rename/00.t b/tests/rename/00.t deleted file mode 100644 index 67c757be..00000000 --- a/tests/rename/00.t +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/00.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="rename changes file name" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..122" - -n0=`namegen` -n1=`namegen` -n2=`namegen` -n3=`namegen` - -expect 0 mkdir ${n3} 0755 -cdir=`pwd` -cd ${n3} - -for type in regular fifo block char socket; do - create_file ${type} ${n0} 0644 - expect ${type},0644,1 lstat ${n0} type,mode,nlink - inode=`${fstest} lstat ${n0} inode` - expect 0 rename ${n0} ${n1} - expect ENOENT lstat ${n0} type,mode,nlink - expect ${type},${inode},0644,1 lstat ${n1} type,inode,mode,nlink - expect 0 link ${n1} ${n0} - expect ${type},${inode},0644,2 lstat ${n0} type,inode,mode,nlink - expect ${type},${inode},0644,2 lstat ${n1} type,inode,mode,nlink - expect 0 rename ${n1} ${n2} - expect ${type},${inode},0644,2 lstat ${n0} type,inode,mode,nlink - expect ENOENT lstat ${n1} type,mode,nlink - expect ${type},${inode},0644,2 lstat ${n2} type,inode,mode,nlink - expect 0 unlink ${n0} - expect 0 unlink ${n2} -done - -expect 0 mkdir ${n0} 0755 -expect dir,0755 lstat ${n0} type,mode -inode=`${fstest} lstat ${n0} inode` -expect 0 rename ${n0} ${n1} -expect ENOENT lstat ${n0} type,mode -expect dir,${inode},0755 lstat ${n1} type,inode,mode -expect 0 rmdir ${n1} - -expect 0 create ${n0} 0644 -rinode=`${fstest} lstat ${n0} inode` -expect regular,0644 lstat ${n0} type,mode -expect 0 symlink ${n0} ${n1} -sinode=`${fstest} lstat ${n1} inode` -expect regular,${rinode},0644 stat ${n1} type,inode,mode -expect symlink,${sinode} lstat ${n1} type,inode -expect 0 rename ${n1} ${n2} -expect regular,${rinode},0644 stat ${n0} type,inode,mode -expect ENOENT lstat ${n1} type,mode -expect symlink,${sinode} lstat ${n2} type,inode -expect 0 unlink ${n0} -expect 0 unlink ${n2} - -# unsuccessful link(2) does not update ctime. -for type in regular dir fifo block char socket symlink; do - create_file ${type} ${n0} - ctime1=`${fstest} lstat ${n0} ctime` - sleep 1 - expect EACCES -u 65534 rename ${n0} ${n1} - ctime2=`${fstest} lstat ${n0} ctime` - test_check $ctime1 -eq $ctime2 - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi -done - -cd ${cdir} -expect 0 rmdir ${n3} diff --git a/tests/rename/01.t b/tests/rename/01.t deleted file mode 100644 index 836b6043..00000000 --- a/tests/rename/01.t +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/01.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="rename returns ENAMETOOLONG if a component of either pathname exceeded {NAME_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..8" - -n0=`namegen` -nx=`namegen_max` -nxx="${nx}x" - -expect 0 create ${nx} 0644 -expect 0 rename ${nx} ${n0} -expect 0 rename ${n0} ${nx} -expect 0 unlink ${nx} - -expect 0 create ${n0} 0644 -expect ENAMETOOLONG rename ${n0} ${nxx} -expect 0 unlink ${n0} -expect ENAMETOOLONG rename ${nxx} ${n0} diff --git a/tests/rename/02.t b/tests/rename/02.t deleted file mode 100644 index b7176f39..00000000 --- a/tests/rename/02.t +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/02.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="rename returns ENAMETOOLONG if an entire length of either path name exceeded {PATH_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -nx=`dirgen_max` -nxx="${nx}x" - -mkdir -p "${nx%/*}" - -expect 0 create ${n0} 0644 -expect 0 rename ${n0} ${nx} -expect 0 rename ${nx} ${n0} -expect ENAMETOOLONG rename ${n0} ${nxx} -expect 0 unlink ${n0} -expect ENAMETOOLONG rename ${nxx} ${n0} - -rm -rf "${nx%%/*}" diff --git a/tests/rename/03.t b/tests/rename/03.t deleted file mode 100644 index 8e33079f..00000000 --- a/tests/rename/03.t +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/03.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="rename returns ENOENT if a component of the 'from' path does not exist, or a path prefix of 'to' does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -expect ENOENT rename ${n0}/${n1}/test ${n2} -expect 0 create ${n2} 0644 -expect ENOENT rename ${n2} ${n0}/${n1}/test -expect 0 unlink ${n2} -expect 0 rmdir ${n0} diff --git a/tests/rename/11.t b/tests/rename/11.t deleted file mode 100644 index 3816d080..00000000 --- a/tests/rename/11.t +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/11.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="rename returns ELOOP if too many symbolic links were encountered in translating one of the pathnames" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..10" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 symlink ${n0} ${n1} -expect 0 symlink ${n1} ${n0} -expect ELOOP rename ${n0}/test ${n2} -expect ELOOP rename ${n1}/test ${n2} -expect 0 create ${n2} 0644 -expect ELOOP rename ${n2} ${n0}/test -expect ELOOP rename ${n2} ${n1}/test -expect 0 unlink ${n0} -expect 0 unlink ${n1} -expect 0 unlink ${n2} diff --git a/tests/rename/12.t b/tests/rename/12.t deleted file mode 100644 index 5c122e6a..00000000 --- a/tests/rename/12.t +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/12.t 211474 2010-08-18 22:06:43Z pjd $ - -desc="rename returns ENOTDIR if a component of either path prefix is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..32" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -for type in regular fifo block char socket; do - create_file ${type} ${n0}/${n1} - expect ENOTDIR rename ${n0}/${n1}/test ${n0}/${n2} - create_file ${type} ${n0}/${n2} - expect ENOTDIR link ${n0}/${n2} ${n0}/${n1}/test - expect 0 unlink ${n0}/${n1} - expect 0 unlink ${n0}/${n2} -done -expect 0 rmdir ${n0} diff --git a/tests/rename/13.t b/tests/rename/13.t deleted file mode 100644 index 7e06cc94..00000000 --- a/tests/rename/13.t +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/13.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="rename returns ENOTDIR when the 'from' argument is a directory, but 'to' is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..32" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 - -for type in regular fifo block char socket symlink; do - create_file ${type} ${n1} - expect ENOTDIR rename ${n0} ${n1} - expect dir lstat ${n0} type - expect ${type} lstat ${n1} type - expect 0 unlink ${n1} -done - -expect 0 rmdir ${n0} diff --git a/tests/rename/14.t b/tests/rename/14.t deleted file mode 100644 index d050db9a..00000000 --- a/tests/rename/14.t +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/14.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="rename returns EISDIR when the 'to' argument is a directory, but 'from' is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..32" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 - -for type in regular fifo block char socket symlink; do - create_file ${type} ${n1} - expect EISDIR rename ${n1} ${n0} - expect dir lstat ${n0} type - expect ${type} lstat ${n1} type - expect 0 unlink ${n1} -done - -expect 0 rmdir ${n0} diff --git a/tests/rename/15.t b/tests/rename/15.t deleted file mode 100644 index 5a840136..00000000 --- a/tests/rename/15.t +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/15.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="rename returns EXDEV if the link named by 'to' and the file named by 'from' are on different file systems" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}" = "FreeBSD" ] || quick_exit - -echo "1..23" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` || exit -newfs /dev/md${n} >/dev/null || exit -mount /dev/md${n} ${n0} || exit - -for type in regular dir fifo block char socket symlink; do - create_file ${type} ${n0}/${n1} - expect EXDEV rename ${n0}/${n1} ${n2} - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0}/${n1} - else - expect 0 unlink ${n0}/${n1} - fi -done - -umount /dev/md${n} -mdconfig -d -u ${n} || exit -expect 0 rmdir ${n0} diff --git a/tests/rename/16.t b/tests/rename/16.t deleted file mode 100644 index ec14a97f..00000000 --- a/tests/rename/16.t +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/16.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="rename returns EROFS if the requested link requires writing in a directory on a read-only file system" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}" = "FreeBSD" ] || quick_exit - -echo "1..8" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` || exit -newfs /dev/md${n} >/dev/null || exit -mount /dev/md${n} ${n0} || exit -expect 0 create ${n0}/${n1} 0644 -mount -ur /dev/md${n} - -expect EROFS rename ${n0}/${n1} ${n0}/${n2} -expect EROFS rename ${n0}/${n1} ${n2} -expect 0 create ${n2} 0644 -expect EROFS rename ${n2} ${n0}/${n2} -expect 0 unlink ${n2} - -umount /dev/md${n} -mdconfig -d -u ${n} || exit -expect 0 rmdir ${n0} diff --git a/tests/rename/17.t b/tests/rename/17.t deleted file mode 100644 index 790ea1c1..00000000 --- a/tests/rename/17.t +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/17.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="rename returns EFAULT if one of the pathnames specified is outside the process's allocated address space" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..8" - -n0=`namegen` - -expect 0 create ${n0} 0644 -expect EFAULT rename ${n0} NULL -expect EFAULT rename ${n0} DEADCODE -expect 0 unlink ${n0} -expect EFAULT rename NULL ${n0} -expect EFAULT rename DEADCODE ${n0} -expect EFAULT rename NULL DEADCODE -expect EFAULT rename DEADCODE NULL diff --git a/tests/rename/18.t b/tests/rename/18.t deleted file mode 100644 index 34259635..00000000 --- a/tests/rename/18.t +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/18.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="rename returns EINVAL when the 'from' argument is a parent directory of 'to'" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -expect 0 mkdir ${n0}/${n1} 0755 - -expect EINVAL rename ${n0} ${n0}/${n1} -expect EINVAL rename ${n0} ${n0}/${n1}/${n2} - -expect 0 rmdir ${n0}/${n1} -expect 0 rmdir ${n0} diff --git a/tests/rename/19.t b/tests/rename/19.t deleted file mode 100644 index 787dff69..00000000 --- a/tests/rename/19.t +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/19.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="rename returns EINVAL/EBUSY when an attempt is made to rename '.' or '..'" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -expect 0 mkdir ${n0}/${n1} 0755 - -expect "EINVAL|EBUSY" rename ${n0}/${n1}/. ${n2} -expect "EINVAL|EBUSY" rename ${n0}/${n1}/.. ${n2} - -expect 0 rmdir ${n0}/${n1} -expect 0 rmdir ${n0} diff --git a/tests/rename/20.t b/tests/rename/20.t deleted file mode 100644 index b587278e..00000000 --- a/tests/rename/20.t +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/20.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="rename returns EEXIST or ENOTEMPTY if the 'to' argument is a directory and is not empty" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..25" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -expect 0 mkdir ${n1} 0755 - -for type in regular dir fifo block char socket symlink; do - create_file ${type} ${n1}/${n2} - expect "EEXIST|ENOTEMPTY" rename ${n0} ${n1} - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1}/${n2} - else - expect 0 unlink ${n1}/${n2} - fi -done - -expect 0 rmdir ${n1} -expect 0 rmdir ${n0} diff --git a/tests/rename/21.t b/tests/rename/21.t deleted file mode 100644 index 0489c5c1..00000000 --- a/tests/rename/21.t +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/21.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="write access to subdirectory is required to move it to another directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..16" - -n0=`namegen` -n1=`namegen` -n2=`namegen` -n3=`namegen` - -expect 0 mkdir ${n2} 0777 -expect 0 mkdir ${n3} 0777 -cdir=`pwd` - -# Check that write permission on containing directory (${n2}) is enough -# to rename subdirectory (${n0}). If we rename directory write access -# to this directory may also be required. -expect 0 mkdir ${n2}/${n0} 0700 -expect "0|EACCES" -u 65534 -g 65534 rename ${n2}/${n0} ${n2}/${n1} -expect "0|EACCES" -u 65534 -g 65534 rename ${n2}/${n1} ${n2}/${n0} - -# Check that write permission on containing directory (${n2}) is not enough -# to move subdirectory (${n0}) from that directory. -# Actually POSIX says that write access to ${n2} and ${n3} may be enough -# to move ${n0} from ${n2} to ${n3}. -expect "0|EACCES" -u 65534 -g 65534 rename ${n2}/${n0} ${n3}/${n1} - -expect "0|ENOENT" rmdir ${n2}/${n0} -expect ENOENT rmdir ${n2}/${n0} -expect "0|ENOENT" rmdir ${n3}/${n1} -expect ENOENT rmdir ${n3}/${n1} - -# Check that write permission on containing directory (${n2}) is enough -# to move file (${n0}) from that directory. -expect 0 create ${n2}/${n0} 0644 -expect 0 -u 65534 -g 65534 rename ${n2}/${n0} ${n3}/${n1} - -expect 0 unlink ${n3}/${n1} -expect ENOENT unlink ${n2}/${n0} - -expect 0 rmdir ${n3} -expect 0 rmdir ${n2} diff --git a/tests/rename/22.t b/tests/rename/22.t deleted file mode 100644 index d31816d8..00000000 --- a/tests/rename/22.t +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD$ - -desc="rename changes file ctime" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require rename_ctime - -echo "1..30" - -src=`namegen` -dst=`namegen` -parent=`namegen` - -expect 0 mkdir ${parent} 0755 -cdir=`pwd` -cd ${parent} - -# successful rename(2) updates ctime. -for type in regular dir fifo block char socket symlink; do - create_file ${type} ${src} - ctime1=`${fstest} lstat ${src} ctime` - sleep 1 - expect 0 rename ${src} ${dst} - ctime2=`${fstest} lstat ${dst} ctime` - test_check $ctime1 -lt $ctime2 - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${dst} - else - expect 0 unlink ${dst} - fi -done - -cd ${cdir} -expect 0 rmdir ${parent} diff --git a/tests/rename/23.t b/tests/rename/23.t deleted file mode 100644 index aacffcec..00000000 --- a/tests/rename/23.t +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD$ - -desc="rename succeeds when to is multiply linked" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..42" - -src=`namegen` -dst=`namegen` -dstlnk=`namegen` -parent=`namegen` - -expect 0 mkdir ${parent} 0755 -cdir=`pwd` -cd ${parent} - -for type in regular fifo block char socket; do - create_file ${type} ${src} - create_file ${type} ${dst} - expect 0 link ${dst} ${dstlnk} - ctime1=`${fstest} lstat ${dstlnk} ctime` - sleep 1 - - expect 0 rename ${src} ${dst} - - # destination inode should have reduced nlink and updated ctime - expect ${type},1 lstat ${dstlnk} type,nlink - ctime2=`${fstest} lstat ${dstlnk} ctime` - test_check $ctime1 -lt $ctime2 - - expect 0 unlink ${dst} - expect 0 unlink ${dstlnk} -done - -cd ${cdir} -expect 0 rmdir ${parent} diff --git a/tests/rename/24.t b/tests/rename/24.t deleted file mode 100644 index 47ce576e..00000000 --- a/tests/rename/24.t +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 - -desc="rename of a directory updates its .. link" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..13" - -src_parent=`namegen` -dst_parent=`namegen` -src=`namegen` -dst=`namegen` - -expect 0 mkdir ${src_parent} 0755 -expect 0 mkdir ${dst_parent} 0755 -expect 0 mkdir ${src_parent}/${src} 0755 -cdir=`pwd` - -# Initial conditions -expect 3 lstat ${src_parent} nlink -expect 2 lstat ${dst_parent} nlink -dotdot_inode=`${fstest} lstat ${src_parent} inode` -expect ${dotdot_inode} lstat ${src_parent}/${src}/.. inode - -expect 0 rename ${src_parent}/${src} ${dst_parent}/${dst} - -# The .. link and parents' nlinks values should be updated -expect 2 lstat ${src_parent} nlink -expect 3 lstat ${dst_parent} nlink -dotdot_inode=`${fstest} lstat ${dst_parent} inode` -expect ${dotdot_inode} lstat ${dst_parent}/${dst}/.. inode - -cd ${cdir} -expect 0 rmdir ${dst_parent}/${dst} -expect 0 rmdir ${dst_parent} -expect 0 rmdir ${src_parent} diff --git a/tests/rmdir/00.t b/tests/rmdir/00.t deleted file mode 100644 index 872d423c..00000000 --- a/tests/rmdir/00.t +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/00.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="rmdir removes directories" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..10" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect dir lstat ${n0} type -expect 0 rmdir ${n0} -expect ENOENT lstat ${n0} type - -expect 0 mkdir ${n0} 0755 -expect 0 mkdir ${n0}/${n1} 0755 -time=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 rmdir ${n0}/${n1} -mtime=`${fstest} stat ${n0} mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat ${n0} ctime` -test_check $time -lt $ctime -expect 0 rmdir ${n0} diff --git a/tests/rmdir/01.t b/tests/rmdir/01.t deleted file mode 100644 index bf5fa7a6..00000000 --- a/tests/rmdir/01.t +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/01.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="rmdir returns ENOTDIR if a component of the path is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..14" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect 0 create ${n0}/${n1} 0644 -expect ENOTDIR rmdir ${n0}/${n1}/test -expect 0 unlink ${n0}/${n1} -expect 0 rmdir ${n0} - -expect 0 create ${n0} 0644 -expect ENOTDIR rmdir ${n0} -expect 0 unlink ${n0} - -expect 0 symlink ${n1} ${n0} -expect ENOTDIR rmdir ${n0} -expect 0 unlink ${n0} - -expect 0 mkfifo ${n0} 0644 -expect ENOTDIR rmdir ${n0} -expect 0 unlink ${n0} diff --git a/tests/rmdir/02.t b/tests/rmdir/02.t deleted file mode 100644 index 46d50400..00000000 --- a/tests/rmdir/02.t +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/02.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="rmdir returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -nx=`namegen_max` -nxx="${nx}x" - -expect 0 mkdir ${nx} 0755 -expect 0 rmdir ${nx} -expect ENOENT rmdir ${nx} -expect ENAMETOOLONG rmdir ${nxx} diff --git a/tests/rmdir/03.t b/tests/rmdir/03.t deleted file mode 100644 index d3c5153f..00000000 --- a/tests/rmdir/03.t +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/03.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="rmdir returns ENAMETOOLONG if an entire path name exceeded ${PATH_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..5" - -nx=`dirgen_max` -nxx="${nx}x" - -mkdir -p "${nx%/*}" - -expect 0 mkdir ${nx} 0755 -expect dir,0755 stat ${nx} type,mode -expect 0 rmdir ${nx} -expect ENOENT rmdir ${nx} -expect ENAMETOOLONG rmdir ${nxx} - -rm -rf "${nx%%/*}" diff --git a/tests/rmdir/04.t b/tests/rmdir/04.t deleted file mode 100644 index a9a06dc3..00000000 --- a/tests/rmdir/04.t +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/04.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="rmdir returns ENOENT if the named directory does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect 0 rmdir ${n0} -expect ENOENT rmdir ${n0} -expect ENOENT rmdir ${n1} diff --git a/tests/rmdir/05.t b/tests/rmdir/05.t deleted file mode 100644 index b6237215..00000000 --- a/tests/rmdir/05.t +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/05.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="rmdir returns ELOOP if too many symbolic links were encountered in translating the pathname" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -n1=`namegen` - -expect 0 symlink ${n0} ${n1} -expect 0 symlink ${n1} ${n0} -expect ELOOP rmdir ${n0}/test -expect ELOOP rmdir ${n1}/test -expect 0 unlink ${n0} -expect 0 unlink ${n1} diff --git a/tests/rmdir/06.t b/tests/rmdir/06.t deleted file mode 100644 index 371649cb..00000000 --- a/tests/rmdir/06.t +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/06.t 211474 2010-08-18 22:06:43Z pjd $ - -desc="rmdir returns EEXIST or ENOTEMPTY the named directory contains files other than '.' and '..' in it" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..23" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -for type in regular dir fifo block char socket symlink; do - create_file ${type} ${n0}/${n1} - expect "EEXIST|ENOTEMPTY" rmdir ${n0} - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0}/${n1} - else - expect 0 unlink ${n0}/${n1} - fi -done -expect 0 rmdir ${n0} diff --git a/tests/rmdir/12.t b/tests/rmdir/12.t deleted file mode 100644 index cd0bc911..00000000 --- a/tests/rmdir/12.t +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/12.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="rmdir returns EINVAL if the last component of the path is '.' and EEXIST or ENOTEMPTY if the last component of the path is '..'" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect 0 mkdir ${n0}/${n1} 0755 -expect EINVAL rmdir ${n0}/${n1}/. -todo FreeBSD "According to POSIX: EEXIST or ENOTEMPTY - The path argument names a directory that is not an empty directory, or there are hard links to the directory other than dot or a single entry in dot-dot." -expect "ENOTEMPTY|EEXIST" rmdir ${n0}/${n1}/.. -expect 0 rmdir ${n0}/${n1} -expect 0 rmdir ${n0} diff --git a/tests/rmdir/13.t b/tests/rmdir/13.t deleted file mode 100644 index a4cd55d6..00000000 --- a/tests/rmdir/13.t +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/13.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="rmdir returns EBUSY if the directory to be removed is the mount point for a mounted file system" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}" = "FreeBSD" ] || quick_exit - -echo "1..3" - -n0=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` || exit -newfs /dev/md${n} >/dev/null || exit -mount /dev/md${n} ${n0} || exit -expect EBUSY rmdir ${n0} -umount /dev/md${n} -mdconfig -d -u ${n} || exit -expect 0 rmdir ${n0} diff --git a/tests/rmdir/14.t b/tests/rmdir/14.t deleted file mode 100644 index de8e9697..00000000 --- a/tests/rmdir/14.t +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/14.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="rmdir returns EROFS if the named file resides on a read-only file system" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..5" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` || exit -newfs /dev/md${n} >/dev/null || exit -mount /dev/md${n} ${n0} || exit -expect 0 mkdir ${n0}/${n1} 0755 -mount -ur /dev/md${n} -expect EROFS rmdir ${n0}/${n1} -mount -uw /dev/md${n} -expect 0 rmdir ${n0}/${n1} -umount /dev/md${n} -mdconfig -d -u ${n} || exit -expect 0 rmdir ${n0} diff --git a/tests/rmdir/15.t b/tests/rmdir/15.t deleted file mode 100644 index a81ab2b5..00000000 --- a/tests/rmdir/15.t +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/15.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="rmdir returns EFAULT if the path argument points outside the process's allocated address space" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..2" - -expect EFAULT rmdir NULL -expect EFAULT rmdir DEADCODE diff --git a/tests/symlink/00.t b/tests/symlink/00.t deleted file mode 100644 index 2fcd08e4..00000000 --- a/tests/symlink/00.t +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/symlink/00.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="symlink creates symbolic links" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..14" - -n0=`namegen` -n1=`namegen` - -expect 0 create ${n0} 0644 -expect regular,0644 lstat ${n0} type,mode -expect 0 symlink ${n0} ${n1} -expect symlink lstat ${n1} type -expect regular,0644 stat ${n1} type,mode -expect 0 unlink ${n0} -expect ENOENT stat ${n1} type,mode -expect 0 unlink ${n1} - -expect 0 mkdir ${n0} 0755 -time=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 symlink test ${n0}/${n1} -mtime=`${fstest} stat ${n0} mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat ${n0} ctime` -test_check $time -lt $ctime -expect 0 unlink ${n0}/${n1} -expect 0 rmdir ${n0} diff --git a/tests/symlink/01.t b/tests/symlink/01.t deleted file mode 100644 index 70a09924..00000000 --- a/tests/symlink/01.t +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/symlink/01.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="symlink returns ENOTDIR if a component of the name2 path prefix is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..5" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect 0 create ${n0}/${n1} 0644 -expect ENOTDIR symlink test ${n0}/${n1}/test -expect 0 unlink ${n0}/${n1} -expect 0 rmdir ${n0} diff --git a/tests/symlink/02.t b/tests/symlink/02.t deleted file mode 100644 index e1a7c2af..00000000 --- a/tests/symlink/02.t +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/symlink/02.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="symlink returns ENAMETOOLONG if a component of the name2 pathname exceeded {NAME_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..7" - -n0=`namegen` -nx=`namegen_max` -nxx="${nx}x" - -expect 0 symlink ${nx} ${n0} -expect 0 unlink ${n0} -expect 0 symlink ${n0} ${nx} -expect 0 unlink ${nx} - -expect ENAMETOOLONG symlink ${n0} ${nxx} -expect 0 symlink ${nxx} ${n0} -expect 0 unlink ${n0} diff --git a/tests/symlink/03.t b/tests/symlink/03.t deleted file mode 100644 index 3982b09d..00000000 --- a/tests/symlink/03.t +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/symlink/03.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="symlink returns ENAMETOOLONG if an entire length of either path name exceeded {PATH_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -nx=`dirgen_max` -nxx="${nx}x" - -mkdir -p "${nx%/*}" -expect 0 symlink ${nx} ${n0} -expect 0 unlink ${n0} -expect 0 symlink ${n0} ${nx} -expect 0 unlink ${nx} -expect ENAMETOOLONG symlink ${n0} ${nxx} -expect ENAMETOOLONG symlink ${nxx} ${n0} -rm -rf "${nx%%/*}" diff --git a/tests/symlink/04.t b/tests/symlink/04.t deleted file mode 100644 index fcb805cb..00000000 --- a/tests/symlink/04.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/symlink/04.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="symlink returns ENOENT if a component of the name2 path prefix does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..3" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect ENOENT symlink test ${n0}/${n1}/test -expect 0 rmdir ${n0} diff --git a/tests/symlink/08.t b/tests/symlink/08.t deleted file mode 100644 index 001fffc9..00000000 --- a/tests/symlink/08.t +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/symlink/08.t 211474 2010-08-18 22:06:43Z pjd $ - -desc="symlink returns EEXIST if the name2 argument already exists" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..21" - -n0=`namegen` - -for type in regular dir fifo block char socket symlink; do - create_file ${type} ${n0} - expect EEXIST symlink test ${n0} - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi -done diff --git a/tests/symlink/10.t b/tests/symlink/10.t deleted file mode 100644 index 500ccd81..00000000 --- a/tests/symlink/10.t +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/symlink/10.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="symlink returns EROFS if the file name2 would reside on a read-only file system" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..7" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` || exit -newfs /dev/md${n} >/dev/null || exit -mount /dev/md${n} ${n0} || exit - -expect 0 symlink test ${n0}/${n1} -expect 0 unlink ${n0}/${n1} -mount -ur /dev/md${n} -expect EROFS symlink test ${n0}/${n1} -mount -uw /dev/md${n} -expect 0 symlink test ${n0}/${n1} -expect 0 unlink ${n0}/${n1} - -umount /dev/md${n} -mdconfig -d -u ${n} || exit -expect 0 rmdir ${n0} diff --git a/tests/symlink/12.t b/tests/symlink/12.t deleted file mode 100644 index 7d6263be..00000000 --- a/tests/symlink/12.t +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/symlink/12.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="symlink returns EFAULT if one of the pathnames specified is outside the process's allocated address space" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` - -expect EFAULT symlink NULL ${n0} -expect EFAULT symlink DEADCODE ${n0} -expect EFAULT symlink test NULL -expect EFAULT symlink test DEADCODE -expect EFAULT symlink NULL DEADCODE -expect EFAULT symlink DEADCODE NULL diff --git a/tests/truncate/00.t b/tests/truncate/00.t deleted file mode 100644 index b9e0c31f..00000000 --- a/tests/truncate/00.t +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/00.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="truncate descrease/increase file size" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..21" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n1} 0755 -cdir=`pwd` -cd ${n1} - -expect 0 create ${n0} 0644 -expect 0 truncate ${n0} 1234567 -expect 1234567 lstat ${n0} size -expect 0 truncate ${n0} 567 -expect 567 lstat ${n0} size -expect 0 unlink ${n0} - -dd if=/dev/random of=${n0} bs=12345 count=1 >/dev/null 2>&1 -expect 0 truncate ${n0} 23456 -expect 23456 lstat ${n0} size -expect 0 truncate ${n0} 1 -expect 1 lstat ${n0} size -expect 0 unlink ${n0} - -# successful truncate(2) updates ctime. -expect 0 create ${n0} 0644 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 truncate ${n0} 123 -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n0} - -# unsuccessful truncate(2) does not update ctime. -expect 0 create ${n0} 0644 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect EACCES -u 65534 truncate ${n0} 123 -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n1} diff --git a/tests/truncate/01.t b/tests/truncate/01.t deleted file mode 100644 index 7360a57f..00000000 --- a/tests/truncate/01.t +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/01.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="truncate returns ENOTDIR if a component of the path prefix is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..5" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect 0 create ${n0}/${n1} 0644 -expect ENOTDIR truncate ${n0}/${n1}/test 123 -expect 0 unlink ${n0}/${n1} -expect 0 rmdir ${n0} diff --git a/tests/truncate/02.t b/tests/truncate/02.t deleted file mode 100644 index 823d01c2..00000000 --- a/tests/truncate/02.t +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/02.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="truncate returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..5" - -nx=`namegen_max` -nxx="${nx}x" - -expect 0 create ${nx} 0644 -expect 0 truncate ${nx} 123 -expect 123 stat ${nx} size -expect 0 unlink ${nx} -expect ENAMETOOLONG truncate ${nxx} 123 diff --git a/tests/truncate/03.t b/tests/truncate/03.t deleted file mode 100644 index d3d3ab3d..00000000 --- a/tests/truncate/03.t +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/03.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="truncate returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..5" - -nx=`dirgen_max` -nxx="${nx}x" - -mkdir -p "${nx%/*}" - -expect 0 create ${nx} 0644 -expect 0 truncate ${nx} 123 -expect regular,123 stat ${nx} type,size -expect 0 unlink ${nx} -expect ENAMETOOLONG truncate ${nxx} 123 - -rm -rf "${nx%%/*}" diff --git a/tests/truncate/04.t b/tests/truncate/04.t deleted file mode 100644 index ba7c4e5e..00000000 --- a/tests/truncate/04.t +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/04.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="truncate returns ENOENT if the named file does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect ENOENT truncate ${n0}/${n1}/test 123 -expect ENOENT truncate ${n0}/${n1} 123 -expect 0 rmdir ${n0} diff --git a/tests/truncate/07.t b/tests/truncate/07.t deleted file mode 100644 index 52c3f6cb..00000000 --- a/tests/truncate/07.t +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/07.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="truncate returns ELOOP if too many symbolic links were encountered in translating the pathname" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -n1=`namegen` - -expect 0 symlink ${n0} ${n1} -expect 0 symlink ${n1} ${n0} -expect ELOOP truncate ${n0}/test 123 -expect ELOOP truncate ${n1}/test 123 -expect 0 unlink ${n0} -expect 0 unlink ${n1} diff --git a/tests/truncate/09.t b/tests/truncate/09.t deleted file mode 100644 index c0a805c5..00000000 --- a/tests/truncate/09.t +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/09.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="truncate returns EISDIR if the named file is a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..3" - -n0=`namegen` - -expect 0 mkdir ${n0} 0755 -expect EISDIR truncate ${n0} 123 -expect 0 rmdir ${n0} diff --git a/tests/truncate/10.t b/tests/truncate/10.t deleted file mode 100644 index c8b8eaad..00000000 --- a/tests/truncate/10.t +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/10.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="truncate returns EROFS if the named file resides on a read-only file system" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..10" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` || exit -newfs /dev/md${n} >/dev/null || exit -mount /dev/md${n} ${n0} || exit -expect 0 create ${n0}/${n1} 0644 -expect 0 truncate ${n0}/${n1} 123 -expect 123 stat ${n0}/${n1} size -mount -ur /dev/md${n} -expect EROFS truncate ${n0}/${n1} 1234 -expect 123 stat ${n0}/${n1} size -mount -uw /dev/md${n} -expect 0 truncate ${n0}/${n1} 1234 -expect 1234 stat ${n0}/${n1} size -expect 0 unlink ${n0}/${n1} -umount /dev/md${n} -mdconfig -d -u ${n} || exit -expect 0 rmdir ${n0} diff --git a/tests/truncate/11.t b/tests/truncate/11.t deleted file mode 100644 index 2b28dfde..00000000 --- a/tests/truncate/11.t +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/11.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="truncate returns ETXTBSY the file is a pure procedure (shared text) file that is being executed" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}" = "FreeBSD" ] || quick_exit -noexec && quick_exit - -echo "1..2" - -n0=`namegen` - -cp -pf `which sleep` ${n0} -./${n0} 3 & -expect ETXTBSY truncate ${n0} 123 -expect 0 unlink ${n0} diff --git a/tests/truncate/13.t b/tests/truncate/13.t deleted file mode 100644 index 97a27aec..00000000 --- a/tests/truncate/13.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/13.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="truncate returns EINVAL if the length argument was less than 0" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -n0=`namegen` - -expect 0 create ${n0} 0644 -expect EINVAL -- truncate ${n0} -1 -expect EINVAL -- truncate ${n0} -999999 -expect 0 unlink ${n0} diff --git a/tests/truncate/14.t b/tests/truncate/14.t deleted file mode 100644 index a6d4ed55..00000000 --- a/tests/truncate/14.t +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/14.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="truncate returns EFAULT if the path argument points outside the process's allocated address space" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..2" - -expect EFAULT truncate NULL 123 -expect EFAULT truncate DEADCODE 123 diff --git a/tests/unlink/00.t b/tests/unlink/00.t deleted file mode 100644 index cb01a834..00000000 --- a/tests/unlink/00.t +++ /dev/null @@ -1,213 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/unlink/00.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="unlink removes regular files, symbolic links, fifos and sockets" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..112" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n2} 0755 -cdir=`pwd` -cd ${n2} - -expect 0 create ${n0} 0644 -expect regular lstat ${n0} type -expect 0 unlink ${n0} -expect ENOENT lstat ${n0} type - -expect 0 symlink ${n1} ${n0} -expect symlink lstat ${n0} type -expect 0 unlink ${n0} -expect ENOENT lstat ${n0} type - -expect 0 mkfifo ${n0} 0644 -expect fifo lstat ${n0} type -expect 0 unlink ${n0} -expect ENOENT lstat ${n0} type - -expect 0 mknod ${n0} b 0644 1 2 -expect block lstat ${n0} type -expect 0 unlink ${n0} -expect ENOENT lstat ${n0} type - -expect 0 mknod ${n0} c 0644 1 2 -expect char lstat ${n0} type -expect 0 unlink ${n0} -expect ENOENT lstat ${n0} type - -expect 0 bind ${n0} -expect socket lstat ${n0} type -expect 0 unlink ${n0} -expect ENOENT lstat ${n0} type - -# successful unlink(2) updates ctime. -expect 0 create ${n0} 0644 -expect 0 link ${n0} ${n1} -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 unlink ${n1} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n0} - -expect 0 mkfifo ${n0} 0644 -expect 0 link ${n0} ${n1} -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 unlink ${n1} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n0} - -expect 0 mknod ${n0} b 0644 1 2 -expect 0 link ${n0} ${n1} -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 unlink ${n1} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n0} - -expect 0 mknod ${n0} c 0644 1 2 -expect 0 link ${n0} ${n1} -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 unlink ${n1} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n0} - -expect 0 bind ${n0} -expect 0 link ${n0} ${n1} -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 unlink ${n1} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n0} - -# unsuccessful unlink(2) does not update ctime. -expect 0 create ${n0} 0644 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect EACCES -u 65534 unlink ${n0} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 unlink ${n0} - -expect 0 mkfifo ${n0} 0644 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect EACCES -u 65534 unlink ${n0} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 unlink ${n0} - -expect 0 mknod ${n0} b 0644 1 2 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect EACCES -u 65534 unlink ${n0} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 unlink ${n0} - -expect 0 mknod ${n0} c 0644 1 2 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect EACCES -u 65534 unlink ${n0} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 unlink ${n0} - -expect 0 bind ${n0} -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect EACCES -u 65534 unlink ${n0} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 unlink ${n0} - -expect 0 mkdir ${n0} 0755 -expect 0 create ${n0}/${n1} 0644 -time=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 unlink ${n0}/${n1} -mtime=`${fstest} stat ${n0} mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat ${n0} ctime` -test_check $time -lt $ctime -expect 0 rmdir ${n0} - -expect 0 mkdir ${n0} 0755 -expect 0 mkfifo ${n0}/${n1} 0644 -time=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 unlink ${n0}/${n1} -mtime=`${fstest} stat ${n0} mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat ${n0} ctime` -test_check $time -lt $ctime -expect 0 rmdir ${n0} - -expect 0 mkdir ${n0} 0755 -expect 0 mknod ${n0}/${n1} b 0644 1 2 -time=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 unlink ${n0}/${n1} -mtime=`${fstest} stat ${n0} mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat ${n0} ctime` -test_check $time -lt $ctime -expect 0 rmdir ${n0} - -expect 0 mkdir ${n0} 0755 -expect 0 mknod ${n0}/${n1} c 0644 1 2 -time=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 unlink ${n0}/${n1} -mtime=`${fstest} stat ${n0} mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat ${n0} ctime` -test_check $time -lt $ctime -expect 0 rmdir ${n0} - -expect 0 mkdir ${n0} 0755 -expect 0 bind ${n0}/${n1} -time=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 unlink ${n0}/${n1} -mtime=`${fstest} stat ${n0} mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat ${n0} ctime` -test_check $time -lt $ctime -expect 0 rmdir ${n0} - -expect 0 mkdir ${n0} 0755 -expect 0 symlink test ${n0}/${n1} -time=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 unlink ${n0}/${n1} -mtime=`${fstest} stat ${n0} mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat ${n0} ctime` -test_check $time -lt $ctime -expect 0 rmdir ${n0} - -expect 0 create ${n0} 0644 -expect 0 link ${n0} ${n1} -time=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 unlink ${n1} -ctime=`${fstest} stat ${n0} ctime` -test_check $time -lt $ctime -expect 0 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n2} diff --git a/tests/unlink/01.t b/tests/unlink/01.t deleted file mode 100644 index a7d4f04c..00000000 --- a/tests/unlink/01.t +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/unlink/01.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="unlink returns ENOTDIR if a component of the path prefix is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..5" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect 0 create ${n0}/${n1} 0644 -expect ENOTDIR unlink ${n0}/${n1}/test -expect 0 unlink ${n0}/${n1} -expect 0 rmdir ${n0} diff --git a/tests/unlink/02.t b/tests/unlink/02.t deleted file mode 100644 index a7b90646..00000000 --- a/tests/unlink/02.t +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/unlink/02.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="unlink returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -nx=`namegen_max` -nxx="${nx}x" - -expect 0 create ${nx} 0644 -expect 0 unlink ${nx} -expect ENOENT unlink ${nx} -expect ENAMETOOLONG unlink ${nxx} diff --git a/tests/unlink/03.t b/tests/unlink/03.t deleted file mode 100644 index 16816658..00000000 --- a/tests/unlink/03.t +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/unlink/03.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="unlink returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -nx=`dirgen_max` -nxx="${nx}x" - -mkdir -p "${nx%/*}" - -expect 0 create ${nx} 0644 -expect 0 unlink ${nx} -expect ENOENT unlink ${nx} -expect ENAMETOOLONG unlink ${nxx} - -rm -rf "${nx%%/*}" diff --git a/tests/unlink/04.t b/tests/unlink/04.t deleted file mode 100644 index f8f59500..00000000 --- a/tests/unlink/04.t +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/unlink/04.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="unlink returns ENOENT if the named file does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -n0=`namegen` -n1=`namegen` - -expect 0 create ${n0} 0644 -expect 0 unlink ${n0} -expect ENOENT unlink ${n0} -expect ENOENT unlink ${n1} diff --git a/tests/unlink/07.t b/tests/unlink/07.t deleted file mode 100644 index 84560f2e..00000000 --- a/tests/unlink/07.t +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/unlink/07.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="unlink returns ELOOP if too many symbolic links were encountered in translating the pathname" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -n1=`namegen` - -expect 0 symlink ${n0} ${n1} -expect 0 symlink ${n1} ${n0} -expect ELOOP unlink ${n0}/test -expect ELOOP unlink ${n1}/test -expect 0 unlink ${n0} -expect 0 unlink ${n1} diff --git a/tests/unlink/12.t b/tests/unlink/12.t deleted file mode 100644 index 69d574ae..00000000 --- a/tests/unlink/12.t +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/unlink/12.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="unlink returns EROFS if the named file resides on a read-only file system" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..5" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` || exit -newfs /dev/md${n} >/dev/null || exit -mount /dev/md${n} ${n0} || exit -expect 0 create ${n0}/${n1} 0644 -mount -ur /dev/md${n} -expect EROFS unlink ${n0}/${n1} -mount -uw /dev/md${n} -expect 0 unlink ${n0}/${n1} -umount /dev/md${n} -mdconfig -d -u ${n} || exit -expect 0 rmdir ${n0} diff --git a/tests/unlink/13.t b/tests/unlink/13.t deleted file mode 100644 index 4d0268fe..00000000 --- a/tests/unlink/13.t +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD: head/tools/regression/pjdfstest/tests/unlink/13.t 211352 2010-08-15 21:24:17Z pjd $ - -desc="unlink returns EFAULT if the path argument points outside the process's allocated address space" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..2" - -expect EFAULT unlink NULL -expect EFAULT unlink DEADCODE diff --git a/tests/unlink/14.t b/tests/unlink/14.t deleted file mode 100644 index 1059915a..00000000 --- a/tests/unlink/14.t +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD$ - -desc="An open file will not be immediately freed by unlink" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..7" - -n0=`namegen` -n2=`namegen` - -expect 0 mkdir ${n2} 0755 -cdir=`pwd` -cd ${n2} - -# Stating open but deleted files should work -expect 0 create ${n0} 0644 -expect 0 open ${n0} O_WRONLY : write 0 "Hello, World!" -# A deleted file's link count should be 0 -expect 0 open ${n0} O_RDONLY : unlink ${n0} : fstat 0 nlink - -# I/O to open but deleted files should work, too -expect 0 create ${n0} 0644 -expect "Hello,_World!" open ${n0} O_RDWR : \ - write 0 "Hello,_World!" : \ - unlink ${n0} : \ - pread 0 13 0 - -cd ${cdir} -expect 0 rmdir ${n2} diff --git a/tests/utimensat/00.t b/tests/utimensat/00.t deleted file mode 100644 index 5a755851..00000000 --- a/tests/utimensat/00.t +++ /dev/null @@ -1,36 +0,0 @@ -#! /bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD$ - -desc="utimensat changes timestamps on any type of file" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require "utimensat" - -echo "1..32" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n1} 0755 -cdir=`pwd` -cd ${n1} - -DATE1=1900000000 #Sun Mar 17 11:46:40 MDT 2030 -DATE2=1950000000 #Fri Oct 17 04:40:00 MDT 2031 -for type in regular dir fifo block char socket; do - create_file ${type} ${n0} - expect 0 open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 $DATE2 0 0 - expect $DATE1 lstat ${n0} atime - expect $DATE2 lstat ${n0} mtime - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi -done - -cd ${cdir} -expect 0 rmdir ${n1} diff --git a/tests/utimensat/01.t b/tests/utimensat/01.t deleted file mode 100644 index 0de42ca5..00000000 --- a/tests/utimensat/01.t +++ /dev/null @@ -1,56 +0,0 @@ -#! /bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD$ - -desc="utimensat with UTIME_NOW will set the will set typestamps to now" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require "utimensat" - -echo "1..7" - -n0=`namegen` -n1=`namegen` -TIME_MARGIN=300 # Allow up to a 5 minute delta between the timestamps - -expect 0 mkdir ${n1} 0755 -cdir=`pwd` -cd ${n1} - - -create_file regular ${n0} -old_mtime=`$fstest lstat ${n0} mtime` -old_atime=`$fstest lstat ${n0} atime` -sleep 1 # Ensure that future timestamps will be different than this one - -expect 0 open . O_RDONLY : utimensat 0 ${n0} 0 UTIME_NOW 0 UTIME_NOW 0 -new_mtime=`$fstest lstat ${n0} mtime` -new_atime=`$fstest lstat ${n0} atime` -delta_mtime=$(( $new_mtime - $old_mtime )) -delta_atime=$(( $new_atime - $old_atime )) - -if [ "$delta_mtime" -gt 0 ]; then - if [ "$delta_mtime" -lt $TIME_MARGIN ]; then - echo "ok 4" - else - echo "not ok 4 new mtime is implausibly far in the future" - fi -else - echo "not ok 4 mtime was not updated" -fi -if [ "$delta_atime" -gt 0 ]; then - if [ "$delta_atime" -lt $TIME_MARGIN ]; then - echo "ok 5" - else - echo "not ok 5 new atime is implausibly far in the future" - fi -else - echo "not ok 5 atime was not updated" -fi -ntest=$((ntest+2)) -expect 0 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n1} diff --git a/tests/utimensat/02.t b/tests/utimensat/02.t deleted file mode 100644 index 993a5b22..00000000 --- a/tests/utimensat/02.t +++ /dev/null @@ -1,35 +0,0 @@ -#! /bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD$ - -desc="utimensat with UTIME_OMIT will leave the time unchanged" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require "utimensat" - -echo "1..10" - -n0=`namegen` -n1=`namegen` -DATE1=1900000000 #Sun Mar 17 11:46:40 MDT 2030 -DATE2=1950000000 #Fri Oct 17 04:40:00 MDT 2031 - -expect 0 mkdir ${n1} 0755 -cdir=`pwd` -cd ${n1} - -create_file regular ${n0} -orig_mtime=`$fstest lstat ${n0} mtime` -expect 0 open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 0 UTIME_OMIT 0 -expect $DATE1 lstat ${n0} atime -expect $orig_mtime lstat ${n0} mtime - -expect 0 open . O_RDONLY : utimensat 0 ${n0} 0 UTIME_OMIT $DATE2 0 0 -expect $DATE1 lstat ${n0} atime -expect $DATE2 lstat ${n0} mtime -expect 0 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n1} diff --git a/tests/utimensat/03.t b/tests/utimensat/03.t deleted file mode 100644 index f27cdc3c..00000000 --- a/tests/utimensat/03.t +++ /dev/null @@ -1,39 +0,0 @@ -#! /bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD$ - -desc="utimensat can update birthtimes" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require "utimensat" - -require stat_st_birthtime - -echo "1..12" - -n0=`namegen` -n1=`namegen` -DATE1=100000000 #Sat Mar 3 02:46:40 MST 1973 -DATE2=200000000 #Mon May 3 13:33:20 MDT 1976 - -expect 0 mkdir ${n1} 0755 -cdir=`pwd` -cd ${n1} - -create_file regular ${n0} -expect 0 open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 $DATE1 0 0 -expect $DATE1 lstat ${n0} atime -expect $DATE1 lstat ${n0} mtime -expect $DATE1 lstat ${n0} birthtime - -expect 0 open . O_RDONLY : utimensat 0 ${n0} $DATE2 0 $DATE2 0 0 -expect $DATE2 lstat ${n0} atime -expect $DATE2 lstat ${n0} mtime -expect $DATE1 lstat ${n0} birthtime - -expect 0 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n1} diff --git a/tests/utimensat/04.t b/tests/utimensat/04.t deleted file mode 100644 index d3efe950..00000000 --- a/tests/utimensat/04.t +++ /dev/null @@ -1,36 +0,0 @@ -#! /bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD$ - -desc="utimensat can set mtime < atime or vice versa" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require "utimensat" - -echo "1..10" - -n0=`namegen` -n1=`namegen` -DATE1=100000000 #Sat Mar 3 02:46:40 MST 1973 -DATE2=200000000 #Mon May 3 13:33:20 MDT 1976 - -expect 0 mkdir ${n1} 0755 -cdir=`pwd` -cd ${n1} - - -create_file regular ${n0} -expect 0 open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 $DATE2 0 0 -expect $DATE1 lstat ${n0} atime -expect $DATE2 lstat ${n0} mtime - -expect 0 open . O_RDONLY : utimensat 0 ${n0} $DATE2 0 $DATE1 0 0 -expect $DATE2 lstat ${n0} atime -expect $DATE1 lstat ${n0} mtime - -expect 0 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n1} diff --git a/tests/utimensat/05.t b/tests/utimensat/05.t deleted file mode 100644 index 0e205591..00000000 --- a/tests/utimensat/05.t +++ /dev/null @@ -1,53 +0,0 @@ -#! /bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD$ - -desc="utimensat can follow symlinks" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require "utimensat" - -echo "1..16" - -n0=`namegen` -n1=`namegen` -n2=`namegen` -DATE1=1900000000 #Sun Mar 17 11:46:40 MDT 2030 -DATE2=1950000000 #Fri Oct 17 04:40:00 MDT 2031 -DATE3=1960000000 #Mon Feb 9 21:26:40 MST 2032 -DATE4=1970000000 #Fri Jun 4 16:13:20 MDT 2032 -DATE5=1980000000 #Tue Sep 28 10:00:00 MDT 2032 -DATE6=1990000000 #Sat Jan 22 02:46:40 MST 2033 - -expect 0 mkdir ${n1} 0755 -cdir=`pwd` -cd ${n1} - - -create_file regular ${n0} -ln -s ${n0} ${n2} -expect 0 open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 $DATE2 0 0 - -expect 0 open . O_RDONLY : utimensat 0 ${n2} $DATE3 0 $DATE4 0 AT_SYMLINK_NOFOLLOW -expect $DATE1 lstat ${n0} atime -expect $DATE2 lstat ${n0} mtime -expect $DATE3 lstat ${n2} atime -expect $DATE4 lstat ${n2} mtime - -expect 0 open . O_RDONLY : utimensat 0 ${n2} $DATE5 0 $DATE6 0 0 -expect $DATE5 lstat ${n0} atime -expect $DATE6 lstat ${n0} mtime -# If atime is disabled on the current mount, then ${n2}'s atime should still be -# $DATE3. However, if atime is enabled, then ${n2}'s atime will be the current -# system time. For this test, it's sufficient to simply check that it didn't -# get set to DATE5 -test_check "$DATE5" -ne `"$fstest" lstat ${n2} atime` -expect $DATE4 lstat ${n2} mtime - -expect 0 unlink ${n0} -expect 0 unlink ${n2} - -cd ${cdir} -expect 0 rmdir ${n1} diff --git a/tests/utimensat/06.t b/tests/utimensat/06.t deleted file mode 100644 index 04b62311..00000000 --- a/tests/utimensat/06.t +++ /dev/null @@ -1,46 +0,0 @@ -#! /bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD$ - -desc="utimensat with UTIME_NOW will work if the caller has write permission" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require "utimensat" -require "UTIME_NOW" - -echo "1..13" - -n0=`namegen` -n1=`namegen` -UID_NOBODY=`id -u nobody` -GID_NOBODY=`id -g nobody` -UID_ROOT=`id -u root` -GID_ROOT=`id -g root` - -expect 0 mkdir ${n1} 0755 -cdir=`pwd` -cd ${n1} - -create_file regular ${n0} 0644 -# First check that nobody can't update the timestamps -expect EACCES -u $UID_NOBODY open . O_RDONLY : utimensat 0 ${n0} 0 UTIME_NOW 0 UTIME_NOW 0 - -# Now check that the owner can update the timestamps -expect 0 chown ${n0} $UID_NOBODY $GID_NOBODY -expect 0 chmod ${n0} 0444 -expect 0 -u $UID_NOBODY open . O_RDONLY : utimensat 0 ${n0} 0 UTIME_NOW 0 UTIME_NOW 0 - -# Now check that the superuser can update the timestamps -expect 0 -u $UID_ROOT open . O_RDONLY : utimensat 0 ${n0} 0 UTIME_OMIT 0 UTIME_OMIT 0 - -# Now check that anyone with write permission can update the timestamps -expect 0 chown ${n0} $UID_ROOT $GID_ROOT -expect 0 chmod ${n0} 0666 -expect 0 -u $UID_NOBODY open . O_RDONLY : utimensat 0 ${n0} 0 UTIME_NOW 0 UTIME_NOW 0 - -expect 0 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n1} diff --git a/tests/utimensat/07.t b/tests/utimensat/07.t deleted file mode 100644 index b194f081..00000000 --- a/tests/utimensat/07.t +++ /dev/null @@ -1,51 +0,0 @@ -#! /bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD$ - -desc="utimensat will work if the caller is the owner or root" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require "utimensat" - -echo "1..17" - -n0=`namegen` -n1=`namegen` -DATE1=1900000000 #Sun Mar 17 11:46:40 MDT 2030 -DATE2=1950000000 #Fri Oct 17 04:40:00 MDT 2031 -UID_NOBODY=`id -u nobody` -GID_NOBODY=`id -g nobody` -UID_ROOT=`id -u root` -GID_ROOT=`id -g root` - -expect 0 mkdir ${n1} 0755 -cdir=`pwd` -cd ${n1} - -create_file regular ${n0} 0644 $UID_ROOT $GID_ROOT -# First check that nobody can't update the timestamps -expect EPERM -u $UID_NOBODY open . O_RDONLY : utimensat 0 ${n0} 0 UTIME_OMIT $DATE2 0 0 -expect EPERM -u $UID_NOBODY open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 0 UTIME_OMIT 0 -expect EPERM -u $UID_NOBODY open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 $DATE2 0 0 - -# Now check that a nonowner with write permission can't update the timestamps -expect 0 chmod ${n0} 0666 -expect EPERM -u $UID_NOBODY open . O_RDONLY : utimensat 0 ${n0} 0 UTIME_OMIT $DATE2 0 0 -expect EPERM -u $UID_NOBODY open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 0 UTIME_OMIT 0 -expect EPERM -u $UID_NOBODY open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 $DATE2 0 0 - -# Now check that the owner can update the timestamps -expect 0 chown ${n0} $UID_NOBODY $GID_NOBODY -expect 0 chmod ${n0} 0444 -expect 0 -u $UID_NOBODY open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 $DATE2 0 - -# Now check that the superuser can update the timestamps -expect 0 -u $UID_ROOT open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 $DATE2 0 0 - - -expect 0 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n1} diff --git a/tests/utimensat/08.t b/tests/utimensat/08.t deleted file mode 100644 index aca8b1c2..00000000 --- a/tests/utimensat/08.t +++ /dev/null @@ -1,40 +0,0 @@ -#! /bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD$ - -desc="utimensat can set timestamps with subsecond precision" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require "utimensat" - -echo "1..9" - -n0=`namegen` -n1=`namegen` -# Different file systems have different timestamp resolutions. Check that they -# can do 0.1 second, but don't bother checking the finest resolution. -DATE1=100000000 #Sat Mar 3 02:46:40 MST 1973 -DATE1_NS=100000000 -DATE2=200000000 #Mon May 3 13:33:20 MDT 1976 -DATE2_NS=200000000 - -expect 0 mkdir ${n1} 0755 -cdir=`pwd` -cd ${n1} - -create_file regular ${n0} 0644 -expect 0 open . O_RDONLY : utimensat 0 ${n0} $DATE1 $DATE1_NS $DATE2 $DATE2_NS 0 -expect $DATE1_NS lstat ${n0} atime_ns -expect $DATE2_NS lstat ${n0} mtime_ns -if supported "stat_st_birthtime"; then - expect $DATE2_NS lstat ${n0} birthtime_ns -else - test_check true -fi - -expect 0 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n1} diff --git a/tests/utimensat/09.t b/tests/utimensat/09.t deleted file mode 100644 index ec7acbe9..00000000 --- a/tests/utimensat/09.t +++ /dev/null @@ -1,35 +0,0 @@ -#! /bin/sh -# vim: filetype=sh noexpandtab ts=8 sw=8 -# $FreeBSD$ - -desc="utimensat is y2038 compliant" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require "utimensat" - -echo "1..7" - -require utimensat - -n0=`namegen` -n1=`namegen` -DATE1=2147483648 # 2^31, ie Mon Jan 18 20:14:08 MST 2038 -DATE2=4294967296 # 2^32, ie Sat Feb 6 23:28:16 MST 2106 - -expect 0 mkdir ${n1} 0755 -cdir=`pwd` -cd ${n1} - - -create_file regular ${n0} -expect 0 open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 $DATE2 0 0 -expect $DATE1 lstat ${n0} atime -expect $DATE2 lstat ${n0} mtime - - -expect 0 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n1} From 955a762bcb7c57f30851ec08e7512fd2257916ae Mon Sep 17 00:00:00 2001 From: Sayafdine Said Date: Sun, 8 Sep 2024 20:26:45 +0200 Subject: [PATCH 2/3] refactor: restore granular tests --- tests/granular/00.t | 113 +++++++++++++++++++++++++++++++++ tests/granular/01.t | 38 +++++++++++ tests/granular/02.t | 145 ++++++++++++++++++++++++++++++++++++++++++ tests/granular/03.t | 135 +++++++++++++++++++++++++++++++++++++++ tests/granular/04.t | 46 ++++++++++++++ tests/granular/05.t | 150 ++++++++++++++++++++++++++++++++++++++++++++ tests/granular/06.t | 63 +++++++++++++++++++ 7 files changed, 690 insertions(+) create mode 100644 tests/granular/00.t create mode 100644 tests/granular/01.t create mode 100644 tests/granular/02.t create mode 100644 tests/granular/03.t create mode 100644 tests/granular/04.t create mode 100644 tests/granular/05.t create mode 100644 tests/granular/06.t diff --git a/tests/granular/00.t b/tests/granular/00.t new file mode 100644 index 00000000..fcf4c02d --- /dev/null +++ b/tests/granular/00.t @@ -0,0 +1,113 @@ +#!/bin/sh +# vim: filetype=sh noexpandtab ts=8 sw=8 +# $FreeBSD: head/tools/regression/pjdfstest/tests/granular/00.t 211352 2010-08-15 21:24:17Z pjd $ + +desc="NFSv4 granular permissions checking - WRITE_DATA vs APPEND_DATA on directories" + +dir=`dirname $0` +. ${dir}/../misc.sh + +[ "${os}:${fs}" = "FreeBSD:ZFS" ] || quick_exit + +echo "1..49" + +n0=`namegen` +n1=`namegen` +n2=`namegen` +n3=`namegen` + +expect 0 mkdir ${n2} 0755 +expect 0 mkdir ${n3} 0777 +cdir=`pwd` +cd ${n2} + +# Tests 2..7 - check out whether root user can do stuff. +# Can create files? +expect 0 create ${n0} 0644 + +# Can create symlinks? +expect 0 link ${n0} ${n1} +expect 0 unlink ${n1} +expect 0 unlink ${n0} + +# Can create directories? +expect 0 mkdir ${n0} 0755 +expect 0 rmdir ${n0} + +# Check whether user 65534 is permitted to create and remove +# files, but not subdirectories. +expect 0 prependacl . user:65534:write_data::allow,user:65534:append_data::deny + +# Can create files? +expect 0 -u 65534 -g 65534 create ${n0} 0644 + +# Can create symlinks? +expect 0 -u 65534 -g 65534 link ${n0} ${n1} +expect 0 -u 65534 -g 65534 unlink ${n1} +expect 0 -u 65534 -g 65534 unlink ${n0} + +# Can create directories? +expect EACCES -u 65534 -g 65534 mkdir ${n0} 0755 +expect ENOENT -u 65534 -g 65534 rmdir ${n0} +expect 0 mkdir ${n0} 0755 +expect 0 -u 65534 -g 65534 rmdir ${n0} + +# Can move files from other directory? +expect 0 create ../${n3}/${n1} 0644 +expect 0 -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} + +# Can move files from other directory overwriting existing files? +expect 0 create ../${n3}/${n1} 0644 +expect 0 -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} + +expect 0 -u 65534 -g 65534 unlink ${n0} + +# Can move directories from other directory? +expect 0 mkdir ../${n3}/${n1} 0777 +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} + +# Can move directories from other directory overwriting existing directory? +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} +expect 0 -u 65534 -g 65534 rmdir ../${n3}/${n1} + +# Check whether user 65534 is permitted to create +# subdirectories, but not files - and to remove neither of them. +expect 0 prependacl . user:65534:write_data::deny,user:65534:append_data::allow + +# Can create files? +expect EACCES -u 65534 -g 65534 create ${n0} 0644 + +# Can create symlinks? +expect 0 create ${n0} 0644 +expect EACCES -u 65534 -g 65534 link ${n0} ${n1} +expect ENOENT -u 65534 -g 65534 unlink ${n1} +expect EACCES -u 65534 -g 65534 unlink ${n0} +expect 0 unlink ${n0} + +# Can create directories? +expect 0 -u 65534 -g 65534 mkdir ${n0} 0755 +expect EACCES -u 65534 -g 65534 rmdir ${n0} +expect 0 rmdir ${n0} + +# Can move files from other directory? +expect 0 create ../${n3}/${n1} 0644 +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} + +# Can move files from other directory overwriting existing files? +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} +expect 0 -u 65534 -g 65534 unlink ../${n3}/${n1} + +# Can move directories from other directory? +expect 0 mkdir ../${n3}/${n1} 0777 +expect 0 -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} + +# Can move directories from other directory overwriting existing directory? +expect 0 mkdir ../${n3}/${n1} 0777 +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} +expect 0 prependacl . user:65534:delete_child::allow +expect 0 -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} +expect 0 -u 65534 -g 65534 rmdir ${n0} + +cd ${cdir} +expect 0 rmdir ${n2} +expect 0 rmdir ${n3} diff --git a/tests/granular/01.t b/tests/granular/01.t new file mode 100644 index 00000000..34453b71 --- /dev/null +++ b/tests/granular/01.t @@ -0,0 +1,38 @@ +#!/bin/sh +# vim: filetype=sh noexpandtab ts=8 sw=8 +# $FreeBSD: head/tools/regression/pjdfstest/tests/granular/01.t 211352 2010-08-15 21:24:17Z pjd $ + +desc="NFSv4 granular permissions checking - ACL_READ_ATTRIBUTES and ACL_WRITE_ATTRIBUTES" + +dir=`dirname $0` +. ${dir}/../misc.sh + +[ "${os}:${fs}" = "FreeBSD:ZFS" ] || quick_exit + +echo "1..12" + +n0=`namegen` +n1=`namegen` +n2=`namegen` + +expect 0 mkdir ${n2} 0755 +cdir=`pwd` +cd ${n2} + +# Tests 1..12 - check out whether user 65534 is permitted to read attributes. +expect 0 create ${n0} 0644 +expect 0 lstat ${n0} size +expect 0 -u 65534 -g 65534 stat ${n0} size +expect 0 prependacl ${n0} user:65534:read_attributes::deny +expect 0 lstat ${n0} size +expect EACCES -u 65534 -g 65534 stat ${n0} size +expect 0 prependacl ${n0} user:65534:read_attributes::allow +expect 0 -u 65534 -g 65534 stat ${n0} size +expect 0 lstat ${n0} size +expect 0 unlink ${n0} + +# Tests 12..12 - check out whether user 65534 is permitted to write attributes. +# XXX: Check if ACL_WRITE_ATTRIBUTES allows for modifying access times. + +cd ${cdir} +expect 0 rmdir ${n2} diff --git a/tests/granular/02.t b/tests/granular/02.t new file mode 100644 index 00000000..6b8e26d4 --- /dev/null +++ b/tests/granular/02.t @@ -0,0 +1,145 @@ +#!/bin/sh +# vim: filetype=sh noexpandtab ts=8 sw=8 +# $FreeBSD: head/tools/regression/pjdfstest/tests/granular/02.t 211352 2010-08-15 21:24:17Z pjd $ + +desc="NFSv4 granular permissions checking - ACL_READ_ACL and ACL_WRITE_ACL" + +dir=`dirname $0` +. ${dir}/../misc.sh + +[ "${os}:${fs}" = "FreeBSD:ZFS" ] || quick_exit + +echo "1..83" + +n0=`namegen` +n1=`namegen` +n2=`namegen` + +expect 0 mkdir ${n2} 0755 +cdir=`pwd` +cd ${n2} + +# Check whether user 65534 is permitted to read ACL. +expect 0 create ${n0} 0644 +expect 0 readacl ${n0} +expect 0 -u 65534 -g 65534 readacl ${n0} +expect 0 prependacl ${n0} user:65534:read_acl::deny +expect 0 readacl ${n0} +expect EACCES -u 65534 -g 65534 readacl ${n0} +expect 0 prependacl ${n0} user:65534:read_acl::allow +expect 0 -u 65534 -g 65534 readacl ${n0} +expect 0 readacl ${n0} +expect 0 unlink ${n0} + +# Check whether user 65534 is permitted to write ACL. +expect 0 create ${n0} 0644 +expect EPERM -u 65534 -g 65534 prependacl ${n0} user:65534:read_data::allow +expect 0 prependacl ${n0} user:65534:write_acl::allow +expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:read_data::allow +expect 0 unlink ${n0} + +# Check whether user 65534 is permitted to write mode. +expect 0 create ${n0} 0755 +expect EPERM -u 65534 -g 65534 chmod ${n0} 0777 +expect 0 prependacl ${n0} user:65534:write_acl::allow +expect 0 -u 65534 -g 65534 chmod ${n0} 0777 +expect 0 unlink ${n0} + +# There is an interesting problem with interaction between ACL_WRITE_ACL +# and SUID/SGID bits. In case user does have ACL_WRITE_ACL, but is not +# a file owner, Solaris does the following: +# 1. Setting SUID fails with EPERM. +# 2. Setting SGID succeeds, but mode is not changed. +# 3. Modifying ACL does not clear SUID nor SGID bits. +# 4. Writing the file does clear both SUID and SGID bits. +# +# What we are doing is the following: +# 1. Setting SUID or SGID fails with EPERM. +# 2. Modifying ACL does not clear SUID nor SGID bits. +# 3. Writing the file does clear both SUID and SGID bits. +# +# Check whether user 65534 is denied to write mode with SUID bit. +expect 0 create ${n0} 0755 +expect EPERM -u 65534 -g 65534 chmod ${n0} 04777 +expect 0 prependacl ${n0} user:65534:write_acl::allow +expect EPERM -u 65534 -g 65534 chmod ${n0} 04777 +expect 0 unlink ${n0} + +# Check whether user 65534 is denied to write mode with SGID bit. +expect 0 create ${n0} 0755 +expect EPERM -u 65534 -g 65534 chmod ${n0} 02777 +expect 0 prependacl ${n0} user:65534:write_acl::allow +expect EPERM -u 65534 -g 65534 chmod ${n0} 02777 +expect 0 unlink ${n0} + +# Check whether user 65534 is allowed to write mode with sticky bit. +expect 0 mkdir ${n0} 0755 +expect EPERM -u 65534 -g 65534 chmod ${n0} 01777 +expect 0 prependacl ${n0} user:65534:write_acl::allow +expect 0 -u 65534 -g 65534 chmod ${n0} 01777 +expect 0 rmdir ${n0} + +# Check whether modifying the ACL by not-owner preserves the SUID. +expect 0 create ${n0} 04755 +expect 0 prependacl ${n0} user:65534:write_acl::allow +expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:write_data::allow +expect 04755 stat ${n0} mode +expect 0 unlink ${n0} + +# Check whether modifying the ACL by not-owner preserves the SGID. +expect 0 create ${n0} 02755 +expect 0 prependacl ${n0} user:65534:write_acl::allow +expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:write_data::allow +expect 02755 stat ${n0} mode +expect 0 unlink ${n0} + +# Check whether modifying the ACL by not-owner preserves the sticky bit. +expect 0 mkdir ${n0} 0755 +expect 0 chmod ${n0} 01755 +expect 0 prependacl ${n0} user:65534:write_acl::allow +expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:write_data::allow +expect 01755 stat ${n0} mode +expect 0 rmdir ${n0} + +# Clearing the SUID and SGID bits when being written to by non-owner +# is checked in chmod/12.t. + +# Check whether the file owner is always permitted to get and set +# ACL and file mode, even if ACL_{READ,WRITE}_ACL would deny it. +expect 0 chmod . 0777 +expect 0 -u 65534 -g 65534 create ${n0} 0600 +expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:write_acl::deny +expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:read_acl::deny +expect 0 -u 65534 -g 65534 readacl ${n0} +expect 0600 -u 65534 -g 65534 stat ${n0} mode +expect 0 -u 65534 -g 65534 chmod ${n0} 0777 +expect 0 unlink ${n0} + +expect 0 -u 65534 -g 65534 mkdir ${n0} 0600 +expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:write_acl::deny +expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:read_acl::deny +expect 0 -u 65534 -g 65534 readacl ${n0} +expect 0600 -u 65534 -g 65534 stat ${n0} mode +expect 0 -u 65534 -g 65534 chmod ${n0} 0777 +expect 0 rmdir ${n0} + +# Check whether the root is allowed for these as well. +expect 0 -u 65534 -g 65534 create ${n0} 0600 +expect 0 prependacl ${n0} everyone@:write_acl::deny +expect 0 prependacl ${n0} everyone@:read_acl::deny +expect 0 readacl ${n0} +expect 0600 stat ${n0} mode +expect 0 chmod ${n0} 0777 +expect 0 unlink ${n0} + +expect 0 -u 65534 -g 65534 mkdir ${n0} 0600 +expect 0 prependacl ${n0} everyone@:write_acl::deny +expect 0 prependacl ${n0} everyone@:read_acl::deny +expect 0600 stat ${n0} mode +expect 0 readacl ${n0} +expect 0600 stat ${n0} mode +expect 0 chmod ${n0} 0777 +expect 0 rmdir ${n0} + +cd ${cdir} +expect 0 rmdir ${n2} diff --git a/tests/granular/03.t b/tests/granular/03.t new file mode 100644 index 00000000..fe778ea4 --- /dev/null +++ b/tests/granular/03.t @@ -0,0 +1,135 @@ +#!/bin/sh +# vim: filetype=sh noexpandtab ts=8 sw=8 +# $FreeBSD: head/tools/regression/pjdfstest/tests/granular/03.t 211352 2010-08-15 21:24:17Z pjd $ + +desc="NFSv4 granular permissions checking - DELETE and DELETE_CHILD" + +dir=`dirname $0` +. ${dir}/../misc.sh + +[ "${os}:${fs}" = "FreeBSD:ZFS" ] || quick_exit + +echo "1..65" + +n0=`namegen` +n1=`namegen` +n2=`namegen` +n3=`namegen` + +expect 0 mkdir ${n2} 0755 +expect 0 mkdir ${n3} 0777 +cdir=`pwd` +cd ${n2} + +# Unlink allowed on writable directory. +expect 0 create ${n0} 0644 +expect EACCES -u 65534 -g 65534 unlink ${n0} +expect 0 prependacl . user:65534:write_data::allow +expect 0 -u 65534 -g 65534 unlink ${n0} + +# Moving file elsewhere allowed on writable directory. +expect 0 create ${n0} 0644 +expect 0 prependacl . user:65534:write_data::deny +expect EACCES -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} +expect 0 prependacl . user:65534:write_data::allow +expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} + +# Moving file from elsewhere allowed on writable directory. +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 unlink ${n0} + +# Moving file from elsewhere overwriting local file allowed +# on writable directory. +expect 0 create ${n0} 0644 +expect 0 create ../${n3}/${n0} 0644 +expect 0 prependacl . user:65534:write_data::deny +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 prependacl . user:65534:write_data::allow +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 unlink ${n0} + +# Denied DELETE changes nothing wrt removing. +expect 0 create ${n0} 0644 +expect 0 prependacl ${n0} user:65534:delete::deny +expect 0 -u 65534 -g 65534 unlink ${n0} + +# Denied DELETE changes nothing wrt moving elsewhere or from elsewhere. +expect 0 create ${n0} 0644 +expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 unlink ${n0} + +# DELETE_CHILD denies unlink on writable directory. +expect 0 create ${n0} 0644 +expect 0 prependacl . user:65534:delete_child::deny +expect EPERM -u 65534 -g 65534 unlink ${n0} +expect 0 unlink ${n0} + +# DELETE_CHILD denies moving file elsewhere. +expect 0 create ${n0} 0644 +expect EPERM -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} +expect 0 rename ${n0} ../${n3}/${n0} + +# DELETE_CHILD does not deny moving file from elsewhere +# to a writable directory. +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# DELETE_CHILD denies moving file from elsewhere +# to a writable directory overwriting local file. +expect 0 create ../${n3}/${n0} 0644 +expect EPERM -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# DELETE allowed on file allows for unlinking, no matter +# what permissions on containing directory are. +expect 0 prependacl ${n0} user:65534:delete::allow +expect 0 -u 65534 -g 65534 unlink ${n0} + +# Same for moving the file elsewhere. +expect 0 create ${n0} 0644 +expect 0 prependacl ${n0} user:65534:delete::allow +expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} + +# Same for moving the file from elsewhere into a writable +# directory with DELETE_CHILD denied. +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 unlink ${n0} + +# DELETE does not allow for overwriting a file in a unwritable +# directory with DELETE_CHILD denied. +expect 0 create ${n0} 0644 +expect 0 create ../${n3}/${n0} 0644 +expect 0 prependacl . user:65534:write_data::deny +expect 0 prependacl . user:65534:delete_child::deny +expect EPERM -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 prependacl ${n0} user:65534:delete::allow +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# But it allows for plain deletion. +expect 0 -u 65534 -g 65534 unlink ${n0} + +# DELETE_CHILD allowed on unwritable directory. +expect 0 create ${n0} 0644 +expect 0 prependacl . user:65534:delete_child::allow +expect 0 -u 65534 -g 65534 unlink ${n0} + +# Moving things elsewhere is allowed. +expect 0 create ${n0} 0644 +expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} + +# Moving things back is not. +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# Even if we're overwriting. +expect 0 create ${n0} 0644 +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# Even if we have DELETE on the existing file. +expect 0 prependacl ${n0} user:65534:delete::allow +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# Denied DELETE changes nothing wrt removing. +expect 0 prependacl ${n0} user:65534:delete::deny +expect 0 -u 65534 -g 65534 unlink ${n0} + +cd ${cdir} +expect 0 rmdir ${n2} diff --git a/tests/granular/04.t b/tests/granular/04.t new file mode 100644 index 00000000..fccb05c6 --- /dev/null +++ b/tests/granular/04.t @@ -0,0 +1,46 @@ +#!/bin/sh +# vim: filetype=sh noexpandtab ts=8 sw=8 +# $FreeBSD: head/tools/regression/pjdfstest/tests/granular/04.t 211352 2010-08-15 21:24:17Z pjd $ + +desc="NFSv4 granular permissions checking - ACL_WRITE_OWNER" + +dir=`dirname $0` +. ${dir}/../misc.sh + +nfsv4acls || quick_exit + +echo "1..22" + +n0=`namegen` +n2=`namegen` + +expect 0 mkdir ${n2} 0755 +cdir=`pwd` +cd ${n2} + +# ACL_WRITE_OWNER permits to set gid to our own only. +expect 0 create ${n0} 0644 +expect 0,0 lstat ${n0} uid,gid +expect EPERM -u 65534 -g 65532,65531 chown ${n0} -1 65532 +expect 0,0 lstat ${n0} uid,gid +expect 0 prependacl ${n0} user:65534:write_owner::allow +expect EPERM -u 65534 -g 65532,65531 chown ${n0} -1 65530 +expect 0,0 lstat ${n0} uid,gid +expect 0 -u 65534 -g 65532,65531 chown ${n0} -1 65532 +expect 0,65532 lstat ${n0} uid,gid +expect 0 unlink ${n0} + +# ACL_WRITE_OWNER permits to set uid to our own only. +expect 0 create ${n0} 0644 +expect 0,0 lstat ${n0} uid,gid +expect EPERM -u 65534 -g 65532,65531 chown ${n0} 65534 65531 +expect 0,0 lstat ${n0} uid,gid +expect 0 prependacl ${n0} user:65534:write_owner::allow +expect EPERM -u 65534 -g 65532,65531 chown ${n0} 65530 65531 +expect 0,0 lstat ${n0} uid,gid +expect 0 -u 65534 -g 65532,65531 chown ${n0} 65534 65531 +expect 65534,65531 lstat ${n0} uid,gid +expect 0 unlink ${n0} + +cd ${cdir} +expect 0 rmdir ${n2} diff --git a/tests/granular/05.t b/tests/granular/05.t new file mode 100644 index 00000000..23e89710 --- /dev/null +++ b/tests/granular/05.t @@ -0,0 +1,150 @@ +#!/bin/sh +# vim: filetype=sh noexpandtab ts=8 sw=8 +# $FreeBSD: head/tools/regression/pjdfstest/tests/granular/05.t 211352 2010-08-15 21:24:17Z pjd $ + +desc="NFSv4 granular permissions checking - DELETE and DELETE_CHILD with directories" + +dir=`dirname $0` +. ${dir}/../misc.sh + +[ "${os}:${fs}" = "FreeBSD:ZFS" ] || quick_exit + +echo "1..68" + +n0=`namegen` +n1=`namegen` +n2=`namegen` +n3=`namegen` + +expect 0 mkdir ${n2} 0755 +expect 0 mkdir ${n3} 0777 +cdir=`pwd` +cd ${n2} + +# Unlink allowed on writable directory. +expect 0 mkdir ${n0} 0755 +expect EACCES -u 65534 -g 65534 rmdir ${n0} +expect 0 prependacl . user:65534:write_data::allow +expect 0 -u 65534 -g 65534 rmdir ${n0} + +# Moving directory elsewhere allowed on writable directory. +expect 0 mkdir ${n0} 0777 +expect 0 prependacl . user:65534:write_data::deny +expect EACCES -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} +expect 0 prependacl . user:65534:write_data::allow +expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} + +# 12 +# Moving directory from elsewhere allowed on writable directory. +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 prependacl . user:65534:append_data::allow +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 rmdir ${n0} + +# Moving directory from elsewhere overwriting local directory allowed +# on writable directory. +expect 0 mkdir ${n0} 0755 +expect 0 mkdir ../${n3}/${n0} 0777 +expect 0 prependacl . user:65534:write_data::deny +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 prependacl . user:65534:write_data::allow +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 rmdir ${n0} + +# 23 +# Denied DELETE changes nothing wrt removing. +expect 0 mkdir ${n0} 0755 +expect 0 prependacl ${n0} user:65534:delete::deny +expect 0 -u 65534 -g 65534 rmdir ${n0} + +# Denied DELETE changes nothing wrt moving elsewhere or from elsewhere. +expect 0 mkdir ${n0} 0777 +expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 rmdir ${n0} + +# DELETE_CHILD denies unlink on writable directory. +expect 0 mkdir ${n0} 0755 +expect 0 prependacl . user:65534:delete_child::deny +expect EPERM -u 65534 -g 65534 rmdir ${n0} +expect 0 rmdir ${n0} + +# 35 +# DELETE_CHILD denies moving directory elsewhere. +expect 0 mkdir ${n0} 0777 +expect EPERM -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} +expect 0 rename ${n0} ../${n3}/${n0} + +# DELETE_CHILD does not deny moving directory from elsewhere +# to a writable directory. +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# DELETE_CHILD denies moving directory from elsewhere +# to a writable directory overwriting local directory. +expect 0 mkdir ../${n3}/${n0} 0755 +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# DELETE allowed on directory allows for unlinking, no matter +# what permissions on containing directory are. +expect 0 prependacl ${n0} user:65534:delete::allow +expect 0 -u 65534 -g 65534 rmdir ${n0} + +# Same for moving the directory elsewhere. +expect 0 mkdir ${n0} 0777 +expect 0 prependacl ${n0} user:65534:delete::allow +expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} + +# 46 +# Same for moving the directory from elsewhere into a writable +# directory with DELETE_CHILD denied. +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 rmdir ${n0} + +# DELETE does not allow for overwriting a directory in a unwritable +# directory with DELETE_CHILD denied. +expect 0 mkdir ${n0} 0755 +expect 0 mkdir ../${n3}/${n0} 0777 +expect 0 prependacl . user:65534:write_data::deny +expect 0 prependacl . user:65534:delete_child::deny +expect EPERM -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 prependacl ${n0} user:65534:delete::allow +# XXX: expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# 54 +# But it allows for plain deletion. +# XXX: expect 0 -u 65534 -g 65534 rmdir ${n0} +expect 0 rmdir ${n0} + +# DELETE_CHILD allowed on unwritable directory. +expect 0 mkdir ${n0} 0755 +expect 0 prependacl . user:65534:delete_child::allow +expect 0 -u 65534 -g 65534 rmdir ${n0} + +# Moving things elsewhere is allowed. +expect 0 mkdir ${n0} 0777 +expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} + +# 60 +# Moving things back is not. +# XXX: expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# Even if we're overwriting. +# XXX: expect 0 mkdir ${n0} 0755 +expect 0 mkdir ../${n3}/${n0} 0777 +# XXX: expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 mkdir ../${n3}/${n0} 0777 + +# Even if we have DELETE on the existing directory. +expect 0 prependacl ${n0} user:65534:delete::allow +# XXX: expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# Denied DELETE changes nothing wrt removing. +expect 0 prependacl ${n0} user:65534:delete::deny +expect 0 -u 65534 -g 65534 rmdir ${n0} + +cd ${cdir} +expect 0 rmdir ${n2} diff --git a/tests/granular/06.t b/tests/granular/06.t new file mode 100644 index 00000000..48f2a8b2 --- /dev/null +++ b/tests/granular/06.t @@ -0,0 +1,63 @@ +#!/bin/sh +# vim: filetype=sh noexpandtab ts=8 sw=8 +# $FreeBSD:$ + +desc="NFSv4 granular permissions checking - setuid and setgid are cleared when non-owner calls chown" + +dir=`dirname $0` +. ${dir}/../misc.sh + +nfsv4acls || quick_exit +# ZFS's default aclmode is discard, which prevents non-owners from chowning a +# file +if [ "${fs}" != "ZFS" -o \ + $(zfs get -Hp aclmode $(get_mountpoint) | cut -wf3) != passthrough ] +then + quick_exit +fi + +echo "1..32" + +n0=`namegen` +n2=`namegen` + +expect 0 mkdir ${n2} 0755 +cdir=`pwd` +cd ${n2} + +# When non-owner calls chown(2) successfully, set-uid and set-gid bits are +# removed, except when both uid and gid are equal to -1. +expect 0 create ${n0} 0644 +expect 0 prependacl ${n0} user:65534:write_owner::allow +expect 0 chmod ${n0} 06555 +expect 06555 lstat ${n0} mode +expect 0 -u 65534 -g 65533,65532 chown ${n0} 65534 65532 +expect 0555,65534,65532 lstat ${n0} mode,uid,gid +expect 0 chmod ${n0} 06555 +expect 06555 lstat ${n0} mode +expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 65533 +expect 0555,65534,65533 lstat ${n0} mode,uid,gid +expect 0 chmod ${n0} 06555 +expect 06555 lstat ${n0} mode +expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 -1 +expect 06555,65534,65533 lstat ${n0} mode,uid,gid +expect 0 unlink ${n0} + +expect 0 mkdir ${n0} 0755 +expect 0 prependacl ${n0} user:65534:write_owner::allow +expect 0 chmod ${n0} 06555 +expect 06555 lstat ${n0} mode +expect 0 -u 65534 -g 65533,65532 chown ${n0} 65534 65532 +expect 0555,65534,65532 lstat ${n0} mode,uid,gid +expect 0 chmod ${n0} 06555 +expect 06555 lstat ${n0} mode +expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 65533 +expect 0555,65534,65533 lstat ${n0} mode,uid,gid +expect 0 chmod ${n0} 06555 +expect 06555 lstat ${n0} mode +expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 -1 +expect 06555,65534,65533 lstat ${n0} mode,uid,gid +expect 0 rmdir ${n0} + +cd ${cdir} +expect 0 rmdir ${n2} From 178a2db373dc16c3e3bde058e87b520c5918a795 Mon Sep 17 00:00:00 2001 From: Sayafdine Said Date: Wed, 18 Sep 2024 10:56:33 +0200 Subject: [PATCH 3/3] docs: add missing test case reference --- rust/src/tests/chmod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/rust/src/tests/chmod.rs b/rust/src/tests/chmod.rs index ad10ba7b..2f64fb59 100644 --- a/rust/src/tests/chmod.rs +++ b/rust/src/tests/chmod.rs @@ -85,6 +85,7 @@ fn failed_chmod_unchanged_ctime(ctx: &mut SerializedTestContext, f_type: FileTyp }); } +// chmod/00.t:L119 crate::test_case! { /// S_ISGID bit shall be cleared upon successful return from chmod of a regular file /// if the calling process does not have appropriate privileges, and if