]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - tools/regression/pjdfstest/tests/mkdir/00.t
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / tools / regression / pjdfstest / tests / mkdir / 00.t
1 #!/bin/sh
2 # $FreeBSD$
3
4 desc="mkdir creates directories"
5
6 dir=`dirname $0`
7 . ${dir}/../misc.sh
8
9 echo "1..36"
10
11 n0=`namegen`
12 n1=`namegen`
13
14 expect 0 mkdir ${n1} 0755
15 cdir=`pwd`
16 cd ${n1}
17
18 # POSIX: The file permission bits of the new directory shall be initialized from
19 # mode. These file permission bits of the mode argument shall be modified by the
20 # process' file creation mask.
21 expect 0 mkdir ${n0} 0755
22 expect dir,0755 lstat ${n0} type,mode
23 expect 0 rmdir ${n0}
24 expect 0 mkdir ${n0} 0151
25 expect dir,0151 lstat ${n0} type,mode
26 expect 0 rmdir ${n0}
27 expect 0 -U 077 mkdir ${n0} 0151
28 expect dir,0100 lstat ${n0} type,mode
29 expect 0 rmdir ${n0}
30 expect 0 -U 070 mkdir ${n0} 0345
31 expect dir,0305 lstat ${n0} type,mode
32 expect 0 rmdir ${n0}
33 expect 0 -U 0501 mkdir ${n0} 0345
34 expect dir,0244 lstat ${n0} type,mode
35 expect 0 rmdir ${n0}
36
37 # POSIX: The directory's user ID shall be set to the process' effective user ID.
38 # The directory's group ID shall be set to the group ID of the parent directory
39 # or to the effective group ID of the process.
40 expect 0 chown . 65535 65535
41 expect 0 -u 65535 -g 65535 mkdir ${n0} 0755
42 expect 65535,65535 lstat ${n0} uid,gid
43 expect 0 rmdir ${n0}
44 expect 0 -u 65535 -g 65534 mkdir ${n0} 0755
45 expect "65535,6553[45]" lstat ${n0} uid,gid
46 expect 0 rmdir ${n0}
47 expect 0 chmod . 0777
48 expect 0 -u 65534 -g 65533 mkdir ${n0} 0755
49 expect "65534,6553[35]" lstat ${n0} uid,gid
50 expect 0 rmdir ${n0}
51
52 # POSIX: Upon successful completion, mkdir() shall mark for update the st_atime,
53 # st_ctime, and st_mtime fields of the directory. Also, the st_ctime and
54 # st_mtime fields of the directory that contains the new entry shall be marked
55 # for update.
56 expect 0 chown . 0 0
57 time=`${fstest} stat . ctime`
58 sleep 1
59 expect 0 mkdir ${n0} 0755
60 atime=`${fstest} stat ${n0} atime`
61 test_check $time -lt $atime
62 mtime=`${fstest} stat ${n0} mtime`
63 test_check $time -lt $mtime
64 ctime=`${fstest} stat ${n0} ctime`
65 test_check $time -lt $ctime
66 mtime=`${fstest} stat . mtime`
67 test_check $time -lt $mtime
68 ctime=`${fstest} stat . ctime`
69 test_check $time -lt $ctime
70 expect 0 rmdir ${n0}
71
72 cd ${cdir}
73 expect 0 rmdir ${n1}