]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - tools/regression/pjdfstest/tests/mknod/00.t
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / tools / regression / pjdfstest / tests / mknod / 00.t
1 #!/bin/sh
2 # $FreeBSD$
3
4 desc="mknod creates fifo files"
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 FIFO shall be initialized from
19 # mode. The file permission bits of the mode argument shall be modified by the
20 # process' file creation mask.
21 expect 0 mknod ${n0} f 0755 0 0
22 expect fifo,0755 lstat ${n0} type,mode
23 expect 0 unlink ${n0}
24 expect 0 mknod ${n0} f 0151 0 0
25 expect fifo,0151 lstat ${n0} type,mode
26 expect 0 unlink ${n0}
27 expect 0 -U 077 mknod ${n0} f 0151 0 0
28 expect fifo,0100 lstat ${n0} type,mode
29 expect 0 unlink ${n0}
30 expect 0 -U 070 mknod ${n0} f 0345 0 0
31 expect fifo,0305 lstat ${n0} type,mode
32 expect 0 unlink ${n0}
33 expect 0 -U 0501 mknod ${n0} f 0345 0 0
34 expect fifo,0244 lstat ${n0} type,mode
35 expect 0 unlink ${n0}
36
37 # POSIX: The FIFO's user ID shall be set to the process' effective user ID.
38 # The FIFO's group ID shall be set to the group ID of the parent directory or to
39 # the effective group ID of the process.
40 expect 0 chown . 65535 65535
41 expect 0 -u 65535 -g 65535 mknod ${n0} f 0755 0 0
42 expect 65535,65535 lstat ${n0} uid,gid
43 expect 0 unlink ${n0}
44 expect 0 -u 65535 -g 65534 mknod ${n0} f 0755 0 0
45 expect "65535,6553[45]" lstat ${n0} uid,gid
46 expect 0 unlink ${n0}
47 expect 0 chmod . 0777
48 expect 0 -u 65534 -g 65533 mknod ${n0} f 0755 0 0
49 expect "65534,6553[35]" lstat ${n0} uid,gid
50 expect 0 unlink ${n0}
51
52 # POSIX: Upon successful completion, mkfifo() shall mark for update the
53 # st_atime, st_ctime, and st_mtime fields of the file. 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 mknod ${n0} f 0755 0 0
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 unlink ${n0}
71
72 cd ${cdir}
73 expect 0 rmdir ${n1}