2 # vim: filetype=sh noexpandtab ts=8 sw=8
3 # $FreeBSD: head/tools/regression/pjdfstest/tests/mkdir/00.t 211352 2010-08-15 21:24:17Z pjd $
5 desc="mkdir creates directories"
15 expect 0 mkdir ${n1} 0755
19 # POSIX: The file permission bits of the new directory shall be initialized from
20 # mode. These file permission bits of the mode argument shall be modified by the
21 # process' file creation mask.
22 expect 0 mkdir ${n0} 0755
23 expect dir,0755 lstat ${n0} type,mode
25 expect 0 mkdir ${n0} 0151
26 expect dir,0151 lstat ${n0} type,mode
28 expect 0 -U 077 mkdir ${n0} 0151
29 expect dir,0100 lstat ${n0} type,mode
31 expect 0 -U 070 mkdir ${n0} 0345
32 expect dir,0305 lstat ${n0} type,mode
34 expect 0 -U 0501 mkdir ${n0} 0345
35 expect dir,0244 lstat ${n0} type,mode
38 # POSIX: The directory's user ID shall be set to the process' effective user ID.
39 # The directory's group ID shall be set to the group ID of the parent directory
40 # or to the effective group ID of the process.
41 expect 0 chown . 65535 65535
42 expect 0 -u 65535 -g 65535 mkdir ${n0} 0755
43 expect 65535,65535 lstat ${n0} uid,gid
45 expect 0 -u 65535 -g 65534 mkdir ${n0} 0755
46 expect "65535,6553[45]" lstat ${n0} uid,gid
49 expect 0 -u 65534 -g 65533 mkdir ${n0} 0755
50 expect "65534,6553[35]" lstat ${n0} uid,gid
53 # POSIX: Upon successful completion, mkdir() shall mark for update the st_atime,
54 # st_ctime, and st_mtime fields of the directory. Also, the st_ctime and
55 # st_mtime fields of the directory that contains the new entry shall be marked
58 time=`${fstest} stat . ctime`
60 expect 0 mkdir ${n0} 0755
61 atime=`${fstest} stat ${n0} atime`
62 test_check $time -lt $atime
63 mtime=`${fstest} stat ${n0} mtime`
64 test_check $time -lt $mtime
65 ctime=`${fstest} stat ${n0} ctime`
66 test_check $time -lt $ctime
67 mtime=`${fstest} stat . mtime`
68 test_check $time -lt $mtime
69 ctime=`${fstest} stat . ctime`
70 test_check $time -lt $ctime