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