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