xref: /freebsd/contrib/pjdfstest/tests/mkdir/00.t (revision 531c2d7af3cd2e64eec94aa1b19c4b2f16fce515)
140a8ac8fSEnji Cooper#!/bin/sh
2*3416500aSEnji Cooper# vim: filetype=sh noexpandtab ts=8 sw=8
340a8ac8fSEnji Cooper# $FreeBSD: head/tools/regression/pjdfstest/tests/mkdir/00.t 211352 2010-08-15 21:24:17Z pjd $
440a8ac8fSEnji Cooper
540a8ac8fSEnji Cooperdesc="mkdir creates directories"
640a8ac8fSEnji Cooper
740a8ac8fSEnji Cooperdir=`dirname $0`
840a8ac8fSEnji Cooper. ${dir}/../misc.sh
940a8ac8fSEnji Cooper
1040a8ac8fSEnji Cooperecho "1..36"
1140a8ac8fSEnji Cooper
1240a8ac8fSEnji Coopern0=`namegen`
1340a8ac8fSEnji Coopern1=`namegen`
1440a8ac8fSEnji Cooper
1540a8ac8fSEnji Cooperexpect 0 mkdir ${n1} 0755
1640a8ac8fSEnji Coopercdir=`pwd`
1740a8ac8fSEnji Coopercd ${n1}
1840a8ac8fSEnji Cooper
1940a8ac8fSEnji Cooper# POSIX: The file permission bits of the new directory shall be initialized from
2040a8ac8fSEnji Cooper# mode. These file permission bits of the mode argument shall be modified by the
2140a8ac8fSEnji Cooper# process' file creation mask.
2240a8ac8fSEnji Cooperexpect 0 mkdir ${n0} 0755
2340a8ac8fSEnji Cooperexpect dir,0755 lstat ${n0} type,mode
2440a8ac8fSEnji Cooperexpect 0 rmdir ${n0}
2540a8ac8fSEnji Cooperexpect 0 mkdir ${n0} 0151
2640a8ac8fSEnji Cooperexpect dir,0151 lstat ${n0} type,mode
2740a8ac8fSEnji Cooperexpect 0 rmdir ${n0}
2840a8ac8fSEnji Cooperexpect 0 -U 077 mkdir ${n0} 0151
2940a8ac8fSEnji Cooperexpect dir,0100 lstat ${n0} type,mode
3040a8ac8fSEnji Cooperexpect 0 rmdir ${n0}
3140a8ac8fSEnji Cooperexpect 0 -U 070 mkdir ${n0} 0345
3240a8ac8fSEnji Cooperexpect dir,0305 lstat ${n0} type,mode
3340a8ac8fSEnji Cooperexpect 0 rmdir ${n0}
3440a8ac8fSEnji Cooperexpect 0 -U 0501 mkdir ${n0} 0345
3540a8ac8fSEnji Cooperexpect dir,0244 lstat ${n0} type,mode
3640a8ac8fSEnji Cooperexpect 0 rmdir ${n0}
3740a8ac8fSEnji Cooper
3840a8ac8fSEnji Cooper# POSIX: The directory's user ID shall be set to the process' effective user ID.
3940a8ac8fSEnji Cooper# The directory's group ID shall be set to the group ID of the parent directory
4040a8ac8fSEnji Cooper# or to the effective group ID of the process.
4140a8ac8fSEnji Cooperexpect 0 chown . 65535 65535
4240a8ac8fSEnji Cooperexpect 0 -u 65535 -g 65535 mkdir ${n0} 0755
4340a8ac8fSEnji Cooperexpect 65535,65535 lstat ${n0} uid,gid
4440a8ac8fSEnji Cooperexpect 0 rmdir ${n0}
4540a8ac8fSEnji Cooperexpect 0 -u 65535 -g 65534 mkdir ${n0} 0755
4640a8ac8fSEnji Cooperexpect "65535,6553[45]" lstat ${n0} uid,gid
4740a8ac8fSEnji Cooperexpect 0 rmdir ${n0}
4840a8ac8fSEnji Cooperexpect 0 chmod . 0777
4940a8ac8fSEnji Cooperexpect 0 -u 65534 -g 65533 mkdir ${n0} 0755
5040a8ac8fSEnji Cooperexpect "65534,6553[35]" lstat ${n0} uid,gid
5140a8ac8fSEnji Cooperexpect 0 rmdir ${n0}
5240a8ac8fSEnji Cooper
5340a8ac8fSEnji Cooper# POSIX: Upon successful completion, mkdir() shall mark for update the st_atime,
5440a8ac8fSEnji Cooper# st_ctime, and st_mtime fields of the directory. Also, the st_ctime and
5540a8ac8fSEnji Cooper# st_mtime fields of the directory that contains the new entry shall be marked
5640a8ac8fSEnji Cooper# for update.
5740a8ac8fSEnji Cooperexpect 0 chown . 0 0
5840a8ac8fSEnji Coopertime=`${fstest} stat . ctime`
5940a8ac8fSEnji Coopersleep 1
6040a8ac8fSEnji Cooperexpect 0 mkdir ${n0} 0755
6140a8ac8fSEnji Cooperatime=`${fstest} stat ${n0} atime`
6240a8ac8fSEnji Coopertest_check $time -lt $atime
6340a8ac8fSEnji Coopermtime=`${fstest} stat ${n0} mtime`
6440a8ac8fSEnji Coopertest_check $time -lt $mtime
6540a8ac8fSEnji Cooperctime=`${fstest} stat ${n0} ctime`
6640a8ac8fSEnji Coopertest_check $time -lt $ctime
6740a8ac8fSEnji Coopermtime=`${fstest} stat . mtime`
6840a8ac8fSEnji Coopertest_check $time -lt $mtime
6940a8ac8fSEnji Cooperctime=`${fstest} stat . ctime`
7040a8ac8fSEnji Coopertest_check $time -lt $ctime
7140a8ac8fSEnji Cooperexpect 0 rmdir ${n0}
7240a8ac8fSEnji Cooper
7340a8ac8fSEnji Coopercd ${cdir}
7440a8ac8fSEnji Cooperexpect 0 rmdir ${n1}
75