diff options
author | pjd <pjd@FreeBSD.org> | 2007-01-25 20:50:02 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2007-01-25 20:50:02 +0000 |
commit | 0dfda7f53e06f40a51cecf696b1a01e44c9b00aa (patch) | |
tree | 12f9f4d1298fdfd1cc46719edbbfaa48e3563c20 /tools | |
parent | e53af3d8e531279b3e0bb22b3a82f720b9e566ed (diff) | |
download | FreeBSD-src-0dfda7f53e06f40a51cecf696b1a01e44c9b00aa.zip FreeBSD-src-0dfda7f53e06f40a51cecf696b1a01e44c9b00aa.tar.gz |
MFp4: - When new object is created, it's group ID can be set to process'
effective group ID or to group ID of its parent directory.
- Add some comments from POSIX.
- Verify that after successful O_TRUNC open, size is equal to 0.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/regression/fstest/tests/mkdir/00.t | 14 | ||||
-rw-r--r-- | tools/regression/fstest/tests/mkfifo/00.t | 14 | ||||
-rw-r--r-- | tools/regression/fstest/tests/open/00.t | 18 |
3 files changed, 39 insertions, 7 deletions
diff --git a/tools/regression/fstest/tests/mkdir/00.t b/tools/regression/fstest/tests/mkdir/00.t index 6ba01c6..d640de9 100644 --- a/tools/regression/fstest/tests/mkdir/00.t +++ b/tools/regression/fstest/tests/mkdir/00.t @@ -15,6 +15,9 @@ 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} @@ -31,18 +34,25 @@ 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,65535 lstat ${n0} uid,gid +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,65535 lstat ${n0} uid,gid +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 diff --git a/tools/regression/fstest/tests/mkfifo/00.t b/tools/regression/fstest/tests/mkfifo/00.t index 15f8409..eda7b17 100644 --- a/tools/regression/fstest/tests/mkfifo/00.t +++ b/tools/regression/fstest/tests/mkfifo/00.t @@ -15,6 +15,9 @@ 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} @@ -31,18 +34,25 @@ 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,65535 lstat ${n0} uid,gid +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,65535 lstat ${n0} uid,gid +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 diff --git a/tools/regression/fstest/tests/open/00.t b/tools/regression/fstest/tests/open/00.t index 48bc27a..caa24f0 100644 --- a/tools/regression/fstest/tests/open/00.t +++ b/tools/regression/fstest/tests/open/00.t @@ -6,7 +6,7 @@ desc="open opens (and eventually creates) a file" dir=`dirname $0` . ${dir}/../misc.sh -echo "1..45" +echo "1..47" n0=`namegen` n1=`namegen` @@ -15,6 +15,12 @@ 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} @@ -31,16 +37,20 @@ 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,65535 lstat ${n0} uid,gid +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,65535 lstat ${n0} uid,gid +expect "65534,6553[35]" lstat ${n0} uid,gid expect 0 unlink ${n0} # Update parent directory ctime/mtime if file didn't exist. @@ -73,6 +83,7 @@ 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 @@ -81,6 +92,7 @@ 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} |