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