Imported Upstream version 1.5.1

This commit is contained in:
Mario Fetka
2020-09-22 02:25:22 +02:00
commit 434d6067d9
2103 changed files with 928962 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
#!/bin/sh
# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/00.t,v 1.2 2007/01/25 20:50:02 pjd Exp $
desc="mkfifo creates fifo files"
dir=`dirname $0`
. ${dir}/../misc.sh
echo "1..36"
n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n1} 0755
cdir=`pwd`
cd ${n1}
# POSIX: The file permission bits of the new FIFO shall be initialized from
# mode. The file permission bits of the mode argument shall be modified by the
# process' file creation mask.
expect 0 mkfifo ${n0} 0755
expect fifo,0755 lstat ${n0} type,mode
expect 0 unlink ${n0}
expect 0 mkfifo ${n0} 0151
expect fifo,0151 lstat ${n0} type,mode
expect 0 unlink ${n0}
expect 0 -U 077 mkfifo ${n0} 0151
expect fifo,0100 lstat ${n0} type,mode
expect 0 unlink ${n0}
expect 0 -U 070 mkfifo ${n0} 0345
expect fifo,0305 lstat ${n0} type,mode
expect 0 unlink ${n0}
expect 0 -U 0501 mkfifo ${n0} 0345
expect fifo,0244 lstat ${n0} type,mode
expect 0 unlink ${n0}
# POSIX: The FIFO's user ID shall be set to the process' effective user ID.
# The FIFO's group ID shall be set to the group ID of the parent directory or to
# the effective group ID of the process.
expect 0 chown . 65535 65535
expect 0 -u 65535 -g 65535 mkfifo ${n0} 0755
expect 65535,65535 lstat ${n0} uid,gid
expect 0 unlink ${n0}
expect 0 -u 65535 -g 65534 mkfifo ${n0} 0755
expect "65535,6553[45]" lstat ${n0} uid,gid
expect 0 unlink ${n0}
expect 0 chmod . 0777
expect 0 -u 65534 -g 65533 mkfifo ${n0} 0755
expect "65534,6553[35]" lstat ${n0} uid,gid
expect 0 unlink ${n0}
# POSIX: Upon successful completion, mkfifo() shall mark for update the
# st_atime, st_ctime, and st_mtime fields of the file. Also, the st_ctime and
# st_mtime fields of the directory that contains the new entry shall be marked
# for update.
expect 0 chown . 0 0
time=`${fstest} stat . ctime`
sleep 1
expect 0 mkfifo ${n0} 0755
atime=`${fstest} stat ${n0} atime`
test_check $time -lt $atime
mtime=`${fstest} stat ${n0} mtime`
test_check $time -lt $mtime
ctime=`${fstest} stat ${n0} ctime`
test_check $time -lt $ctime
mtime=`${fstest} stat . mtime`
test_check $time -lt $mtime
ctime=`${fstest} stat . ctime`
test_check $time -lt $ctime
expect 0 unlink ${n0}
cd ${cdir}
expect 0 rmdir ${n1}

View File

@@ -0,0 +1,18 @@
#!/bin/sh
# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/01.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
desc="mkfifo returns ENOTDIR if a component of the path prefix is not a directory"
dir=`dirname $0`
. ${dir}/../misc.sh
echo "1..5"
n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
expect 0 create ${n0}/${n1} 0644
expect ENOTDIR mkfifo ${n0}/${n1}/test 0644
expect 0 unlink ${n0}/${n1}
expect 0 rmdir ${n0}

View File

@@ -0,0 +1,13 @@
#!/bin/sh
# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/02.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
desc="mkfifo returns ENAMETOOLONG if a component of a pathname exceeded 255 characters"
dir=`dirname $0`
. ${dir}/../misc.sh
echo "1..3"
expect 0 mkfifo ${name255} 0644
expect 0 unlink ${name255}
expect ENAMETOOLONG mkfifo ${name256} 0644

View File

@@ -0,0 +1,23 @@
#!/bin/sh
# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/03.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
desc="mkfifo returns ENAMETOOLONG if an entire path name exceeded 1023 characters"
dir=`dirname $0`
. ${dir}/../misc.sh
echo "1..11"
expect 0 mkdir ${name255} 0755
expect 0 mkdir ${name255}/${name255} 0755
expect 0 mkdir ${name255}/${name255}/${name255} 0755
expect 0 mkdir ${path1021} 0755
expect 0 mkfifo ${path1023} 0644
expect 0 unlink ${path1023}
create_too_long
expect ENAMETOOLONG mkfifo ${too_long} 0644
unlink_too_long
expect 0 rmdir ${path1021}
expect 0 rmdir ${name255}/${name255}/${name255}
expect 0 rmdir ${name255}/${name255}
expect 0 rmdir ${name255}

View File

@@ -0,0 +1,16 @@
#!/bin/sh
# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/04.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
desc="mkfifo returns ENOENT if a component of the path prefix does not exist"
dir=`dirname $0`
. ${dir}/../misc.sh
echo "1..3"
n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
expect ENOENT mkfifo ${n0}/${n1}/test 0644
expect 0 rmdir ${n0}

View File

@@ -0,0 +1,29 @@
#!/bin/sh
# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/05.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
desc="mkfifo returns EACCES when search permission is denied for a component of the path prefix"
dir=`dirname $0`
. ${dir}/../misc.sh
echo "1..12"
n0=`namegen`
n1=`namegen`
n2=`namegen`
expect 0 mkdir ${n0} 0755
cdir=`pwd`
cd ${n0}
expect 0 mkdir ${n1} 0755
expect 0 chown ${n1} 65534 65534
expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n2} 0644
expect 0 -u 65534 -g 65534 unlink ${n1}/${n2}
expect 0 chmod ${n1} 0644
expect EACCES -u 65534 -g 65534 mkfifo ${n1}/${n2} 0644
expect 0 chmod ${n1} 0755
expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n2} 0644
expect 0 -u 65534 -g 65534 unlink ${n1}/${n2}
expect 0 rmdir ${n1}
cd ${cdir}
expect 0 rmdir ${n0}

View File

@@ -0,0 +1,29 @@
#!/bin/sh
# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/06.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
desc="mkfifo returns EACCES when write permission is denied on the parent directory of the file to be created"
dir=`dirname $0`
. ${dir}/../misc.sh
echo "1..12"
n0=`namegen`
n1=`namegen`
n2=`namegen`
expect 0 mkdir ${n0} 0755
cdir=`pwd`
cd ${n0}
expect 0 mkdir ${n1} 0755
expect 0 chown ${n1} 65534 65534
expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n2} 0644
expect 0 -u 65534 -g 65534 unlink ${n1}/${n2}
expect 0 chmod ${n1} 0555
expect EACCES -u 65534 -g 65534 mkfifo ${n1}/${n2} 0644
expect 0 chmod ${n1} 0755
expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n2} 0644
expect 0 -u 65534 -g 65534 unlink ${n1}/${n2}
expect 0 rmdir ${n1}
cd ${cdir}
expect 0 rmdir ${n0}

View File

@@ -0,0 +1,19 @@
#!/bin/sh
# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/07.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
desc="mkfifo returns ELOOP if too many symbolic links were encountered in translating the pathname"
dir=`dirname $0`
. ${dir}/../misc.sh
echo "1..6"
n0=`namegen`
n1=`namegen`
expect 0 symlink ${n0} ${n1}
expect 0 symlink ${n1} ${n0}
expect ELOOP mkfifo ${n0}/test 0644
expect ELOOP mkfifo ${n1}/test 0644
expect 0 unlink ${n0}
expect 0 unlink ${n1}

View File

@@ -0,0 +1,34 @@
#!/bin/sh
# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/08.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
desc="mkfifo returns EROFS if the named file resides on a read-only file system"
dir=`dirname $0`
. ${dir}/../misc.sh
case "${os}:${fs}" in
FreeBSD:UFS)
echo "1..7"
n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 mkfifo ${n0}/${n1} 0644
expect 0 unlink ${n0}/${n1}
mount -ur /dev/md${n}
expect EROFS mkfifo ${n0}/${n1} 0644
mount -uw /dev/md${n}
expect 0 mkfifo ${n0}/${n1} 0644
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}
;;
*)
quick_exit
;;
esac

View File

@@ -0,0 +1,27 @@
#!/bin/sh
# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/09.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
desc="mkfifo returns EEXIST if the named file exists"
dir=`dirname $0`
. ${dir}/../misc.sh
echo "1..12"
n0=`namegen`
expect 0 mkdir ${n0} 0755
expect EEXIST mkfifo ${n0} 0644
expect 0 rmdir ${n0}
expect 0 create ${n0} 0644
expect EEXIST mkfifo ${n0} 0644
expect 0 unlink ${n0}
expect 0 symlink test ${n0}
expect EEXIST mkfifo ${n0} 0644
expect 0 unlink ${n0}
expect 0 mkfifo ${n0} 0644
expect EEXIST mkfifo ${n0} 0644
expect 0 unlink ${n0}

View File

@@ -0,0 +1,53 @@
#!/bin/sh
# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/10.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
desc="mkfifo returns EPERM if the parent directory of the file to be created has its immutable flag set"
dir=`dirname $0`
. ${dir}/../misc.sh
require chflags
echo "1..30"
n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
expect 0 mkfifo ${n0}/${n1} 0644
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} SF_IMMUTABLE
expect EPERM mkfifo ${n0}/${n1} 0644
expect 0 chflags ${n0} none
expect 0 mkfifo ${n0}/${n1} 0644
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM mkfifo ${n0}/${n1} 0644
expect 0 chflags ${n0} none
expect 0 mkfifo ${n0}/${n1} 0644
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} SF_APPEND
expect 0 mkfifo ${n0}/${n1} 0644
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} UF_APPEND
expect 0 mkfifo ${n0}/${n1} 0644
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} SF_NOUNLINK
expect 0 mkfifo ${n0}/${n1} 0644
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 chflags ${n0} UF_NOUNLINK
expect 0 mkfifo ${n0}/${n1} 0644
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 rmdir ${n0}

View File

@@ -0,0 +1,36 @@
#!/bin/sh
# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/11.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
desc="mkfifo returns ENOSPC if there are no free inodes on the file system on which the file is being created"
dir=`dirname $0`
. ${dir}/../misc.sh
case "${os}:${fs}" in
FreeBSD:UFS)
echo "1..3"
n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 256k`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
i=0
while :; do
mkfifo ${n0}/${i} >/dev/null 2>&1
if [ $? -ne 0 ]; then
break
fi
i=`expr $i + 1`
done
expect ENOSPC mkfifo ${n0}/${n1} 0644
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}
;;
*)
quick_exit
;;
esac

View File

@@ -0,0 +1,12 @@
#!/bin/sh
# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/12.t,v 1.1 2007/01/17 01:42:10 pjd Exp $
desc="mkfifo returns EFAULT if the path argument points outside the process's allocated address space"
dir=`dirname $0`
. ${dir}/../misc.sh
echo "1..2"
expect EFAULT mkfifo NULL 0644
expect EFAULT mkfifo DEADCODE 0644