diff options
Diffstat (limited to 'tools/regression')
27 files changed, 0 insertions, 4241 deletions
diff --git a/tools/regression/acltools/00.t b/tools/regression/acltools/00.t deleted file mode 100644 index 8899088..0000000 --- a/tools/regression/acltools/00.t +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2008, 2009 Edward Tomasz Napierała <trasz@FreeBSD.org> -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $FreeBSD$ -# - -# This is a wrapper script to run tools-posix.test on UFS filesystem. -# -# If any of the tests fails, here is how to debug it: go to -# the directory with problematic filesystem mounted on it, -# and do /path/to/test run /path/to/test tools-posix.test, e.g. -# -# /usr/src/tools/regression/acltools/run /usr/src/tools/regression/acltools/tools-posix.test -# -# Output should be obvious. - -echo "1..4" - -if [ `whoami` != "root" ]; then - echo "not ok 1 - you need to be root to run this test." - exit 1 -fi - -TESTDIR=$(dirname $(realpath $0)) - -# Set up the test filesystem. -MD=`mdconfig -at swap -s 10m` -MNT=`mktemp -dt acltools` -newfs /dev/$MD > /dev/null -mount -o acls /dev/$MD $MNT -if [ $? -ne 0 ]; then - echo "not ok 1 - mount failed." - exit 1 -fi - -echo "ok 1" - -cd $MNT - -# First, check whether we can crash the kernel by creating too many -# entries. For some reason this won't work in the test file. -touch xxx -i=0; -while :; do i=$(($i+1)); setfacl -m u:$i:rwx xxx 2> /dev/null; if [ $? -ne 0 ]; then break; fi; done -chmod 600 xxx -rm xxx -echo "ok 2" - -perl $TESTDIR/run $TESTDIR/tools-posix.test > /dev/null - -if [ $? -eq 0 ]; then - echo "ok 3" -else - echo "not ok 3" -fi - -cd / -umount -f $MNT -rmdir $MNT -mdconfig -du $MD - -echo "ok 4" diff --git a/tools/regression/acltools/01.t b/tools/regression/acltools/01.t deleted file mode 100644 index f84e0a9..0000000 --- a/tools/regression/acltools/01.t +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2008, 2009 Edward Tomasz Napierała <trasz@FreeBSD.org> -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $FreeBSD$ -# - -# This is a wrapper script to run tools-nfs4.test on ZFS filesystem. -# -# WARNING: It uses hardcoded ZFS pool name "acltools" -# -# If any of the tests fails, here is how to debug it: go to -# the directory with problematic filesystem mounted on it, -# and do /path/to/test run /path/to/test tools-nfs4.test, e.g. -# -# /usr/src/tools/regression/acltools/run /usr/src/tools/regression/acltools/tools-nfs4.test -# -# Output should be obvious. - -echo "1..4" - -if [ `whoami` != "root" ]; then - echo "not ok 1 - you need to be root to run this test." - exit 1 -fi - -TESTDIR=$(dirname $(realpath $0)) - -# Set up the test filesystem. -MD=`mdconfig -at swap -s 64m` -MNT=`mktemp -dt acltools` -zpool create -m $MNT acltools /dev/$MD -if [ $? -ne 0 ]; then - echo "not ok 1 - 'zpool create' failed." - exit 1 -fi - -echo "ok 1" - -cd $MNT - -# First, check whether we can crash the kernel by creating too many -# entries. For some reason this won't work in the test file. -touch xxx -setfacl -x2 xxx -while :; do setfacl -a0 u:42:rwx:allow xxx 2> /dev/null; if [ $? -ne 0 ]; then break; fi; done -chmod 600 xxx -rm xxx -echo "ok 2" - -perl $TESTDIR/run $TESTDIR/tools-nfs4-psarc.test > /dev/null - -if [ $? -eq 0 ]; then - echo "ok 3" -else - echo "not ok 3" -fi - -cd / -zpool destroy -f acltools -rmdir $MNT -mdconfig -du $MD - -echo "ok 4" diff --git a/tools/regression/acltools/02.t b/tools/regression/acltools/02.t deleted file mode 100644 index 9a82c78..0000000 --- a/tools/regression/acltools/02.t +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2008, 2009 Edward Tomasz Napierała <trasz@FreeBSD.org> -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $FreeBSD$ -# - -# This is a wrapper script to run tools-nfs4.test on UFS filesystem. -# -# If any of the tests fails, here is how to debug it: go to -# the directory with problematic filesystem mounted on it, -# and do /path/to/test run /path/to/test tools-nfs4.test, e.g. -# -# /usr/src/tools/regression/acltools/run /usr/src/tools/regression/acltools/tools-nfs4.test -# -# Output should be obvious. - -echo "1..4" - -if [ `whoami` != "root" ]; then - echo "not ok 1 - you need to be root to run this test." - exit 1 -fi - -TESTDIR=$(dirname $(realpath $0)) - -# Set up the test filesystem. -MD=`mdconfig -at swap -s 10m` -MNT=`mktemp -dt acltools` -newfs /dev/$MD > /dev/null -mount -o nfsv4acls /dev/$MD $MNT -if [ $? -ne 0 ]; then - echo "not ok 1 - mount failed." - exit 1 -fi - -echo "ok 1" - -cd $MNT - -# First, check whether we can crash the kernel by creating too many -# entries. For some reason this won't work in the test file. -touch xxx -setfacl -x2 xxx -while :; do setfacl -a0 u:42:rwx:allow xxx 2> /dev/null; if [ $? -ne 0 ]; then break; fi; done -chmod 600 xxx -rm xxx -echo "ok 2" - -if [ `sysctl -n vfs.acl_nfs4_old_semantics` = 0 ]; then - perl $TESTDIR/run $TESTDIR/tools-nfs4-psarc.test > /dev/null -else - perl $TESTDIR/run $TESTDIR/tools-nfs4.test > /dev/null -fi - -if [ $? -eq 0 ]; then - echo "ok 3" -else - echo "not ok 3" -fi - -cd / -umount -f $MNT -rmdir $MNT -mdconfig -du $MD - -echo "ok 4" - diff --git a/tools/regression/acltools/03.t b/tools/regression/acltools/03.t deleted file mode 100644 index a0b4199..0000000 --- a/tools/regression/acltools/03.t +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2008, 2009 Edward Tomasz Napierała <trasz@FreeBSD.org> -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $FreeBSD$ -# - -# This is a wrapper script to run tools-crossfs.test between UFS without -# ACLs, UFS with POSIX.1e ACLs, and ZFS with NFSv4 ACLs. -# -# WARNING: It uses hardcoded ZFS pool name "acltools" -# -# Output should be obvious. - -echo "1..5" - -if [ `whoami` != "root" ]; then - echo "not ok 1 - you need to be root to run this test." - exit 1 -fi - -TESTDIR=$(dirname $(realpath $0)) -MNTROOT=`mktemp -dt acltools` - -# Set up the test filesystems. -MD1=`mdconfig -at swap -s 64m` -MNT1=$MNTROOT/nfs4 -mkdir $MNT1 -zpool create -m $MNT1 acltools /dev/$MD1 -if [ $? -ne 0 ]; then - echo "not ok 1 - 'zpool create' failed." - exit 1 -fi - -echo "ok 1" - -MD2=`mdconfig -at swap -s 10m` -MNT2=$MNTROOT/posix -mkdir $MNT2 -newfs /dev/$MD2 > /dev/null -mount -o acls /dev/$MD2 $MNT2 -if [ $? -ne 0 ]; then - echo "not ok 2 - mount failed." - exit 1 -fi - -echo "ok 2" - -MD3=`mdconfig -at swap -s 10m` -MNT3=$MNTROOT/none -mkdir $MNT3 -newfs /dev/$MD3 > /dev/null -mount /dev/$MD3 $MNT3 -if [ $? -ne 0 ]; then - echo "not ok 3 - mount failed." - exit 1 -fi - -echo "ok 3" - -cd $MNTROOT - -perl $TESTDIR/run $TESTDIR/tools-crossfs.test > /dev/null - -if [ $? -eq 0 ]; then - echo "ok 4" -else - echo "not ok 4" -fi - -cd / - -umount -f $MNT3 -rmdir $MNT3 -mdconfig -du $MD3 - -umount -f $MNT2 -rmdir $MNT2 -mdconfig -du $MD2 - -zpool destroy -f acltools -rmdir $MNT1 -mdconfig -du $MD1 - -rmdir $MNTROOT - -echo "ok 5" - diff --git a/tools/regression/acltools/04.t b/tools/regression/acltools/04.t deleted file mode 100644 index 1a13183..0000000 --- a/tools/regression/acltools/04.t +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2011 Edward Tomasz Napierała <trasz@FreeBSD.org> -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $FreeBSD$ -# - -# This is a wrapper script to run tools-nfs4-trivial.test on ZFS filesystem. -# -# WARNING: It uses hardcoded ZFS pool name "acltools" - -echo "1..3" - -if [ `whoami` != "root" ]; then - echo "not ok 1 - you need to be root to run this test." - exit 1 -fi - -TESTDIR=$(dirname $(realpath $0)) - -# Set up the test filesystem. -MD=`mdconfig -at swap -s 64m` -MNT=`mktemp -dt acltools` -zpool create -m $MNT acltools /dev/$MD -if [ $? -ne 0 ]; then - echo "not ok 1 - 'zpool create' failed." - exit 1 -fi - -echo "ok 1" - -cd $MNT - -perl $TESTDIR/run $TESTDIR/tools-nfs4-trivial.test > /dev/null - -if [ $? -eq 0 ]; then - echo "ok 2" -else - echo "not ok 2" -fi - -cd / -zpool destroy -f acltools -rmdir $MNT -mdconfig -du $MD - -echo "ok 3" diff --git a/tools/regression/acltools/aclfuzzer.sh b/tools/regression/acltools/aclfuzzer.sh deleted file mode 100755 index dff07d8..0000000 --- a/tools/regression/acltools/aclfuzzer.sh +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2008, 2009 Edward Tomasz Napierała <trasz@FreeBSD.org> -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $FreeBSD$ -# - -# This is an NFSv4 ACL fuzzer. It expects to be run by non-root in a scratch -# directory on a filesystem with NFSv4 ACLs support. Output it generates -# is expected to be fed to /usr/src/tools/regression/acltools/run script. - -NUMBER_OF_COMMANDS=300 - -run_command() -{ - echo "\$ $1" - eval $1 2>&1 | sed 's/^/> /' -} - -rnd_from_0_to() -{ - max=`expr $1 + 1` - rnd=`jot -r 1` - rnd=`expr $rnd % $max` - - echo $rnd -} - -rnd_path() -{ - rnd=`rnd_from_0_to 3` - case $rnd in - 0) echo "$TMP/aaa" ;; - 1) echo "$TMP/bbb" ;; - 2) echo "$TMP/aaa/ccc" ;; - 3) echo "$TMP/bbb/ddd" ;; - esac -} - -f_prepend_random_acl_on() -{ - rnd=`rnd_from_0_to 4` - case $rnd in - 0) u="owner@" ;; - 1) u="group@" ;; - 2) u="everyone@" ;; - 3) u="u:1138" ;; - 4) u="g:1138" ;; - esac - - p="" - while :; do - rnd=`rnd_from_0_to 30` - if [ -n "$p" -a $rnd -ge 14 ]; then - break; - fi - - case $rnd in - 0) p="${p}r" ;; - 1) p="${p}w" ;; - 2) p="${p}x" ;; - 3) p="${p}p" ;; - 4) p="${p}d" ;; - 5) p="${p}D" ;; - 6) p="${p}a" ;; - 7) p="${p}A" ;; - 8) p="${p}R" ;; - 9) p="${p}W" ;; - 10) p="${p}R" ;; - 11) p="${p}c" ;; - 12) p="${p}C" ;; - 13) p="${p}o" ;; - 14) p="${p}s" ;; - esac - done - - f="" - while :; do - rnd=`rnd_from_0_to 10` - if [ $rnd -ge 6 ]; then - break; - fi - - case $rnd in - 0) f="${f}f" ;; - 1) f="${f}d" ;; - 2) f="${f}n" ;; - 3) f="${f}i" ;; - esac - done - - rnd=`rnd_from_0_to 1` - case $rnd in - 0) x="allow" ;; - 1) x="deny" ;; - esac - - acl="$u:$p:$f:$x" - - file=`rnd_path` - run_command "setfacl -a0 $acl $file" -} - -f_getfacl() -{ - file=`rnd_path` - run_command "getfacl -qn $file" -} - -f_ls_mode() -{ - file=`rnd_path` - run_command "ls -al $file | sed -n '2p' | cut -d' ' -f1" -} - -f_chmod() -{ - b1=`rnd_from_0_to 7` - b2=`rnd_from_0_to 7` - b3=`rnd_from_0_to 7` - b4=`rnd_from_0_to 7` - file=`rnd_path` - - run_command "chmod $b1$b2$b3$b4 $file $2" -} - -f_touch() -{ - file=`rnd_path` - run_command "touch $file" -} - -f_rm() -{ - file=`rnd_path` - run_command "rm -f $file" -} - -f_mkdir() -{ - file=`rnd_path` - run_command "mkdir $file" -} - -f_rmdir() -{ - file=`rnd_path` - run_command "rmdir $file" -} - -f_mv() -{ - from=`rnd_path` - to=`rnd_path` - run_command "mv -f $from $to" -} - -# XXX: To be implemented: chown(8), setting times with touch(1). - -switch_to_random_user() -{ - # XXX: To be implemented. -} - -execute_random_command() -{ - rnd=`rnd_from_0_to 20` - - case $rnd in - 0|10|11|12|13|15) cmd=f_prepend_random_acl_on ;; - 1) cmd=f_getfacl ;; - 2) cmd=f_ls_mode ;; - 3) cmd=f_chmod ;; - 4|18|19) cmd=f_touch ;; - 5) cmd=f_rm ;; - 6|16|17) cmd=f_mkdir ;; - 7) cmd=f_rmdir ;; - 8) cmd=f_mv ;; - esac - - $cmd "XXX" -} - -echo "# Fuzzing; will stop after $NUMBER_OF_COMMANDS commands." -TMP="aclfuzzer_`dd if=/dev/random bs=1k count=1 2>/dev/null | openssl md5`" - -run_command "whoami" -umask 022 -run_command "umask 022" -run_command "mkdir $TMP" - -i=0; -while [ "$i" -lt "$NUMBER_OF_COMMANDS" ]; do - switch_to_random_user - execute_random_command - i=`expr $i + 1` -done - -run_command "find $TMP -exec setfacl -a0 everyone@:rxd:allow {} \;" -run_command "rm -rfv $TMP" - -echo "# Fuzzed, thank you." - diff --git a/tools/regression/acltools/mktrivial.sh b/tools/regression/acltools/mktrivial.sh deleted file mode 100755 index 99e3614..0000000 --- a/tools/regression/acltools/mktrivial.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2010 Edward Tomasz Napierała <trasz@FreeBSD.org> -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $FreeBSD$ -# - -# This shell script generates an input file for the "run" script, used -# to verify generation of trivial ACLs. - -echo "$ touch f" -touch f - -for s in `jot 7 0 7`; do - for u in `jot 7 0 7`; do - for g in `jot 7 0 7`; do - for o in `jot 7 0 7`; do - echo "$ chmod 0$s$u$g$o f" - chmod "0$s$u$g$o" f - echo "$ ls -l f | cut -d' ' -f1" - ls -l f | cut -d' ' -f1 | sed 's/^/> /' - echo "$ getfacl -q f" - getfacl -q f | sed 's/^/> /' - done - done - done -done - -echo "$ rm f" -rm f - diff --git a/tools/regression/acltools/run b/tools/regression/acltools/run deleted file mode 100644 index 383f47e..0000000 --- a/tools/regression/acltools/run +++ /dev/null @@ -1,329 +0,0 @@ -#!/usr/bin/perl -w -U - -# Copyright (c) 2007, 2008 Andreas Gruenbacher. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions, and the following disclaimer, -# without modification, immediately at the beginning of the file. -# 2. The name of the author may not be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# Alternatively, this software may be distributed under the terms of the -# GNU Public License ("GPL"). -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR -# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $FreeBSD$ -# - -# -# Possible improvements: -# -# - distinguish stdout and stderr output -# - add environment variable like assignments -# - run up to a specific line -# - resume at a specific line -# - -use strict; -use FileHandle; -use Getopt::Std; -use POSIX qw(isatty setuid getcwd); -use vars qw($opt_l $opt_v); - -no warnings qw(taint); - -$opt_l = ~0; # a really huge number -getopts('l:v'); - -my ($OK, $FAILED) = ("ok", "failed"); -if (isatty(fileno(STDOUT))) { - $OK = "\033[32m" . $OK . "\033[m"; - $FAILED = "\033[31m\033[1m" . $FAILED . "\033[m"; -} - -sub exec_test($$); -sub process_test($$$$); - -my ($prog, $in, $out) = ([], [], []); -my $prog_line = 0; -my ($tests, $failed) = (0,0); -my $lineno; -my $width = ($ENV{COLUMNS} || 80) >> 1; - -for (;;) { - my $line = <>; $lineno++; - if (defined $line) { - # Substitute %VAR and %{VAR} with environment variables. - $line =~ s[%(\w+)][$ENV{$1}]eg; - $line =~ s[%{(\w+)}][$ENV{$1}]eg; - } - if (defined $line) { - if ($line =~ s/^\s*< ?//) { - push @$in, $line; - } elsif ($line =~ s/^\s*> ?//) { - push @$out, $line; - } else { - process_test($prog, $prog_line, $in, $out); - last if $prog_line >= $opt_l; - - $prog = []; - $prog_line = 0; - } - if ($line =~ s/^\s*\$ ?//) { - $prog = [ map { s/\\(.)/$1/g; $_ } split /(?<!\\)\s+/, $line ]; - $prog_line = $lineno; - $in = []; - $out = []; - } - } else { - process_test($prog, $prog_line, $in, $out); - last; - } -} - -my $status = sprintf("%d commands (%d passed, %d failed)", - $tests, $tests-$failed, $failed); -if (isatty(fileno(STDOUT))) { - if ($failed) { - $status = "\033[31m\033[1m" . $status . "\033[m"; - } else { - $status = "\033[32m" . $status . "\033[m"; - } -} -print $status, "\n"; -exit $failed ? 1 : 0; - - -sub process_test($$$$) { - my ($prog, $prog_line, $in, $out) = @_; - - return unless @$prog; - - my $p = [ @$prog ]; - print "[$prog_line] \$ ", join(' ', - map { s/\s/\\$&/g; $_ } @$p), " -- "; - my $result = exec_test($prog, $in); - my @good = (); - my $nmax = (@$out > @$result) ? @$out : @$result; - for (my $n=0; $n < $nmax; $n++) { - my $use_re; - if (defined $out->[$n] && $out->[$n] =~ /^~ /) { - $use_re = 1; - $out->[$n] =~ s/^~ //g; - } - - if (!defined($out->[$n]) || !defined($result->[$n]) || - (!$use_re && $result->[$n] ne $out->[$n]) || - ( $use_re && $result->[$n] !~ /^$out->[$n]/)) { - push @good, ($use_re ? '!~' : '!='); - } - else { - push @good, ($use_re ? '=~' : '=='); - } - } - my $good = !(grep /!/, @good); - $tests++; - $failed++ unless $good; - print $good ? $OK : $FAILED, "\n"; - if (!$good || $opt_v) { - for (my $n=0; $n < $nmax; $n++) { - my $l = defined($out->[$n]) ? $out->[$n] : "~"; - chomp $l; - my $r = defined($result->[$n]) ? $result->[$n] : "~"; - chomp $r; - print sprintf("%-" . ($width-3) . "s %s %s\n", - $r, $good[$n], $l); - } - } -} - - -sub su($) { - my ($user) = @_; - - $user ||= "root"; - - my ($login, $pass, $uid, $gid) = getpwnam($user) - or return [ "su: user $user does not exist\n" ]; - my @groups = (); - my $fh = new FileHandle("/etc/group") - or return [ "opening /etc/group: $!\n" ]; - while (<$fh>) { - chomp; - my ($group, $passwd, $gid, $users) = split /:/; - foreach my $u (split /,/, $users) { - push @groups, $gid - if ($user eq $u); - } - } - $fh->close; - - my $groups = join(" ", ($gid, $gid, @groups)); - #print STDERR "[[$groups]]\n"; - $! = 0; # reset errno - $> = 0; - $( = $gid; - $) = $groups; - if ($!) { - return [ "su: $!\n" ]; - } - if ($uid != 0) { - $> = $uid; - #$< = $uid; - if ($!) { - return [ "su: $prog->[1]: $!\n" ]; - } - } - #print STDERR "[($>,$<)($(,$))]"; - return []; -} - - -sub sg($) { - my ($group) = @_; - - my $gid = getgrnam($group) - or return [ "sg: group $group does not exist\n" ]; - my %groups = map { $_ eq $gid ? () : ($_ => 1) } (split /\s/, $)); - - #print STDERR "<<", join("/", keys %groups), ">>\n"; - my $groups = join(" ", ($gid, $gid, keys %groups)); - #print STDERR "[[$groups]]\n"; - $! = 0; # reset errno - if ($> != 0) { - my $uid = $>; - $> = 0; - $( = $gid; - $) = $groups; - $> = $uid; - } else { - $( = $gid; - $) = $groups; - } - if ($!) { - return [ "sg: $!\n" ]; - } - print STDERR "[($>,$<)($(,$))]"; - return []; -} - - -sub exec_test($$) { - my ($prog, $in) = @_; - local (*IN, *IN_DUP, *IN2, *OUT_DUP, *OUT, *OUT2); - my $needs_shell = (join('', @$prog) =~ /[][|<>"'`\$\*\?]/); - - if ($prog->[0] eq "umask") { - umask oct $prog->[1]; - return []; - } elsif ($prog->[0] eq "cd") { - if (!chdir $prog->[1]) { - return [ "chdir: $prog->[1]: $!\n" ]; - } - $ENV{PWD} = getcwd; - return []; - } elsif ($prog->[0] eq "su") { - return su($prog->[1]); - } elsif ($prog->[0] eq "sg") { - return sg($prog->[1]); - } elsif ($prog->[0] eq "export") { - my ($name, $value) = split /=/, $prog->[1]; - # FIXME: need to evaluate $value, so that things like this will work: - # export dir=$PWD/dir - $ENV{$name} = $value; - return []; - } elsif ($prog->[0] eq "unset") { - delete $ENV{$prog->[1]}; - return []; - } - - pipe *IN2, *OUT - or die "Can't create pipe for reading: $!"; - open *IN_DUP, "<&STDIN" - or *IN_DUP = undef; - open *STDIN, "<&IN2" - or die "Can't duplicate pipe for reading: $!"; - close *IN2; - - open *OUT_DUP, ">&STDOUT" - or die "Can't duplicate STDOUT: $!"; - pipe *IN, *OUT2 - or die "Can't create pipe for writing: $!"; - open *STDOUT, ">&OUT2" - or die "Can't duplicate pipe for writing: $!"; - close *OUT2; - - *STDOUT->autoflush(); - *OUT->autoflush(); - - $SIG{CHLD} = 'IGNORE'; - - if (fork()) { - # Server - if (*IN_DUP) { - open *STDIN, "<&IN_DUP" - or die "Can't duplicate STDIN: $!"; - close *IN_DUP - or die "Can't close STDIN duplicate: $!"; - } - open *STDOUT, ">&OUT_DUP" - or die "Can't duplicate STDOUT: $!"; - close *OUT_DUP - or die "Can't close STDOUT duplicate: $!"; - - foreach my $line (@$in) { - #print "> $line"; - print OUT $line; - } - close *OUT - or die "Can't close pipe for writing: $!"; - - my $result = []; - while (<IN>) { - #print "< $_"; - if ($needs_shell) { - s#^/bin/sh: line \d+: ##; - } - push @$result, $_; - } - return $result; - } else { - # Client - $< = $>; - close IN - or die "Can't close read end for input pipe: $!"; - close OUT - or die "Can't close write end for output pipe: $!"; - close OUT_DUP - or die "Can't close STDOUT duplicate: $!"; - local *ERR_DUP; - open ERR_DUP, ">&STDERR" - or die "Can't duplicate STDERR: $!"; - open STDERR, ">&STDOUT" - or die "Can't join STDOUT and STDERR: $!"; - - if ($needs_shell) { - exec ('/bin/sh', '-c', join(" ", @$prog)); - } else { - exec @$prog; - } - print STDERR $prog->[0], ": $!\n"; - exit; - } -} - diff --git a/tools/regression/acltools/tools-crossfs.test b/tools/regression/acltools/tools-crossfs.test deleted file mode 100644 index 498fba5..0000000 --- a/tools/regression/acltools/tools-crossfs.test +++ /dev/null @@ -1,323 +0,0 @@ -# Copyright (c) 2008, 2009 Edward Tomasz Napierała <trasz@FreeBSD.org> -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $FreeBSD$ -# - -# This is a tools-level test intended to verify that cp(1) and mv(1) -# do the right thing with respect to ACLs. Run it as root using -# ACL-enabled kernel: -# -# /usr/src/tools/regression/acltools/run /usr/src/tools/regression/acltools/tools-nfs4.test -# -# You need to have three subdirectories, named nfs4, posix and none, -# with filesystems with NFSv4 ACLs, POSIX.1e ACLs and no ACLs enabled, -# respectively, mounted on them, in your current directory. -# -# WARNING: Creates files in unsafe way. - -$ whoami -> root -$ umask 022 - -$ touch nfs4/xxx -$ getfacl -nq nfs4/xxx -> owner@:rw-p--aARWcCos:------:allow -> group@:r-----a-R-c--s:------:allow -> everyone@:r-----a-R-c--s:------:allow - -$ touch posix/xxx -$ getfacl -nq posix/xxx -> user::rw- -> group::r-- -> other::r-- - -# mv with POSIX.1e ACLs. -$ rm -f posix/xxx -$ rm -f posix/yyy -$ touch posix/xxx -$ chmod 456 posix/xxx -$ ls -l posix/xxx | cut -d' ' -f1 -> -r--r-xrw- -$ setfacl -m u:42:x,g:43:w posix/xxx -$ mv posix/xxx posix/yyy -$ getfacl -nq posix/yyy -> user::r-- -> user:42:--x -> group::r-x -> group:43:-w- -> mask::rwx -> other::rw- -$ ls -l posix/yyy | cut -d' ' -f1 -> -r--rwxrw-+ - -# mv from POSIX.1e to none. -$ rm -f posix/xxx -$ rm -f none/xxx -$ touch posix/xxx -$ chmod 345 posix/xxx -$ setfacl -m u:42:x,g:43:w posix/xxx -$ ls -l posix/xxx | cut -d' ' -f1 -> --wxrwxr-x+ -$ mv posix/xxx none/xxx -> mv: failed to set acl entries for none/xxx: Operation not supported -$ ls -l none/xxx | cut -d' ' -f1 -> --wxrwxr-x - -# mv from POSIX.1e to NFSv4. -$ rm -f posix/xxx -$ rm -f nfs4/xxx -$ touch posix/xxx -$ chmod 456 posix/xxx -$ setfacl -m u:42:x,g:43:w posix/xxx -$ ls -l posix/xxx | cut -d' ' -f1 -> -r--rwxrw-+ -$ mv posix/yyy nfs4/xxx -> mv: failed to set acl entries for nfs4/xxx: Invalid argument -$ getfacl -nq nfs4/xxx -> owner@:-wxp----------:------:deny -> owner@:r-----aARWcCos:------:allow -> group@:rwxp--a-R-c--s:------:allow -> everyone@:rw-p--a-R-c--s:------:allow -$ ls -l nfs4/xxx | cut -d' ' -f1 -> -r--rwxrw- - -# mv with NFSv4 ACLs. -$ rm -f nfs4/xxx -$ rm -f nfs4/yyy -$ touch nfs4/xxx -$ setfacl -a0 u:42:x:allow,g:43:w:allow nfs4/xxx -$ mv nfs4/xxx nfs4/yyy -$ getfacl -nq nfs4/yyy -> user:42:--x-----------:------:allow -> group:43:-w------------:------:allow -> owner@:rw-p--aARWcCos:------:allow -> group@:r-----a-R-c--s:------:allow -> everyone@:r-----a-R-c--s:------:allow -$ ls -l nfs4/yyy | cut -d' ' -f1 -> -rw-r--r--+ - -# mv from NFSv4 to POSIX.1e without any ACLs. -$ rm -f nfs4/xxx -$ rm -f posix/xxx -$ touch nfs4/xxx -$ chmod 456 nfs4/xxx -$ ls -l nfs4/xxx | cut -d' ' -f1 -> -r--r-xrw- -$ mv nfs4/xxx posix/xxx -$ ls -l posix/xxx | cut -d' ' -f1 -> -r--r-xrw- - -# mv from NFSv4 to none. -$ rm -f nfs4/xxx -$ rm -f none/xxx -$ touch nfs4/xxx -$ chmod 345 nfs4/xxx -$ ls -l nfs4/xxx | cut -d' ' -f1 -> --wxr--r-x -$ setfacl -a0 u:42:x:allow,g:43:w:allow nfs4/xxx -$ ls -l nfs4/xxx | cut -d' ' -f1 -> --wxr--r-x+ -$ mv nfs4/xxx none/xxx -> mv: failed to set acl entries for none/xxx: Operation not supported -$ ls -l none/xxx | cut -d' ' -f1 -> --wxr--r-x - -# mv from NFSv4 to POSIX.1e. -$ rm -f nfs4/xxx -$ rm -f posix/xxx -$ touch nfs4/xxx -$ chmod 345 nfs4/xxx -$ ls -l nfs4/xxx | cut -d' ' -f1 -> --wxr--r-x -$ setfacl -a0 u:42:x:allow,g:43:w:allow nfs4/xxx -$ ls -l nfs4/xxx | cut -d' ' -f1 -> --wxr--r-x+ -$ mv nfs4/xxx posix/xxx -> mv: failed to set acl entries for posix/xxx: Invalid argument -$ ls -l posix/xxx | cut -d' ' -f1 -> --wxr--r-x - -# cp with POSIX.1e ACLs. -$ rm -f posix/xxx -$ rm -f posix/yyy -$ touch posix/xxx -$ setfacl -m u:42:x,g:43:w posix/xxx -$ ls -l posix/xxx | cut -d' ' -f1 -> -rw-rwxr--+ -$ cp posix/xxx posix/yyy -$ ls -l posix/yyy | cut -d' ' -f1 -> -rw-r-xr-- - -# cp -p with POSIX.1e ACLs. -$ rm -f posix/xxx -$ rm -f posix/yyy -$ touch posix/xxx -$ setfacl -m u:42:x,g:43:w posix/xxx -$ getfacl -nq posix/xxx -> user::rw- -> user:42:--x -> group::r-- -> group:43:-w- -> mask::rwx -> other::r-- -$ ls -l posix/xxx | cut -d' ' -f1 -> -rw-rwxr--+ -$ cp -p posix/xxx posix/yyy -$ getfacl -nq posix/yyy -> user::rw- -> user:42:--x -> group::r-- -> group:43:-w- -> mask::rwx -> other::r-- -$ ls -l posix/yyy | cut -d' ' -f1 -> -rw-rwxr--+ - -# cp from POSIX.1e to none. -$ rm -f posix/xxx -$ rm -f none/xxx -$ touch posix/xxx -$ setfacl -m u:42:x,g:43:w posix/xxx -$ ls -l posix/xxx | cut -d' ' -f1 -> -rw-rwxr--+ -$ cp posix/xxx none/xxx -$ ls -l none/xxx | cut -d' ' -f1 -> -rw-r-xr-- - -# cp -p from POSIX.1e to none. -$ rm -f posix/xxx -$ rm -f none/xxx -$ touch posix/xxx -$ setfacl -m u:42:x,g:43:w posix/xxx -$ ls -l posix/xxx | cut -d' ' -f1 -> -rw-rwxr--+ -$ cp -p posix/xxx none/xxx -> cp: failed to set acl entries for none/xxx: Operation not supported -$ ls -l none/xxx | cut -d' ' -f1 -> -rw-rwxr-- - -# cp from POSIX.1e to NFSv4. -$ rm -f posix/xxx -$ rm -f nfs4/xxx -$ touch posix/xxx -$ setfacl -m u:42:x,g:43:w posix/xxx -$ ls -l posix/xxx | cut -d' ' -f1 -> -rw-rwxr--+ -$ cp posix/xxx nfs4/xxx -$ ls -l nfs4/xxx | cut -d' ' -f1 -> -rw-r-xr-- - -# cp -p from POSIX.1e to NFSv4. -$ rm -f posix/xxx -$ rm -f nfs4/xxx -$ touch posix/xxx -$ setfacl -m u:42:x,g:43:w posix/xxx -$ ls -l posix/xxx | cut -d' ' -f1 -> -rw-rwxr--+ -$ cp -p posix/xxx nfs4/xxx -> cp: failed to set acl entries for nfs4/xxx: Invalid argument -$ ls -l nfs4/xxx | cut -d' ' -f1 -> -rw-rwxr-- - -# cp with NFSv4 ACLs. -$ rm -f nfs4/xxx -$ rm -f nfs4/yyy -$ touch nfs4/xxx -$ chmod 543 nfs4/xxx -$ setfacl -a0 u:42:x:allow,g:43:w:allow nfs4/xxx -$ ls -l nfs4/xxx | cut -d' ' -f1 -> -r-xr---wx+ -$ cp nfs4/xxx nfs4/yyy -$ ls -l nfs4/yyy | cut -d' ' -f1 -> -r-xr----x - -# cp -p with NFSv4 ACLs. -$ rm -f nfs4/xxx -$ rm -f nfs4/yyy -$ touch nfs4/xxx -$ chmod 543 nfs4/xxx -$ setfacl -a0 u:42:x:allow,g:43:w:allow nfs4/xxx -$ cp -p nfs4/xxx nfs4/yyy -$ getfacl -nq nfs4/yyy -> user:42:--x-----------:------:allow -> group:43:-w------------:------:allow -> owner@:--x-----------:------:allow -> owner@:-w-p----------:------:deny -> group@:-wxp----------:------:deny -> owner@:r-x---aARWcCos:------:allow -> group@:r-----a-R-c--s:------:allow -> everyone@:-wxp--a-R-c--s:------:allow -$ ls -l nfs4/yyy | cut -d' ' -f1 -> -r-xr---wx+ - -# cp from NFSv4 to none. -$ rm -f nfs4/xxx -$ rm -f none/xxx -$ touch nfs4/xxx -$ chmod 543 nfs4/xxx -$ setfacl -a0 u:42:x:allow,g:43:w:allow nfs4/xxx -$ ls -l nfs4/xxx | cut -d' ' -f1 -> -r-xr---wx+ -$ cp nfs4/xxx none/xxx -$ ls -l none/xxx | cut -d' ' -f1 -> -r-xr----x - -# cp -p from NFSv4 to none. -$ rm -f nfs4/xxx -$ rm -f none/xxx -$ touch nfs4/xxx -$ chmod 543 nfs4/xxx -$ setfacl -a0 u:42:x:allow,g:43:w:allow nfs4/xxx -$ ls -l nfs4/xxx | cut -d' ' -f1 -> -r-xr---wx+ -$ cp -p nfs4/xxx none/xxx -> cp: failed to set acl entries for none/xxx: Operation not supported -$ ls -l none/xxx | cut -d' ' -f1 -> -r-xr---wx - -# cp from NFSv4 to POSIX.1e. -$ rm -f nfs4/xxx -$ rm -f posix/xxx -$ touch nfs4/xxx -$ chmod 543 nfs4/xxx -$ setfacl -a0 u:42:x:allow,g:43:w:allow nfs4/xxx -$ ls -l nfs4/xxx | cut -d' ' -f1 -> -r-xr---wx+ -$ cp nfs4/xxx posix/xxx -$ ls -l posix/xxx | cut -d' ' -f1 -> -r-xr----x - -# cp -p from NFSv4 to POSIX.1e. -$ rm -f nfs4/xxx -$ rm -f posix/xxx -$ touch nfs4/xxx -$ chmod 543 nfs4/xxx -$ setfacl -a0 u:42:x:allow,g:43:w:allow nfs4/xxx -$ ls -l nfs4/xxx | cut -d' ' -f1 -> -r-xr---wx+ -$ cp -p nfs4/xxx posix/xxx -> cp: failed to set acl entries for posix/xxx: Invalid argument -$ ls -l posix/xxx | cut -d' ' -f1 -> -r-xr---wx diff --git a/tools/regression/acltools/tools-nfs4-psarc.test b/tools/regression/acltools/tools-nfs4-psarc.test deleted file mode 100644 index e1e8ffc..0000000 --- a/tools/regression/acltools/tools-nfs4-psarc.test +++ /dev/null @@ -1,562 +0,0 @@ -# Copyright (c) 2008, 2009 Edward Tomasz Napierała <trasz@FreeBSD.org> -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $FreeBSD$ -# - -# This is a tools-level test for NFSv4 ACL functionality with PSARC/2010/029 -# semantics. Run it as root using ACL-enabled kernel: -# -# /usr/src/tools/regression/acltools/run /usr/src/tools/regression/acltools/tools-nfs4-psarc.test -# -# WARNING: Creates files in unsafe way. - -$ whoami -> root -$ umask 022 - -# Smoke test for getfacl(1). -$ touch xxx -$ getfacl xxx -> # file: xxx -> # owner: root -> # group: wheel -> owner@:rw-p--aARWcCos:------:allow -> group@:r-----a-R-c--s:------:allow -> everyone@:r-----a-R-c--s:------:allow - -$ getfacl -q xxx -> owner@:rw-p--aARWcCos:------:allow -> group@:r-----a-R-c--s:------:allow -> everyone@:r-----a-R-c--s:------:allow - -# Check verbose mode formatting. -$ getfacl -v xxx -> # file: xxx -> # owner: root -> # group: wheel -> owner@:read_data/write_data/append_data/read_attributes/write_attributes/read_xattr/write_xattr/read_acl/write_acl/write_owner/synchronize::allow -> group@:read_data/read_attributes/read_xattr/read_acl/synchronize::allow -> everyone@:read_data/read_attributes/read_xattr/read_acl/synchronize::allow - -# Test setfacl -a. -$ setfacl -a2 u:0:write_acl:allow,g:1:read_acl:deny xxx -$ getfacl -n xxx -> # file: xxx -> # owner: root -> # group: wheel -> owner@:rw-p--aARWcCos:------:allow -> group@:r-----a-R-c--s:------:allow -> user:0:-----------C--:------:allow -> group:1:----------c---:------:deny -> everyone@:r-----a-R-c--s:------:allow - -# Test user and group name resolving. -$ rm xxx -$ touch xxx -$ setfacl -a2 u:root:write_acl:allow,g:daemon:read_acl:deny xxx -$ getfacl xxx -> # file: xxx -> # owner: root -> # group: wheel -> owner@:rw-p--aARWcCos:------:allow -> group@:r-----a-R-c--s:------:allow -> user:root:-----------C--:------:allow -> group:daemon:----------c---:------:deny -> everyone@:r-----a-R-c--s:------:allow - -# Check whether ls correctly marks files with "+". -$ ls -l xxx | cut -d' ' -f1 -> -rw-r--r--+ - -# Test removing entries by number. -$ setfacl -x 1 xxx -$ getfacl -n xxx -> # file: xxx -> # owner: root -> # group: wheel -> owner@:rw-p--aARWcCos:------:allow -> user:0:-----------C--:------:allow -> group:1:----------c---:------:deny -> everyone@:r-----a-R-c--s:------:allow - -# Test setfacl -m. -$ setfacl -a0 everyone@:rwx:deny xxx -$ setfacl -a0 everyone@:rwx:deny xxx -$ setfacl -a0 everyone@:rwx:deny xxx -$ setfacl -m everyone@::deny xxx -$ getfacl -n xxx -> # file: xxx -> # owner: root -> # group: wheel -> everyone@:--------------:------:deny -> everyone@:--------------:------:deny -> everyone@:--------------:------:deny -> owner@:rw-p--aARWcCos:------:allow -> user:0:-----------C--:------:allow -> group:1:----------c---:------:deny -> everyone@:r-----a-R-c--s:------:allow - -# Test getfacl -i. -$ getfacl -i xxx -> # file: xxx -> # owner: root -> # group: wheel -> everyone@:--------------:------:deny -> everyone@:--------------:------:deny -> everyone@:--------------:------:deny -> owner@:rw-p--aARWcCos:------:allow -> user:root:-----------C--:------:allow:0 -> group:daemon:----------c---:------:deny:1 -> everyone@:r-----a-R-c--s:------:allow - -# Make sure cp without any flags does not copy copy the ACL. -$ cp xxx yyy -$ ls -l yyy | cut -d' ' -f1 -> -rw-r--r-- - -# Make sure it does with the "-p" flag. -$ rm yyy -$ cp -p xxx yyy -$ getfacl -n yyy -> # file: yyy -> # owner: root -> # group: wheel -> everyone@:--------------:------:deny -> everyone@:--------------:------:deny -> everyone@:--------------:------:deny -> owner@:rw-p--aARWcCos:------:allow -> user:0:-----------C--:------:allow -> group:1:----------c---:------:deny -> everyone@:r-----a-R-c--s:------:allow - -$ rm yyy - -# Test removing entries by... by example? -$ setfacl -x everyone@::deny xxx -$ getfacl -n xxx -> # file: xxx -> # owner: root -> # group: wheel -> owner@:rw-p--aARWcCos:------:allow -> user:0:-----------C--:------:allow -> group:1:----------c---:------:deny -> everyone@:r-----a-R-c--s:------:allow - -# Test setfacl -b. -$ setfacl -b xxx -$ getfacl -n xxx -> # file: xxx -> # owner: root -> # group: wheel -> owner@:rw-p--aARWcCos:------:allow -> group@:r-----a-R-c--s:------:allow -> everyone@:r-----a-R-c--s:------:allow - -$ ls -l xxx | cut -d' ' -f1 -> -rw-r--r-- - -# Check setfacl(1) and getfacl(1) with multiple files. -$ touch xxx yyy zzz - -$ ls -l xxx yyy zzz | cut -d' ' -f1 -> -rw-r--r-- -> -rw-r--r-- -> -rw-r--r-- - -$ setfacl -m u:42:x:allow,g:43:w:allow nnn xxx yyy zzz -> setfacl: nnn: stat() failed: No such file or directory - -$ ls -l nnn xxx yyy zzz | cut -d' ' -f1 -> ls: nnn: No such file or directory -> -rw-r--r--+ -> -rw-r--r--+ -> -rw-r--r--+ - -$ getfacl -nq nnn xxx yyy zzz -> getfacl: nnn: stat() failed: No such file or directory -> user:42:--x-----------:------:allow -> group:43:-w------------:------:allow -> owner@:rw-p--aARWcCos:------:allow -> group@:r-----a-R-c--s:------:allow -> everyone@:r-----a-R-c--s:------:allow -> -> user:42:--x-----------:------:allow -> group:43:-w------------:------:allow -> owner@:rw-p--aARWcCos:------:allow -> group@:r-----a-R-c--s:------:allow -> everyone@:r-----a-R-c--s:------:allow -> -> user:42:--x-----------:------:allow -> group:43:-w------------:------:allow -> owner@:rw-p--aARWcCos:------:allow -> group@:r-----a-R-c--s:------:allow -> everyone@:r-----a-R-c--s:------:allow - -$ setfacl -b nnn xxx yyy zzz -> setfacl: nnn: stat() failed: No such file or directory - -$ ls -l nnn xxx yyy zzz | cut -d' ' -f1 -> ls: nnn: No such file or directory -> -rw-r--r-- -> -rw-r--r-- -> -rw-r--r-- - -$ rm xxx yyy zzz - -# Test applying mode to an ACL. -$ touch xxx -$ setfacl -a0 user:42:r:allow,user:43:w:deny,user:43:w:allow,user:44:x:allow -x everyone@::allow xxx -$ chmod 600 xxx -$ getfacl -n xxx -> # file: xxx -> # owner: root -> # group: wheel -> owner@:rw-p--aARWcCos:------:allow -> group@:------a-R-c--s:------:allow -> everyone@:------a-R-c--s:------:allow - -$ ls -l xxx | cut -d' ' -f1 -> -rw------- - -$ rm xxx -$ touch xxx -$ chown 42 xxx -$ setfacl -a0 user:42:r:allow,user:43:w:deny,user:43:w:allow,user:44:x:allow xxx -$ chmod 600 xxx -$ getfacl -n xxx -> # file: xxx -> # owner: 42 -> # group: wheel -> owner@:rw-p--aARWcCos:------:allow -> group@:------a-R-c--s:------:allow -> everyone@:------a-R-c--s:------:allow -$ ls -l xxx | cut -d' ' -f1 -> -rw------- - -$ rm xxx -$ touch xxx -$ chown 43 xxx -$ setfacl -a0 user:42:r:allow,user:43:w:deny,user:43:w:allow,user:44:x:allow xxx -$ chmod 124 xxx -$ getfacl -n xxx -> # file: xxx -> # owner: 43 -> # group: wheel -> owner@:rw-p----------:------:deny -> group@:r-------------:------:deny -> owner@:--x---aARWcCos:------:allow -> group@:-w-p--a-R-c--s:------:allow -> everyone@:r-----a-R-c--s:------:allow -$ ls -l xxx | cut -d' ' -f1 -> ---x-w-r-- - -$ rm xxx -$ touch xxx -$ chown 43 xxx -$ setfacl -a0 user:42:r:allow,user:43:w:deny,user:43:w:allow,user:44:x:allow xxx -$ chmod 412 xxx -$ getfacl -n xxx -> # file: xxx -> # owner: 43 -> # group: wheel -> owner@:-wxp----------:------:deny -> group@:-w-p----------:------:deny -> owner@:r-----aARWcCos:------:allow -> group@:--x---a-R-c--s:------:allow -> everyone@:-w-p--a-R-c--s:------:allow -$ ls -l xxx | cut -d' ' -f1 -> -r----x-w- - -$ mkdir ddd -$ setfacl -a0 group:44:rwapd:allow ddd -$ setfacl -a0 group:43:write_data/delete_child:d:deny,group@:ad:allow ddd -$ setfacl -a0 user:42:rx:fi:allow,group:42:write_data/delete_child:d:allow ddd -$ setfacl -m everyone@:-w-p--a-R-c--s:fi:allow ddd -$ getfacl -n ddd -> # file: ddd -> # owner: root -> # group: wheel -> user:42:r-x-----------:f-i---:allow -> group:42:-w--D---------:-d----:allow -> group:43:-w--D---------:-d----:deny -> group@:-----da-------:------:allow -> group:44:rw-p-da-------:------:allow -> owner@:rwxp--aARWcCos:------:allow -> group@:r-x---a-R-c--s:------:allow -> everyone@:-w-p--a-R-c--s:f-i---:allow - -$ chmod 777 ddd -$ getfacl -n ddd -> # file: ddd -> # owner: root -> # group: wheel -> owner@:rwxp--aARWcCos:------:allow -> group@:rwxp--a-R-c--s:------:allow -> everyone@:rwxp--a-R-c--s:------:allow - -# Test applying ACL to mode. -$ rmdir ddd -$ mkdir ddd -$ setfacl -a0 u:42:rwx:fi:allow ddd -$ ls -ld ddd | cut -d' ' -f1 -> drwxr-xr-x+ - -$ rmdir ddd -$ mkdir ddd -$ chmod 0 ddd -$ setfacl -a0 owner@:r:allow,group@:w:deny,group@:wx:allow ddd -$ ls -ld ddd | cut -d' ' -f1 -> dr----x---+ - -$ rmdir ddd -$ mkdir ddd -$ chmod 0 ddd -$ setfacl -a0 owner@:r:allow,group@:w:fi:deny,group@:wx:allow ddd -$ ls -ld ddd | cut -d' ' -f1 -> dr---wx---+ - -$ rmdir ddd -$ mkdir ddd -$ chmod 0 ddd -$ setfacl -a0 owner@:r:allow,group:43:w:deny,group:43:wx:allow ddd -$ ls -ld ddd | cut -d' ' -f1 -> dr--------+ - -$ rmdir ddd -$ mkdir ddd -$ chmod 0 ddd -$ setfacl -a0 owner@:r:allow,user:43:w:deny,user:43:wx:allow ddd -$ ls -ld ddd | cut -d' ' -f1 -> dr--------+ - -# Test inheritance. -$ rmdir ddd -$ mkdir ddd -$ setfacl -a0 group:43:write_data/write_acl:fin:deny,u:43:rwxp:allow ddd -$ setfacl -a0 user:42:rx:fi:allow,group:42:write_data/delete_child:dn:deny ddd -$ setfacl -a0 user:42:write_acl/write_owner:fi:allow ddd -$ setfacl -a0 group:41:read_data/read_attributes:dni:allow ddd -$ setfacl -a0 user:41:write_data/write_attributes:fn:allow ddd -$ getfacl -qn ddd -> user:41:-w-----A------:f--n--:allow -> group:41:r-----a-------:-din--:allow -> user:42:-----------Co-:f-i---:allow -> user:42:r-x-----------:f-i---:allow -> group:42:-w--D---------:-d-n--:deny -> group:43:-w---------C--:f-in--:deny -> user:43:rwxp----------:------:allow -> owner@:rwxp--aARWcCos:------:allow -> group@:r-x---a-R-c--s:------:allow -> everyone@:r-x---a-R-c--s:------:allow - -$ cd ddd -$ touch xxx -$ getfacl -qn xxx -> user:41:--------------:------:allow -> user:42:--------------:------:allow -> user:42:r-------------:------:allow -> group:43:-w---------C--:------:deny -> owner@:rw-p--aARWcCos:------:allow -> group@:r-----a-R-c--s:------:allow -> everyone@:r-----a-R-c--s:------:allow - -$ rm xxx -$ umask 077 -$ touch xxx -$ getfacl -qn xxx -> user:41:--------------:------:allow -> user:42:--------------:------:allow -> user:42:--------------:------:allow -> group:43:-w---------C--:------:deny -> owner@:rw-p--aARWcCos:------:allow -> group@:------a-R-c--s:------:allow -> everyone@:------a-R-c--s:------:allow - -$ rm xxx -$ umask 770 -$ touch xxx -$ getfacl -qn xxx -> owner@:rw-p----------:------:deny -> group@:rw-p----------:------:deny -> user:41:--------------:------:allow -> user:42:--------------:------:allow -> user:42:--------------:------:allow -> group:43:-w---------C--:------:deny -> owner@:------aARWcCos:------:allow -> group@:------a-R-c--s:------:allow -> everyone@:rw-p--a-R-c--s:------:allow - -$ rm xxx -$ umask 707 -$ touch xxx -$ getfacl -qn xxx -> owner@:rw-p----------:------:deny -> user:41:-w------------:------:allow -> user:42:--------------:------:allow -> user:42:r-------------:------:allow -> group:43:-w---------C--:------:deny -> owner@:------aARWcCos:------:allow -> group@:rw-p--a-R-c--s:------:allow -> everyone@:------a-R-c--s:------:allow - -$ umask 077 -$ mkdir yyy -$ getfacl -qn yyy -> group:41:------a-------:------:allow -> user:42:-----------Co-:f-i---:allow -> user:42:r-x-----------:f-i---:allow -> group:42:-w--D---------:------:deny -> owner@:rwxp--aARWcCos:------:allow -> group@:------a-R-c--s:------:allow -> everyone@:------a-R-c--s:------:allow - -$ rmdir yyy -$ umask 770 -$ mkdir yyy -$ getfacl -qn yyy -> owner@:rwxp----------:------:deny -> group@:rwxp----------:------:deny -> group:41:------a-------:------:allow -> user:42:-----------Co-:f-i---:allow -> user:42:r-x-----------:f-i---:allow -> group:42:-w--D---------:------:deny -> owner@:------aARWcCos:------:allow -> group@:------a-R-c--s:------:allow -> everyone@:rwxp--a-R-c--s:------:allow - -$ rmdir yyy -$ umask 707 -$ mkdir yyy -$ getfacl -qn yyy -> owner@:rwxp----------:------:deny -> group:41:r-----a-------:------:allow -> user:42:-----------Co-:f-i---:allow -> user:42:r-x-----------:f-i---:allow -> group:42:-w--D---------:------:deny -> owner@:------aARWcCos:------:allow -> group@:rwxp--a-R-c--s:------:allow -> everyone@:------a-R-c--s:------:allow - -# There is some complication regarding how write_acl and write_owner flags -# get inherited. Make sure we got it right. -$ setfacl -b . -$ setfacl -a0 u:42:Co:f:allow . -$ setfacl -a0 u:43:Co:d:allow . -$ setfacl -a0 u:44:Co:fd:allow . -$ setfacl -a0 u:45:Co:fi:allow . -$ setfacl -a0 u:46:Co:di:allow . -$ setfacl -a0 u:47:Co:fdi:allow . -$ setfacl -a0 u:48:Co:fn:allow . -$ setfacl -a0 u:49:Co:dn:allow . -$ setfacl -a0 u:50:Co:fdn:allow . -$ setfacl -a0 u:51:Co:fni:allow . -$ setfacl -a0 u:52:Co:dni:allow . -$ setfacl -a0 u:53:Co:fdni:allow . -$ umask 022 -$ rm xxx -$ touch xxx -$ getfacl -nq xxx -> user:53:--------------:------:allow -> user:51:--------------:------:allow -> user:50:--------------:------:allow -> user:48:--------------:------:allow -> user:47:--------------:------:allow -> user:45:--------------:------:allow -> user:44:--------------:------:allow -> user:42:--------------:------:allow -> owner@:rw-p--aARWcCos:------:allow -> group@:r-----a-R-c--s:------:allow -> everyone@:r-----a-R-c--s:------:allow - -$ rmdir yyy -$ mkdir yyy -$ getfacl -nq yyy -> user:53:--------------:------:allow -> user:52:--------------:------:allow -> user:50:--------------:------:allow -> user:49:--------------:------:allow -> user:47:--------------:fd----:allow -> user:46:--------------:-d----:allow -> user:45:-----------Co-:f-i---:allow -> user:44:--------------:fd----:allow -> user:43:--------------:-d----:allow -> user:42:-----------Co-:f-i---:allow -> owner@:rwxp--aARWcCos:------:allow -> group@:r-x---a-R-c--s:------:allow -> everyone@:r-x---a-R-c--s:------:allow - -$ setfacl -b . -$ setfacl -a0 u:42:Co:f:deny . -$ setfacl -a0 u:43:Co:d:deny . -$ setfacl -a0 u:44:Co:fd:deny . -$ setfacl -a0 u:45:Co:fi:deny . -$ setfacl -a0 u:46:Co:di:deny . -$ setfacl -a0 u:47:Co:fdi:deny . -$ setfacl -a0 u:48:Co:fn:deny . -$ setfacl -a0 u:49:Co:dn:deny . -$ setfacl -a0 u:50:Co:fdn:deny . -$ setfacl -a0 u:51:Co:fni:deny . -$ setfacl -a0 u:52:Co:dni:deny . -$ setfacl -a0 u:53:Co:fdni:deny . -$ umask 022 -$ rm xxx -$ touch xxx -$ getfacl -nq xxx -> user:53:-----------Co-:------:deny -> user:51:-----------Co-:------:deny -> user:50:-----------Co-:------:deny -> user:48:-----------Co-:------:deny -> user:47:-----------Co-:------:deny -> user:45:-----------Co-:------:deny -> user:44:-----------Co-:------:deny -> user:42:-----------Co-:------:deny -> owner@:rw-p--aARWcCos:------:allow -> group@:r-----a-R-c--s:------:allow -> everyone@:r-----a-R-c--s:------:allow - -$ rmdir yyy -$ mkdir yyy -$ getfacl -nq yyy -> user:53:-----------Co-:------:deny -> user:52:-----------Co-:------:deny -> user:50:-----------Co-:------:deny -> user:49:-----------Co-:------:deny -> user:47:-----------Co-:fd----:deny -> user:46:-----------Co-:-d----:deny -> user:45:-----------Co-:f-i---:deny -> user:44:-----------Co-:fd----:deny -> user:43:-----------Co-:-d----:deny -> user:42:-----------Co-:f-i---:deny -> owner@:rwxp--aARWcCos:------:allow -> group@:r-x---a-R-c--s:------:allow -> everyone@:r-x---a-R-c--s:------:allow - -$ rmdir yyy -$ rm xxx -$ cd .. -$ rmdir ddd - -$ rm xxx - diff --git a/tools/regression/acltools/tools-nfs4-trivial.test b/tools/regression/acltools/tools-nfs4-trivial.test deleted file mode 100644 index ae49032..0000000 --- a/tools/regression/acltools/tools-nfs4-trivial.test +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright (c) 2011 Edward Tomasz Napierała <trasz@FreeBSD.org> -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $FreeBSD$ -# - -# This is a tools-level test for acl_is_trivial_np(3). Run it as root on ZFS. -# Note that this does not work on UFS with NFSv4 ACLs enabled - UFS recognizes -# both kind of trivial ACLs and replaces it by the default one. -# -# WARNING: Creates files in unsafe way. - -$ whoami -> root -$ umask 022 - -# Check whether ls(1) correctly recognizes PSARC/2010/029-style trivial ACLs. -$ touch xxx - -$ ls -l xxx | cut -d' ' -f1 -> -rw-r--r-- - -$ getfacl -q xxx -> owner@:rw-p--aARWcCos:------:allow -> group@:r-----a-R-c--s:------:allow -> everyone@:r-----a-R-c--s:------:allow - -# Check whether ls(1) correctly recognizes draft-style trivial ACLs. -$ rm xxx -$ touch xxx -$ setfacl -a0 owner@:x:deny,owner@:rwpAWCo:allow,group@:wxp:deny,group@:r:allow,everyone@:wxpAWCo:deny,everyone@:raRcs:allow xxx -$ setfacl -x5 xxx -$ setfacl -x5 xxx -$ setfacl -x5 xxx - -$ ls -l xxx | cut -d' ' -f1 -> -rw-r--r-- - -$ getfacl -q xxx -> owner@:--x-----------:------:deny -> owner@:rw-p---A-W-Co-:------:allow -> group@:-wxp----------:------:deny -> group@:r-------------:------:allow -> everyone@:-wxp---A-W-Co-:------:deny -> everyone@:r-----a-R-c--s:------:allow - -# Make sure ls(1) actually can recognize something as non-trivial. -$ setfacl -x0 xxx - -$ ls -l xxx | cut -d' ' -f1 -> -rw-r--r--+ - -$ getfacl -q xxx -> owner@:rw-p---A-W-Co-:------:allow -> group@:-wxp----------:------:deny -> group@:r-------------:------:allow -> everyone@:-wxp---A-W-Co-:------:deny -> everyone@:r-----a-R-c--s:------:allow - -$ rm xxx - diff --git a/tools/regression/acltools/tools-nfs4.test b/tools/regression/acltools/tools-nfs4.test deleted file mode 100644 index 72826fb..0000000 --- a/tools/regression/acltools/tools-nfs4.test +++ /dev/null @@ -1,828 +0,0 @@ -# Copyright (c) 2008, 2009 Edward Tomasz Napierała <trasz@FreeBSD.org> -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $FreeBSD$ -# - -# This is a tools-level test for NFSv4 ACL functionality. Run it as root -# using ACL-enabled kernel: -# -# /usr/src/tools/regression/acltools/run /usr/src/tools/regression/acltools/tools-nfs4.test -# -# WARNING: Creates files in unsafe way. - -$ whoami -> root -$ umask 022 - -# Smoke test for getfacl(1). -$ touch xxx -$ getfacl xxx -> # file: xxx -> # owner: root -> # group: wheel -> owner@:--x-----------:------:deny -> owner@:rw-p---A-W-Co-:------:allow -> group@:-wxp----------:------:deny -> group@:r-------------:------:allow -> everyone@:-wxp---A-W-Co-:------:deny -> everyone@:r-----a-R-c--s:------:allow - -$ getfacl -q xxx -> owner@:--x-----------:------:deny -> owner@:rw-p---A-W-Co-:------:allow -> group@:-wxp----------:------:deny -> group@:r-------------:------:allow -> everyone@:-wxp---A-W-Co-:------:deny -> everyone@:r-----a-R-c--s:------:allow - -# Check verbose mode formatting. -$ getfacl -v xxx -> # file: xxx -> # owner: root -> # group: wheel -> owner@:execute::deny -> owner@:read_data/write_data/append_data/write_attributes/write_xattr/write_acl/write_owner::allow -> group@:write_data/execute/append_data::deny -> group@:read_data::allow -> everyone@:write_data/execute/append_data/write_attributes/write_xattr/write_acl/write_owner::deny -> everyone@:read_data/read_attributes/read_xattr/read_acl/synchronize::allow - -# Test setfacl -a. -$ setfacl -a2 u:0:write_acl:allow,g:1:read_acl:deny xxx -$ getfacl -n xxx -> # file: xxx -> # owner: root -> # group: wheel -> owner@:--x-----------:------:deny -> owner@:rw-p---A-W-Co-:------:allow -> user:0:-----------C--:------:allow -> group:1:----------c---:------:deny -> group@:-wxp----------:------:deny -> group@:r-------------:------:allow -> everyone@:-wxp---A-W-Co-:------:deny -> everyone@:r-----a-R-c--s:------:allow - -# Test user and group name resolving. -$ rm xxx -$ touch xxx -$ setfacl -a2 u:root:write_acl:allow,g:daemon:read_acl:deny xxx -$ getfacl xxx -> # file: xxx -> # owner: root -> # group: wheel -> owner@:--x-----------:------:deny -> owner@:rw-p---A-W-Co-:------:allow -> user:root:-----------C--:------:allow -> group:daemon:----------c---:------:deny -> group@:-wxp----------:------:deny -> group@:r-------------:------:allow -> everyone@:-wxp---A-W-Co-:------:deny -> everyone@:r-----a-R-c--s:------:allow - -# Check whether ls correctly marks files with "+". -$ ls -l xxx | cut -d' ' -f1 -> -rw-r--r--+ - -# Test removing entries by number. -$ setfacl -x 4 xxx -$ setfacl -x 4 xxx -$ getfacl -n xxx -> # file: xxx -> # owner: root -> # group: wheel -> owner@:--x-----------:------:deny -> owner@:rw-p---A-W-Co-:------:allow -> user:0:-----------C--:------:allow -> group:1:----------c---:------:deny -> everyone@:-wxp---A-W-Co-:------:deny -> everyone@:r-----a-R-c--s:------:allow - -# Test setfacl -m. -$ setfacl -a0 everyone@:rwx:deny xxx -$ setfacl -a0 everyone@:rwx:deny xxx -$ setfacl -a0 everyone@:rwx:deny xxx -$ setfacl -m everyone@::deny xxx -$ getfacl -n xxx -> # file: xxx -> # owner: root -> # group: wheel -> everyone@:--------------:------:deny -> everyone@:--------------:------:deny -> everyone@:--------------:------:deny -> owner@:--x-----------:------:deny -> owner@:rw-p---A-W-Co-:------:allow -> user:0:-----------C--:------:allow -> group:1:----------c---:------:deny -> everyone@:--------------:------:deny -> everyone@:r-----a-R-c--s:------:allow - -# Test getfacl -i. -$ getfacl -i xxx -> # file: xxx -> # owner: root -> # group: wheel -> everyone@:--------------:------:deny -> everyone@:--------------:------:deny -> everyone@:--------------:------:deny -> owner@:--x-----------:------:deny -> owner@:rw-p---A-W-Co-:------:allow -> user:root:-----------C--:------:allow:0 -> group:daemon:----------c---:------:deny:1 -> everyone@:--------------:------:deny -> everyone@:r-----a-R-c--s:------:allow - -# Make sure cp without any flags does not copy copy the ACL. -$ cp xxx yyy -$ ls -l yyy | cut -d' ' -f1 -> -rw-r--r-- - -# Make sure it does with the "-p" flag. -$ rm yyy -$ cp -p xxx yyy -$ getfacl -n yyy -> # file: yyy -> # owner: root -> # group: wheel -> everyone@:--------------:------:deny -> everyone@:--------------:------:deny -> everyone@:--------------:------:deny -> owner@:--x-----------:------:deny -> owner@:rw-p---A-W-Co-:------:allow -> user:0:-----------C--:------:allow -> group:1:----------c---:------:deny -> everyone@:--------------:------:deny -> everyone@:r-----a-R-c--s:------:allow - -$ rm yyy - -# Test removing entries by... by example? -$ setfacl -x everyone@::deny xxx -$ getfacl -n xxx -> # file: xxx -> # owner: root -> # group: wheel -> owner@:--x-----------:------:deny -> owner@:rw-p---A-W-Co-:------:allow -> user:0:-----------C--:------:allow -> group:1:----------c---:------:deny -> everyone@:r-----a-R-c--s:------:allow - -# Test setfacl -b. -$ setfacl -b xxx -$ getfacl -n xxx -> # file: xxx -> # owner: root -> # group: wheel -> owner@:--x-----------:------:deny -> owner@:rw-p---A-W-Co-:------:allow -> group@:-wxp----------:------:deny -> group@:r-------------:------:allow -> everyone@:-wxp---A-W-Co-:------:deny -> everyone@:r-----a-R-c--s:------:allow - -$ ls -l xxx | cut -d' ' -f1 -> -rw-r--r-- - -# Check setfacl(1) and getfacl(1) with multiple files. -$ touch xxx yyy zzz - -$ ls -l xxx yyy zzz | cut -d' ' -f1 -> -rw-r--r-- -> -rw-r--r-- -> -rw-r--r-- - -$ setfacl -m u:42:x:allow,g:43:w:allow nnn xxx yyy zzz -> setfacl: nnn: stat() failed: No such file or directory - -$ ls -l nnn xxx yyy zzz | cut -d' ' -f1 -> ls: nnn: No such file or directory -> -rw-r--r--+ -> -rw-r--r--+ -> -rw-r--r--+ - -$ getfacl -nq nnn xxx yyy zzz -> getfacl: nnn: stat() failed: No such file or directory -> user:42:--x-----------:------:allow -> group:43:-w------------:------:allow -> owner@:--x-----------:------:deny -> owner@:rw-p---A-W-Co-:------:allow -> group@:-wxp----------:------:deny -> group@:r-------------:------:allow -> everyone@:-wxp---A-W-Co-:------:deny -> everyone@:r-----a-R-c--s:------:allow -> -> user:42:--x-----------:------:allow -> group:43:-w------------:------:allow -> owner@:--x-----------:------:deny -> owner@:rw-p---A-W-Co-:------:allow -> group@:-wxp----------:------:deny -> group@:r-------------:------:allow -> everyone@:-wxp---A-W-Co-:------:deny -> everyone@:r-----a-R-c--s:------:allow -> -> user:42:--x-----------:------:allow -> group:43:-w------------:------:allow -> owner@:--x-----------:------:deny -> owner@:rw-p---A-W-Co-:------:allow -> group@:-wxp----------:------:deny -> group@:r-------------:------:allow -> everyone@:-wxp---A-W-Co-:------:deny -> everyone@:r-----a-R-c--s:------:allow - -$ setfacl -b nnn xxx yyy zzz -> setfacl: nnn: stat() failed: No such file or directory - -$ ls -l nnn xxx yyy zzz | cut -d' ' -f1 -> ls: nnn: No such file or directory -> -rw-r--r-- -> -rw-r--r-- -> -rw-r--r-- - -$ rm xxx yyy zzz - -# Test applying mode to an ACL. -$ touch xxx -$ setfacl -a0 user:42:r:allow,user:43:w:deny,user:43:w:allow,user:44:x:allow -x everyone@::allow xxx -$ chmod 600 xxx -$ getfacl -n xxx -> # file: xxx -> # owner: root -> # group: wheel -> user:42:r-------------:------:deny -> user:42:r-------------:------:allow -> user:43:-w------------:------:deny -> user:43:-w------------:------:allow -> user:44:--x-----------:------:deny -> user:44:--x-----------:------:allow -> owner@:--------------:------:deny -> owner@:-------A-W-Co-:------:allow -> group@:--------------:------:deny -> group@:--------------:------:allow -> everyone@:-------A-W-Co-:------:deny -> owner@:--x-----------:------:deny -> owner@:rw-p---A-W-Co-:------:allow -> group@:rwxp----------:------:deny -> group@:--------------:------:allow -> everyone@:rwxp---A-W-Co-:------:deny -> everyone@:------a-R-c--s:------:allow -$ ls -l xxx | cut -d' ' -f1 -> -rw-------+ - -$ rm xxx -$ touch xxx -$ chown 42 xxx -$ setfacl -a0 user:42:r:allow,user:43:w:deny,user:43:w:allow,user:44:x:allow xxx -$ chmod 600 xxx -$ getfacl -n xxx -> # file: xxx -> # owner: 42 -> # group: wheel -> user:42:--------------:------:deny -> user:42:r-------------:------:allow -> user:43:-w------------:------:deny -> user:43:-w------------:------:allow -> user:44:--x-----------:------:deny -> user:44:--x-----------:------:allow -> owner@:--x-----------:------:deny -> owner@:rw-p---A-W-Co-:------:allow -> group@:rwxp----------:------:deny -> group@:--------------:------:allow -> everyone@:rwxp---A-W-Co-:------:deny -> everyone@:------a-R-c--s:------:allow -$ ls -l xxx | cut -d' ' -f1 -> -rw-------+ - -$ rm xxx -$ touch xxx -$ chown 43 xxx -$ setfacl -a0 user:42:r:allow,user:43:w:deny,user:43:w:allow,user:44:x:allow xxx -$ chmod 124 xxx -$ getfacl -n xxx -> # file: xxx -> # owner: 43 -> # group: wheel -> user:42:r-------------:------:deny -> user:42:r-------------:------:allow -> user:43:-w------------:------:deny -> user:43:-w------------:------:allow -> user:44:--x-----------:------:deny -> user:44:--x-----------:------:allow -> owner@:rw-p----------:------:deny -> owner@:--x----A-W-Co-:------:allow -> group@:r-x-----------:------:deny -> group@:-w-p----------:------:allow -> everyone@:-wxp---A-W-Co-:------:deny -> everyone@:r-----a-R-c--s:------:allow -$ ls -l xxx | cut -d' ' -f1 -> ---x-w-r--+ - -$ rm xxx -$ touch xxx -$ chown 43 xxx -$ setfacl -a0 user:42:r:allow,user:43:w:deny,user:43:w:allow,user:44:x:allow xxx -$ chmod 412 xxx -$ getfacl -n xxx -> # file: xxx -> # owner: 43 -> # group: wheel -> user:42:r-------------:------:deny -> user:42:r-------------:------:allow -> user:43:-w------------:------:deny -> user:43:-w------------:------:allow -> user:44:--------------:------:deny -> user:44:--x-----------:------:allow -> owner@:-wxp----------:------:deny -> owner@:r------A-W-Co-:------:allow -> group@:rw-p----------:------:deny -> group@:--x-----------:------:allow -> everyone@:r-x----A-W-Co-:------:deny -> everyone@:-w-p--a-R-c--s:------:allow -$ ls -l xxx | cut -d' ' -f1 -> -r----x-w-+ - -$ mkdir ddd -$ setfacl -a0 group:44:rwapd:allow ddd -$ setfacl -a0 group:43:write_data/delete_child:d:deny,group@:ad:allow ddd -$ setfacl -a0 user:42:rx:fi:allow,group:42:write_data/delete_child:d:allow ddd -$ setfacl -m everyone@:-w-p--a-R-c--s:fi:allow ddd -$ getfacl -n ddd -> # file: ddd -> # owner: root -> # group: wheel -> user:42:r-x-----------:f-i---:allow -> group:42:-w--D---------:-d----:allow -> group:43:-w--D---------:-d----:deny -> group@:-----da-------:------:allow -> group:44:rw-p-da-------:------:allow -> owner@:--------------:------:deny -> owner@:rwxp---A-W-Co-:------:allow -> group@:-w-p----------:------:deny -> group@:r-x-----------:------:allow -> everyone@:-w-p---A-W-Co-:------:deny -> everyone@:-w-p--a-R-c--s:f-i---:allow -$ chmod 777 ddd -$ getfacl -n ddd -> # file: ddd -> # owner: root -> # group: wheel -> user:42:r-x-----------:f-i---:allow -> group:42:-w--D---------:-di---:allow -> group:42:--------------:------:deny -> group:42:-w--D---------:------:allow -> group:43:-w--D---------:-di---:deny -> group:43:-w--D---------:------:deny -> group@:-----da-------:------:allow -> group:44:--------------:------:deny -> group:44:rw-p-da-------:------:allow -> owner@:--------------:------:deny -> owner@:-------A-W-Co-:------:allow -> group@:--------------:------:deny -> group@:--------------:------:allow -> everyone@:-------A-W-Co-:------:deny -> everyone@:-w-p--a-R-c--s:f-i---:allow -> owner@:--------------:------:deny -> owner@:rwxp---A-W-Co-:------:allow -> group@:--------------:------:deny -> group@:rwxp----------:------:allow -> everyone@:-------A-W-Co-:------:deny -> everyone@:rwxp--a-R-c--s:------:allow - -$ rmdir ddd -$ mkdir ddd -$ setfacl -a0 group:44:rwapd:allow ddd -$ setfacl -a0 group:43:write_data/delete_child:d:deny,group@:ad:allow ddd -$ setfacl -a0 user:42:rx:fi:allow,group:42:write_data/delete_child:d:allow ddd -$ setfacl -m everyone@:-w-p--a-R-c--s:fi:allow ddd -$ chmod 124 ddd -$ getfacl -n ddd -> # file: ddd -> # owner: root -> # group: wheel -> user:42:r-x-----------:f-i---:allow -> group:42:-w--D---------:-di---:allow -> group:42:--------------:------:deny -> group:42:----D---------:------:allow -> group:43:-w--D---------:-di---:deny -> group:43:-w--D---------:------:deny -> group@:-----da-------:------:allow -> group:44:r-------------:------:deny -> group:44:r----da-------:------:allow -> owner@:--------------:------:deny -> owner@:-------A-W-Co-:------:allow -> group@:--------------:------:deny -> group@:--------------:------:allow -> everyone@:-------A-W-Co-:------:deny -> everyone@:-w-p--a-R-c--s:f-i---:allow -> owner@:rw-p----------:------:deny -> owner@:--x----A-W-Co-:------:allow -> group@:r-x-----------:------:deny -> group@:-w-p----------:------:allow -> everyone@:-wxp---A-W-Co-:------:deny -> everyone@:r-----a-R-c--s:------:allow - -$ rmdir ddd -$ mkdir ddd -$ setfacl -a0 group:44:rwapd:allow ddd -$ setfacl -a0 group:43:write_data/delete_child:d:deny,group@:ad:allow ddd -$ setfacl -a0 user:42:rx:allow,user:42:rx:fi:allow,group:42:write_data/delete_child:d:allow ddd -$ setfacl -m everyone@:-w-p--a-R-c--s:fi:allow ddd -$ chmod 412 ddd -$ getfacl -n ddd -> # file: ddd -> # owner: root -> # group: wheel -> user:42:r-------------:------:deny -> user:42:r-x-----------:------:allow -> user:42:r-x-----------:f-i---:allow -> group:42:-w--D---------:-di---:allow -> group:42:-w------------:------:deny -> group:42:-w--D---------:------:allow -> group:43:-w--D---------:-di---:deny -> group:43:-w--D---------:------:deny -> group@:-----da-------:------:allow -> group:44:rw-p----------:------:deny -> group:44:rw-p-da-------:------:allow -> owner@:--------------:------:deny -> owner@:-------A-W-Co-:------:allow -> group@:--------------:------:deny -> group@:--------------:------:allow -> everyone@:-------A-W-Co-:------:deny -> everyone@:-w-p--a-R-c--s:f-i---:allow -> owner@:-wxp----------:------:deny -> owner@:r------A-W-Co-:------:allow -> group@:rw-p----------:------:deny -> group@:--x-----------:------:allow -> everyone@:r-x----A-W-Co-:------:deny -> everyone@:-w-p--a-R-c--s:------:allow - -$ rmdir ddd -$ mkdir ddd -$ setfacl -a0 group:44:rwapd:allow ddd -$ setfacl -a0 group:43:write_data/delete_child:d:deny,group@:ad:allow ddd -$ setfacl -a0 user:42:rx:allow,user:42:rx:fi:allow,group:42:write_data/delete_child:d:allow ddd -$ setfacl -m everyone@:-w-p--a-R-c--s:fi:allow ddd -$ chown 42 ddd -$ chmod 412 ddd -$ getfacl -n ddd -> # file: ddd -> # owner: 42 -> # group: wheel -> user:42:--x-----------:------:deny -> user:42:r-x-----------:------:allow -> user:42:r-x-----------:f-i---:allow -> group:42:-w--D---------:-di---:allow -> group:42:-w------------:------:deny -> group:42:-w--D---------:------:allow -> group:43:-w--D---------:-di---:deny -> group:43:-w--D---------:------:deny -> group@:-----da-------:------:allow -> group:44:rw-p----------:------:deny -> group:44:rw-p-da-------:------:allow -> owner@:--------------:------:deny -> owner@:-------A-W-Co-:------:allow -> group@:--------------:------:deny -> group@:--------------:------:allow -> everyone@:-------A-W-Co-:------:deny -> everyone@:-w-p--a-R-c--s:f-i---:allow -> owner@:-wxp----------:------:deny -> owner@:r------A-W-Co-:------:allow -> group@:rw-p----------:------:deny -> group@:--x-----------:------:allow -> everyone@:r-x----A-W-Co-:------:deny -> everyone@:-w-p--a-R-c--s:------:allow - -# Test applying ACL to mode. -$ rmdir ddd -$ mkdir ddd -$ setfacl -a0 u:42:rwx:fi:allow ddd -$ ls -ld ddd | cut -d' ' -f1 -> drwxr-xr-x+ - -$ rmdir ddd -$ mkdir ddd -$ chmod 0 ddd -$ setfacl -a0 owner@:r:allow,group@:w:deny,group@:wx:allow ddd -$ ls -ld ddd | cut -d' ' -f1 -> dr----x---+ - -$ rmdir ddd -$ mkdir ddd -$ chmod 0 ddd -$ setfacl -a0 owner@:r:allow,group@:w:fi:deny,group@:wx:allow ddd -$ ls -ld ddd | cut -d' ' -f1 -> dr---wx---+ - -$ rmdir ddd -$ mkdir ddd -$ chmod 0 ddd -$ setfacl -a0 owner@:r:allow,group:43:w:deny,group:43:wx:allow ddd -$ ls -ld ddd | cut -d' ' -f1 -> dr--------+ - -$ rmdir ddd -$ mkdir ddd -$ chmod 0 ddd -$ setfacl -a0 owner@:r:allow,user:43:w:deny,user:43:wx:allow ddd -$ ls -ld ddd | cut -d' ' -f1 -> dr--------+ - -# Test inheritance. -$ rmdir ddd -$ mkdir ddd -$ setfacl -a0 group:43:write_data/write_acl:fin:deny,u:43:rwxp:allow ddd -$ setfacl -a0 user:42:rx:fi:allow,group:42:write_data/delete_child:dn:deny ddd -$ setfacl -a0 user:42:write_acl/write_owner:fi:allow ddd -$ setfacl -a0 group:41:read_data/read_attributes:dni:allow ddd -$ setfacl -a0 user:41:write_data/write_attributes:fn:allow ddd -$ getfacl -qn ddd -> user:41:-w-----A------:f--n--:allow -> group:41:r-----a-------:-din--:allow -> user:42:-----------Co-:f-i---:allow -> user:42:r-x-----------:f-i---:allow -> group:42:-w--D---------:-d-n--:deny -> group:43:-w---------C--:f-in--:deny -> user:43:rwxp----------:------:allow -> owner@:--------------:------:deny -> owner@:rwxp---A-W-Co-:------:allow -> group@:-w-p----------:------:deny -> group@:r-x-----------:------:allow -> everyone@:-w-p---A-W-Co-:------:deny -> everyone@:r-x---a-R-c--s:------:allow - -$ cd ddd -$ touch xxx -$ getfacl -qn xxx -> user:41:-w------------:------:deny -> user:41:-w-----A------:------:allow -> user:42:--------------:------:deny -> user:42:--------------:------:allow -> user:42:--x-----------:------:deny -> user:42:r-x-----------:------:allow -> group:43:-w---------C--:------:deny -> owner@:--x-----------:------:deny -> owner@:rw-p---A-W-Co-:------:allow -> group@:-wxp----------:------:deny -> group@:r-------------:------:allow -> everyone@:-wxp---A-W-Co-:------:deny -> everyone@:r-----a-R-c--s:------:allow - -$ rm xxx -$ umask 077 -$ touch xxx -$ getfacl -qn xxx -> user:41:-w------------:------:deny -> user:41:-w-----A------:------:allow -> user:42:--------------:------:deny -> user:42:--------------:------:allow -> user:42:r-x-----------:------:deny -> user:42:r-x-----------:------:allow -> group:43:-w---------C--:------:deny -> owner@:--x-----------:------:deny -> owner@:rw-p---A-W-Co-:------:allow -> group@:rwxp----------:------:deny -> group@:--------------:------:allow -> everyone@:rwxp---A-W-Co-:------:deny -> everyone@:------a-R-c--s:------:allow - -$ rm xxx -$ umask 770 -$ touch xxx -$ getfacl -qn xxx -> user:41:-w------------:------:deny -> user:41:-w-----A------:------:allow -> user:42:--------------:------:deny -> user:42:--------------:------:allow -> user:42:r-x-----------:------:deny -> user:42:r-x-----------:------:allow -> group:43:-w---------C--:------:deny -> owner@:rwxp----------:------:deny -> owner@:-------A-W-Co-:------:allow -> group@:rwxp----------:------:deny -> group@:--------------:------:allow -> everyone@:--x----A-W-Co-:------:deny -> everyone@:rw-p--a-R-c--s:------:allow - -$ rm xxx -$ umask 707 -$ touch xxx -$ getfacl -qn xxx -> user:41:--------------:------:deny -> user:41:-w-----A------:------:allow -> user:42:--------------:------:deny -> user:42:--------------:------:allow -> user:42:--x-----------:------:deny -> user:42:r-x-----------:------:allow -> group:43:-w---------C--:------:deny -> owner@:rwxp----------:------:deny -> owner@:-------A-W-Co-:------:allow -> group@:--x-----------:------:deny -> group@:rw-p----------:------:allow -> everyone@:rwxp---A-W-Co-:------:deny -> everyone@:------a-R-c--s:------:allow - -$ umask 077 -$ mkdir yyy -$ getfacl -qn yyy -> group:41:r-------------:------:deny -> group:41:r-----a-------:------:allow -> user:42:-----------Co-:f-i---:allow -> user:42:r-x-----------:f-i---:allow -> group:42:-w--D---------:------:deny -> owner@:--------------:------:deny -> owner@:rwxp---A-W-Co-:------:allow -> group@:rwxp----------:------:deny -> group@:--------------:------:allow -> everyone@:rwxp---A-W-Co-:------:deny -> everyone@:------a-R-c--s:------:allow - -$ rmdir yyy -$ umask 770 -$ mkdir yyy -$ getfacl -qn yyy -> group:41:r-------------:------:deny -> group:41:r-----a-------:------:allow -> user:42:-----------Co-:f-i---:allow -> user:42:r-x-----------:f-i---:allow -> group:42:-w--D---------:------:deny -> owner@:rwxp----------:------:deny -> owner@:-------A-W-Co-:------:allow -> group@:rwxp----------:------:deny -> group@:--------------:------:allow -> everyone@:-------A-W-Co-:------:deny -> everyone@:rwxp--a-R-c--s:------:allow - -$ rmdir yyy -$ umask 707 -$ mkdir yyy -$ getfacl -qn yyy -> group:41:--------------:------:deny -> group:41:------a-------:------:allow -> user:42:-----------Co-:f-i---:allow -> user:42:r-x-----------:f-i---:allow -> group:42:-w--D---------:------:deny -> owner@:rwxp----------:------:deny -> owner@:-------A-W-Co-:------:allow -> group@:--------------:------:deny -> group@:rwxp----------:------:allow -> everyone@:rwxp---A-W-Co-:------:deny -> everyone@:------a-R-c--s:------:allow - -# There is some complication regarding how write_acl and write_owner flags -# get inherited. Make sure we got it right. -$ setfacl -b . -$ setfacl -a0 u:42:Co:f:allow . -$ setfacl -a0 u:43:Co:d:allow . -$ setfacl -a0 u:44:Co:fd:allow . -$ setfacl -a0 u:45:Co:fi:allow . -$ setfacl -a0 u:46:Co:di:allow . -$ setfacl -a0 u:47:Co:fdi:allow . -$ setfacl -a0 u:48:Co:fn:allow . -$ setfacl -a0 u:49:Co:dn:allow . -$ setfacl -a0 u:50:Co:fdn:allow . -$ setfacl -a0 u:51:Co:fni:allow . -$ setfacl -a0 u:52:Co:dni:allow . -$ setfacl -a0 u:53:Co:fdni:allow . -$ umask 022 -$ rm xxx -$ touch xxx -$ getfacl -nq xxx -> user:53:--------------:------:deny -> user:53:--------------:------:allow -> user:51:--------------:------:deny -> user:51:--------------:------:allow -> user:50:--------------:------:deny -> user:50:--------------:------:allow -> user:48:--------------:------:deny -> user:48:--------------:------:allow -> user:47:--------------:------:deny -> user:47:--------------:------:allow -> user:45:--------------:------:deny -> user:45:--------------:------:allow -> user:44:--------------:------:deny -> user:44:--------------:------:allow -> user:42:--------------:------:deny -> user:42:--------------:------:allow -> owner@:--x-----------:------:deny -> owner@:rw-p---A-W-Co-:------:allow -> group@:-wxp----------:------:deny -> group@:r-------------:------:allow -> everyone@:-wxp---A-W-Co-:------:deny -> everyone@:r-----a-R-c--s:------:allow - -$ rmdir yyy -$ mkdir yyy -$ getfacl -nq yyy -> user:53:--------------:------:deny -> user:53:--------------:------:allow -> user:52:--------------:------:deny -> user:52:--------------:------:allow -> user:50:--------------:------:deny -> user:50:--------------:------:allow -> user:49:--------------:------:deny -> user:49:--------------:------:allow -> user:47:-----------Co-:fdi---:allow -> user:47:--------------:------:deny -> user:47:--------------:------:allow -> user:46:-----------Co-:-di---:allow -> user:46:--------------:------:deny -> user:46:--------------:------:allow -> user:45:-----------Co-:f-i---:allow -> user:44:-----------Co-:fdi---:allow -> user:44:--------------:------:deny -> user:44:--------------:------:allow -> user:43:-----------Co-:-di---:allow -> user:43:--------------:------:deny -> user:43:--------------:------:allow -> user:42:-----------Co-:f-i---:allow -> owner@:--------------:------:deny -> owner@:rwxp---A-W-Co-:------:allow -> group@:-w-p----------:------:deny -> group@:r-x-----------:------:allow -> everyone@:-w-p---A-W-Co-:------:deny -> everyone@:r-x---a-R-c--s:------:allow - -$ setfacl -b . -$ setfacl -a0 u:42:Co:f:deny . -$ setfacl -a0 u:43:Co:d:deny . -$ setfacl -a0 u:44:Co:fd:deny . -$ setfacl -a0 u:45:Co:fi:deny . -$ setfacl -a0 u:46:Co:di:deny . -$ setfacl -a0 u:47:Co:fdi:deny . -$ setfacl -a0 u:48:Co:fn:deny . -$ setfacl -a0 u:49:Co:dn:deny . -$ setfacl -a0 u:50:Co:fdn:deny . -$ setfacl -a0 u:51:Co:fni:deny . -$ setfacl -a0 u:52:Co:dni:deny . -$ setfacl -a0 u:53:Co:fdni:deny . -$ umask 022 -$ rm xxx -$ touch xxx -$ getfacl -nq xxx -> user:53:-----------Co-:------:deny -> user:51:-----------Co-:------:deny -> user:50:-----------Co-:------:deny -> user:48:-----------Co-:------:deny -> user:47:-----------Co-:------:deny -> user:45:-----------Co-:------:deny -> user:44:-----------Co-:------:deny -> user:42:-----------Co-:------:deny -> owner@:--x-----------:------:deny -> owner@:rw-p---A-W-Co-:------:allow -> group@:-wxp----------:------:deny -> group@:r-------------:------:allow -> everyone@:-wxp---A-W-Co-:------:deny -> everyone@:r-----a-R-c--s:------:allow - -$ rmdir yyy -$ mkdir yyy -$ getfacl -nq yyy -> user:53:-----------Co-:------:deny -> user:52:-----------Co-:------:deny -> user:50:-----------Co-:------:deny -> user:49:-----------Co-:------:deny -> user:47:-----------Co-:fdi---:deny -> user:47:-----------Co-:------:deny -> user:46:-----------Co-:-di---:deny -> user:46:-----------Co-:------:deny -> user:45:-----------Co-:f-i---:deny -> user:44:-----------Co-:fdi---:deny -> user:44:-----------Co-:------:deny -> user:43:-----------Co-:-di---:deny -> user:43:-----------Co-:------:deny -> user:42:-----------Co-:f-i---:deny -> owner@:--------------:------:deny -> owner@:rwxp---A-W-Co-:------:allow -> group@:-w-p----------:------:deny -> group@:r-x-----------:------:allow -> everyone@:-w-p---A-W-Co-:------:deny -> everyone@:r-x---a-R-c--s:------:allow - -$ rmdir yyy -$ rm xxx -$ cd .. -$ rmdir ddd - -$ rm xxx - diff --git a/tools/regression/acltools/tools-posix.test b/tools/regression/acltools/tools-posix.test deleted file mode 100644 index 4741db3..0000000 --- a/tools/regression/acltools/tools-posix.test +++ /dev/null @@ -1,453 +0,0 @@ -# Copyright (c) 2008, 2009 Edward Tomasz Napierała <trasz@FreeBSD.org> -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $FreeBSD$ -# - -# This is a tools-level test for POSIX.1e ACL functionality. Run it as root -# using ACL-enabled kernel: -# -# /usr/src/tools/regression/acltools/run /usr/src/tools/regression/acltools/tools-posix.test -# -# WARNING: Creates files in unsafe way. - -$ whoami -> root -$ umask 022 - -# Smoke test for getfacl(1). -$ touch xxx -$ getfacl -n xxx -> # file: xxx -> # owner: root -> # group: wheel -> user::rw- -> group::r-- -> other::r-- - -$ getfacl -q xxx -> user::rw- -> group::r-- -> other::r-- - -$ setfacl -m u:42:r,g:43:w xxx -$ getfacl -n xxx -> # file: xxx -> # owner: root -> # group: wheel -> user::rw- -> user:42:r-- -> group::r-- -> group:43:-w- -> mask::rw- -> other::r-- - -# Check whether ls correctly marks files with "+". -$ ls -l xxx | cut -d' ' -f1 -> -rw-rw-r--+ - -# Same as above, but for symlinks. -$ ln -s xxx lll -$ getfacl -h lll -> # file: lll -> # owner: root -> # group: wheel -> user::rwx -> group::r-x -> other::r-x - -$ getfacl -qh lll -> user::rwx -> group::r-x -> other::r-x - -$ getfacl -q lll -> user::rw- -> user:42:r-- -> group::r-- -> group:43:-w- -> mask::rw- -> other::r-- - -$ setfacl -hm u:44:x,g:45:w lll -$ getfacl -h lll -> # file: lll -> # owner: root -> # group: wheel -> user::rwx -> user:44:--x -> group::r-x -> group:45:-w- -> mask::rwx -> other::r-x - -$ ls -l lll | cut -d' ' -f1 -> lrwxrwxr-x+ - -# Check whether the original file is left untouched. -$ ls -l xxx | cut -d' ' -f1 -> -rw-rw-r--+ - -$ rm lll - -# Test removing entries. -$ setfacl -x user:42: xxx -$ getfacl xxx -> # file: xxx -> # owner: root -> # group: wheel -> user::rw- -> group::r-- -> group:43:-w- -> mask::rw- -> other::r-- - -$ setfacl -m u:42:r xxx -$ getfacl -n xxx -> # file: xxx -> # owner: root -> # group: wheel -> user::rw- -> user:42:r-- -> group::r-- -> group:43:-w- -> mask::rw- -> other::r-- - -# Test removing entries by number. -$ setfacl -x 1 xxx -$ getfacl -n xxx -> # file: xxx -> # owner: root -> # group: wheel -> user::rw- -> group::r-- -> group:43:-w- -> mask::rw- -> other::r-- - -$ setfacl -m g:43:r xxx -$ getfacl -n xxx -> # file: xxx -> # owner: root -> # group: wheel -> user::rw- -> group::r-- -> group:43:r-- -> mask::r-- -> other::r-- - -# Make sure cp without any flags does not copy the ACL. -$ cp xxx yyy -$ ls -l yyy | cut -d' ' -f1 -> -rw-r--r-- - -# Make sure it does with the "-p" flag. -$ rm yyy -$ cp -p xxx yyy -$ getfacl -n yyy -> # file: yyy -> # owner: root -> # group: wheel -> user::rw- -> group::r-- -> group:43:r-- -> mask::r-- -> other::r-- - -$ rm yyy - -# Test removing entries by... by example? -$ setfacl -m u:42:r,g:43:w xxx -$ setfacl -x u:42: xxx -$ getfacl -n xxx -> # file: xxx -> # owner: root -> # group: wheel -> user::rw- -> group::r-- -> group:43:-w- -> mask::rw- -> other::r-- - -# Test setfacl -b. -$ setfacl -b xxx -$ getfacl -n xxx -> # file: xxx -> # owner: root -> # group: wheel -> user::rw- -> group::r-- -> mask::r-- -> other::r-- - -$ ls -l xxx | cut -d' ' -f1 -> -rw-r--r--+ - -$ setfacl -nb xxx -$ getfacl -n xxx -> # file: xxx -> # owner: root -> # group: wheel -> user::rw- -> group::r-- -> other::r-- - -$ ls -l xxx | cut -d' ' -f1 -> -rw-r--r-- - -# Check setfacl(1) and getfacl(1) with multiple files. -$ touch xxx yyy zzz - -$ ls -l xxx yyy zzz | cut -d' ' -f1 -> -rw-r--r-- -> -rw-r--r-- -> -rw-r--r-- - -$ setfacl -m u:42:x,g:43:w nnn xxx yyy zzz -> setfacl: nnn: stat() failed: No such file or directory - -$ ls -l nnn xxx yyy zzz | cut -d' ' -f1 -> ls: nnn: No such file or directory -> -rw-rwxr--+ -> -rw-rwxr--+ -> -rw-rwxr--+ - -$ getfacl -nq nnn xxx yyy zzz -> getfacl: nnn: stat() failed: No such file or directory -> user::rw- -> user:42:--x -> group::r-- -> group:43:-w- -> mask::rwx -> other::r-- -> -> user::rw- -> user:42:--x -> group::r-- -> group:43:-w- -> mask::rwx -> other::r-- -> -> user::rw- -> user:42:--x -> group::r-- -> group:43:-w- -> mask::rwx -> other::r-- - -$ setfacl -b nnn xxx yyy zzz -> setfacl: nnn: stat() failed: No such file or directory - -$ ls -l nnn xxx yyy zzz | cut -d' ' -f1 -> ls: nnn: No such file or directory -> -rw-r--r--+ -> -rw-r--r--+ -> -rw-r--r--+ - -$ setfacl -bn nnn xxx yyy zzz -> setfacl: nnn: stat() failed: No such file or directory - -$ ls -l nnn xxx yyy zzz | cut -d' ' -f1 -> ls: nnn: No such file or directory -> -rw-r--r-- -> -rw-r--r-- -> -rw-r--r-- - -$ rm xxx yyy zzz - -# Check whether chmod actually does what it should do. -$ touch xxx -$ setfacl -m u:42:rwx,g:43:rwx xxx -$ chmod 600 xxx -$ getfacl -n xxx -> # file: xxx -> # owner: root -> # group: wheel -> user::rw- -> user:42:rwx # effective: --- -> group::r-- # effective: --- -> group:43:rwx # effective: --- -> mask::--- -> other::--- - -$ chmod 060 xxx -$ getfacl -n xxx -> # file: xxx -> # owner: root -> # group: wheel -> user::--- -> user:42:rwx # effective: rw- -> group::r-- -> group:43:rwx # effective: rw- -> mask::rw- -> other::--- - -# Test default ACLs. -$ umask 022 -$ mkdir ddd -$ getfacl -qn ddd -> user::rwx -> group::r-x -> other::r-x - -$ ls -l | grep ddd | cut -d' ' -f1 -> drwxr-xr-x - -$ getfacl -dq ddd -$ setfacl -dm u::rwx,g::rx,o::rx,mask::rwx ddd -$ getfacl -dqn ddd -> user::rwx -> group::r-x -> mask::rwx -> other::r-x - -# No change - ls(1) output doesn't take into account default ACLs. -$ ls -l | grep ddd | cut -d' ' -f1 -> drwxr-xr-x - -$ setfacl -dm g:42:rwx,u:42:r ddd -$ setfacl -dm g::w ddd -$ getfacl -dqn ddd -> user::rwx -> user:42:r-- -> group::-w- -> group:42:rwx -> mask::rwx -> other::r-x - -$ setfacl -dx group:42: ddd -$ getfacl -dqn ddd -> user::rwx -> user:42:r-- -> group::-w- -> mask::rw- -> other::r-x - -$ ls -l | grep ddd | cut -d' ' -f1 -> drwxr-xr-x - -$ rmdir ddd -$ rm xxx - -# Test inheritance. -$ mkdir ddd - -$ touch ddd/xxx -$ getfacl -q ddd/xxx -> user::rw- -> group::r-- -> other::r-- - -$ mkdir ddd/ddd -$ getfacl -q ddd/ddd -> user::rwx -> group::r-x -> other::r-x - -$ rmdir ddd/ddd -$ rm ddd/xxx - -$ setfacl -dm u::rwx,g::rx,o::rx,mask::rwx ddd -$ setfacl -dm g:42:rwx,u:43:r ddd -$ getfacl -dq ddd -> user::rwx -> user:43:r-- -> group::r-x -> group:42:rwx -> mask::rwx -> other::r-x - -$ touch ddd/xxx -$ getfacl -q ddd/xxx -> user::rw- -> user:43:r-- -> group::r-x # effective: r-- -> group:42:rwx # effective: r-- -> mask::r-- -> other::r-- - -$ mkdir ddd/ddd -$ getfacl -q ddd/ddd -> user::rwx -> user:43:r-- -> group::r-x -> group:42:rwx # effective: r-x -> mask::r-x -> other::r-x - -$ rmdir ddd/ddd -$ rm ddd/xxx -$ rmdir ddd - -# Test if we deal properly with fifos. -$ mkfifo fff -$ ls -l fff | cut -d' ' -f1 -> prw-r--r-- - -$ setfacl -m u:42:r,g:43:w fff -$ getfacl fff -> # file: fff -> # owner: root -> # group: wheel -> user::rw- -> user:42:r-- -> group::r-- -> group:43:-w- -> mask::rw- -> other::r-- - -$ ls -l fff | cut -d' ' -f1 -> prw-rw-r--+ - -$ setfacl -bn fff -$ getfacl fff -> # file: fff -> # owner: root -> # group: wheel -> user::rw- -> group::r-- -> other::r-- - -$ ls -l fff | cut -d' ' -f1 -> prw-r--r-- - -$ rm fff - -# Test if we deal properly with device files. -$ mknod bbb b 1 1 -$ setfacl -m u:42:r,g:43:w bbb -> setfacl: bbb: acl_get_file() failed: Operation not supported -$ ls -l bbb | cut -d' ' -f1 -> brw-r--r-- - -$ rm bbb - -$ mknod ccc c 1 1 -$ setfacl -m u:42:r,g:43:w ccc -> setfacl: ccc: acl_get_file() failed: Operation not supported -$ ls -l ccc | cut -d' ' -f1 -> crw-r--r-- - -$ rm ccc diff --git a/tools/regression/lib/libc/stdlib/Makefile b/tools/regression/lib/libc/stdlib/Makefile deleted file mode 100644 index c707795..0000000 --- a/tools/regression/lib/libc/stdlib/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# $FreeBSD$ - -TESTS= test-qsort \ - test-heapsort \ - test-mergesort - -.PHONY: tests -tests: ${TESTS} - for p in ${TESTS}; do ${.OBJDIR}/$$p; done - -.PHONY: clean -clean: - -rm -f ${TESTS} diff --git a/tools/regression/lib/libc/stdlib/test-heapsort.c b/tools/regression/lib/libc/stdlib/test-heapsort.c deleted file mode 100644 index 6ce8924..0000000 --- a/tools/regression/lib/libc/stdlib/test-heapsort.c +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * Copyright (C) 2004 Maxim Sobolev <sobomax@FreeBSD.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Test for heapsort() routine. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> - -#include "test-sort.h" - -int -main(int argc, char *argv[]) -{ - int i, j; - int testvector[IVEC_LEN]; - int sresvector[IVEC_LEN]; - - printf("1..1\n"); - for (j = 2; j < IVEC_LEN; j++) { - /* Populate test vectors */ - for (i = 0; i < j; i++) - testvector[i] = sresvector[i] = initvector[i]; - - /* Sort using heapsort(3) */ - heapsort(testvector, j, sizeof(testvector[0]), sorthelp); - /* Sort using reference slow sorting routine */ - ssort(sresvector, j); - - /* Compare results */ - for (i = 0; i < j; i++) - assert(testvector[i] == sresvector[i]); - } - - printf("ok 1 - heapsort\n"); - - return(0); -} diff --git a/tools/regression/lib/libc/stdlib/test-heapsort.t b/tools/regression/lib/libc/stdlib/test-heapsort.t deleted file mode 100644 index 8bdfd03..0000000 --- a/tools/regression/lib/libc/stdlib/test-heapsort.t +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -cd `dirname $0` - -executable=`basename $0 .t` - -make $executable 2>&1 > /dev/null - -exec ./$executable diff --git a/tools/regression/lib/libc/stdlib/test-mergesort.c b/tools/regression/lib/libc/stdlib/test-mergesort.c deleted file mode 100644 index 729d481..0000000 --- a/tools/regression/lib/libc/stdlib/test-mergesort.c +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * Copyright (C) 2004 Maxim Sobolev <sobomax@FreeBSD.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Test for mergesort() routine. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> - -#include "test-sort.h" - -int -main(int argc, char *argv[]) -{ - int i, j; - int testvector[IVEC_LEN]; - int sresvector[IVEC_LEN]; - - printf("1..1\n"); - for (j = 2; j < IVEC_LEN; j++) { - /* Populate test vectors */ - for (i = 0; i < j; i++) - testvector[i] = sresvector[i] = initvector[i]; - - /* Sort using mergesort(3) */ - mergesort(testvector, j, sizeof(testvector[0]), sorthelp); - /* Sort using reference slow sorting routine */ - ssort(sresvector, j); - - /* Compare results */ - for (i = 0; i < j; i++) - assert(testvector[i] == sresvector[i]); - } - - printf("ok 1 - mergesort\n"); - - return(0); -} diff --git a/tools/regression/lib/libc/stdlib/test-mergesort.t b/tools/regression/lib/libc/stdlib/test-mergesort.t deleted file mode 100644 index 8bdfd03..0000000 --- a/tools/regression/lib/libc/stdlib/test-mergesort.t +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -cd `dirname $0` - -executable=`basename $0 .t` - -make $executable 2>&1 > /dev/null - -exec ./$executable diff --git a/tools/regression/lib/libc/stdlib/test-qsort.c b/tools/regression/lib/libc/stdlib/test-qsort.c deleted file mode 100644 index 8a508e8..0000000 --- a/tools/regression/lib/libc/stdlib/test-qsort.c +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * Copyright (C) 2004 Maxim Sobolev <sobomax@FreeBSD.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Test for qsort() routine. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> - -#include "test-sort.h" - -int -main(int argc, char *argv[]) -{ - int i, j; - int testvector[IVEC_LEN]; - int sresvector[IVEC_LEN]; - - printf("1..1\n"); - for (j = 2; j < IVEC_LEN; j++) { - /* Populate test vectors */ - for (i = 0; i < j; i++) - testvector[i] = sresvector[i] = initvector[i]; - - /* Sort using qsort(3) */ - qsort(testvector, j, sizeof(testvector[0]), sorthelp); - /* Sort using reference slow sorting routine */ - ssort(sresvector, j); - - /* Compare results */ - for (i = 0; i < j; i++) - assert(testvector[i] == sresvector[i]); - } - - printf("ok 1 - qsort\n"); - - return(0); -} diff --git a/tools/regression/lib/libc/stdlib/test-qsort.t b/tools/regression/lib/libc/stdlib/test-qsort.t deleted file mode 100644 index 8bdfd03..0000000 --- a/tools/regression/lib/libc/stdlib/test-qsort.t +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -cd `dirname $0` - -executable=`basename $0 .t` - -make $executable 2>&1 > /dev/null - -exec ./$executable diff --git a/tools/regression/lib/libc/stdlib/test-sort.h b/tools/regression/lib/libc/stdlib/test-sort.h deleted file mode 100644 index e060f72..0000000 --- a/tools/regression/lib/libc/stdlib/test-sort.h +++ /dev/null @@ -1,269 +0,0 @@ -/*- - * Copyright (C) 2004 Maxim Sobolev <sobomax@FreeBSD.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _TEST_SORT_H -#define _TEST_SORT_H - -static int -sorthelp(const void *a, const void *b) -{ - const int *oa, *ob; - - oa = a; - ob = b; - /* Don't use "return *oa - *ob" since it's easy to cause overflow! */ - if (*oa > *ob) - return 1; - if (*oa < *ob) - return -1; - return 0; -} - -/* Reference sorting routine (slooow!) */ -static void -ssort(int v[], int nmemb) -{ - int i, j, k; - - for (i = 0; i < nmemb; i++) { - for (j = i + 1; j < nmemb; j++) { - if (v[j] < v[i]) { - k = v[i]; - v[i] = v[j]; - v[j] = k; - } - } - } -} - -/* Some random data */ -static int initvector[1024] = { - 599853225, 371951333, -428880425, 1450668530, 85530178, -460170550, - -270680269, 717137591, 106244401, -1138072905, -113532586, - 599690958, 464993720, 107690177, 24249019, -1151018550, 794225588, - 1494905642, -62951716, -734531757, 1197251494, 1020063925, - -634536734, -216634704, 617366508, -18840190, 481010395, - -1555785724, 128221950, -1747743676, 1119012320, -252160437, - 617137855, 1159833073, -106647920, -1570719046, -769400990, - -130308848, 1186546396, 215253591, 445832488, 160263176, 777264170, - -274636650, -696134447, 1057957088, -626175254, 188632134, - -98941793, -1602334908, -373717125, 885013862, 571258221, - -399572192, 407761463, -733249776, 12094800, -367046815, 178974501, - -452638559, -516580143, -94282073, 1411115180, -1151792797, - 1442815268, 1106583674, 515269284, -74019972, 598818901, 696848474, - -657910766, -287309335, 1538095746, 143543003, 851444033, - -947573348, 296222973, 1339592140, -947505360, 872027891, - -418844714, -583075597, -324758197, -964531573, 1016795914, - -866842580, -304084402, -286930819, 338975583, 803597943, - -452483372, 1525283506, -1185830826, -596405894, 905191340, - -1638026278, 106749913, 582771197, -730713796, 56052422, - 1498040174, 644967266, 182541575, 280483468, -1932835017, - -435546874, 940106007, 1753388509, -340355019, -231577358, - -714879035, 1051182949, 204261785, 1321346243, -895289878, - -240369893, 566608506, -350777580, -1384849829, -876816409, - 1013787299, -1408035937, -222626650, 1708168486, -645148461, - 1854654, -393012507, 179327030, -1607975548, -715202732, 730588290, - 246968517, -550975254, -101136772, -174103176, 1188941016, - 2004650834, -1501389866, -2021225998, 1219042515, -464113898, - 268565342, 126451123, -1045877126, -198918003, 310177444, - 1578314812, 1828867082, 453336898, -908485523, 749777130, - -1028565802, 61360571, 241484853, -175693399, 1816211059, - 533940889, -1496933703, 385185125, -821132413, -8923391, - -1429546239, 46190992, 449247332, -20432494, 778761611, -178782699, - -811194695, -632276211, 70196094, 890817525, -1447776908, - -323783741, -62333222, 954929503, 247668507, -1394420605, - 367913886, 1364926759, 1298781924, 357923028, -73644747, - -319744305, 61718202, -1454549286, 387493522, 2018321449, - 861026653, 289973298, 1755939093, -84772204, 43425266, -1325753781, - -679938775, 1228500370, -763816405, 548903035, 1765563727, - 425183052, 1424621863, -188287424, 554385654, 751831998, - 1377088085, 66622090, 139224450, -1305816167, 650140724, 593988868, - -444913321, 589045097, 1261428989, 101292769, -780376786, - 559307348, 1644593236, -1838606833, 53570301, -680576100, - -44969538, 268718267, -632104125, 276904628, 626299449, -11761453, - 545899086, -1027343598, -432251872, 539353494, -399575006, - -568383580, -677802882, 1296513472, 801202048, 806425805, 1983363, - 850487421, 38046173, 1535399484, 1998285544, -1301751898, - -46561973, 56545408, -1107662676, 456041145, -452923904, - -262219453, -371849200, 392524281, 1650231392, 1185585356, - 126610511, -1125389657, 1015981177, -1318481342, -213835789, - 1263484054, -654361441, 1408272041, -231555284, -1121778152, - -395512897, 332277674, -349703586, 1809474399, -223731607, - -1342224737, 736165236, 67535587, 89879082, 471445838, 423788300, - -384354470, 907475706, 154886390, -1406736539, -8558766, - -203405718, -422127884, 1048520863, 747418501, 87438975, 727668160, - -914936981, 428266976, -455742009, -949014605, 487159058, - -262526850, -309451504, -76928461, 1072951428, -1370953830, - 238231681, -1831047244, -405735199, -35941848, 469048670, - 505307987, -660553590, 876537439, -314195871, 999234339, - -1405846240, -579885695, 629067031, 863481510, -742301385, - -1723403128, -153070386, 782682839, -343111818, -877101810, - 1438467302, -319951459, -1585702508, -338381888, 484108815, - -1726935191, -749923706, 1657932127, -816151395, -566321865, - -133542331, 84961164, 598275578, 1302065347, -533098653, - -1766383037, 53169714, -464201288, 617735133, 862536123, - -141730724, -1967377125, -1023736305, -1012511106, 64484992, - -1250856831, 426409332, -355670055, -298251663, -867634978, - -776124819, 74018333, -425385214, -108004251, -1192766130, - 1294193867, -109867195, -78667637, 1164855393, -826007552, - -522528066, 1160283046, -1095276403, -1218917472, -396475366, - -77394733, -425603169, 251928357, -393559355, 1488845184, - 898455978, -773338691, -37627855, -345014717, 204298578, 209084274, - 1047080643, -414348222, 26496664, 705759824, 575149152, 604904761, - 624988690, 1446041250, 1000757225, -1354896151, 1422958189, - -1607165311, -832757521, 365074225, 1171764999, 1200795217, - -203957828, 23166236, -846818698, -547439867, -790192498, - -122123561, 914298013, 66225525, -36163174, -480698856, - -1269421818, 624641703, 254923102, 1564329013, -583609221, - -649433551, -743396069, 1182455435, 102658744, 285599336, - 692480463, -852737563, -660090184, 1374350065, 72300985, 690541659, - -1194212957, -1151816525, 157415641, 487398246, 1030153072, - 933723020, 1359181027, -1303457764, -1543773272, 774306017, - -854382652, 755485667, -864943584, -63242545, -1271480354, - 157720215, -205001173, 889984130, -581583822, -473779111, - -932136577, 735326252, 428638717, 1888884222, 561493709, - -1966427364, -1710208603, 340121869, 918894036, 927172509, - 904178436, 1476687667, 90796414, 651591731, -550913123, -42218158, - 637756529, 1091478400, 124976584, -48739309, -798898083, 393581349, - -1078624722, -789291577, 1010582542, -512317005, 1222773656, - 466454593, 1183558811, 822782663, -851624703, -850404012, - 1473672600, 852527073, 1073953362, 137635828, 936104739, -86567759, - -882563252, 1845232980, -737978404, -104703380, 149802989, - -349118325, 1479797538, 1966007488, 1254228842, 414304661, - -790805785, 31583329, -76864151, 558202855, -1447047313, 716720607, - -404224238, -54107627, 1747385914, -657407390, 202940208, - 1083067056, -532861378, 163426933, -130289277, 1301785258, - -302920320, -637947485, -644895903, -1668027530, 391890467, - -126586485, -536836984, -1154536413, -339505118, -1187229462, - -670985870, -601310813, -1350055158, -482479784, 139847714, - -253955849, 5190414, -542857077, 1175835684, -584165057, - 1132775766, -592091269, -891445655, -340995936, 736395810, - 779967964, 515095845, -1138437307, -259226729, -167820100, - -801611617, -282451622, -1313679283, -1436126694, 1258773990, - -717601098, -583559645, -1307478759, 1238647247, 1589011223, - -1029216445, -107030650, 400152690, -1349079913, 1428582247, - 21546946, 208807686, -169450574, -1086213374, -1242715198, - 669098277, 416626722, -1122525014, -1389466669, -391843085, - -56318357, 421040094, 212303518, 738666684, -1185364904, - -506192760, 646735912, -1424722633, 745226976, 1019191717, - -190891744, -310320868, -373655022, -665117060, 830760000, - 583906512, -330536027, 611092636, -321344259, -1255008904, - -777959046, -523043472, 88896910, 346062204, -163734816, 336635665, - 906060268, -128891583, 740952564, 916767203, 296514859, 198670559, - 358136672, -152253676, 12038867, -1469916749, -1020980597, - -897143313, 354240970, -97959800, 814172811, 1983363241, 264990663, - 105154676, 1060463014, 430172143, 375111946, -824526943, - -708877751, -1377442616, -236559551, 684724584, 1602131358, - -42140186, -763499840, -605167, 98575879, -376577598, 1689746083, - -777973879, -1396984691, -187780326, 281040966, 1858859521, - 158395760, 1022807978, -218458812, 811779708, 1495113833, - 1192561226, 629539535, -1365196683, -1120253162, 1091681956, - 134286445, 1172218369, -34093658, -137087343, -27869226, - -180889478, 55705436, 52362743, -1745516232, -926564477, - -513701675, -1666272054, 1457952810, 843953275, -478275722, - -1240291080, 101859661, -1606687523, 916365333, 314713310, - -22002688, 1019022641, -1171741314, -129050627, -211955813, - -1020176299, 1357865293, -609819628, 724533854, -1141449545, - 22285231, -97731145, -302329687, 191910894, -1300709885, - -644951895, 640448036, -1289009824, 1445456129, 846416471, - 1821291740, -1639640821, -712724532, -447475807, 132156847, - 258067455, 324301319, 278586969, -1544082357, 636007277, 977122066, - 127462480, 365126129, 1086276825, -432124148, 896598926, - -388550179, 273357331, -845018695, -1089465389, 384439820, - -558419772, 1476422025, 730712769, 190665059, -764968927, - -789708218, 637873581, 348429858, 1386000168, -638123594, - -842010345, -607926448, 19535163, -742771490, -18323344, 246155488, - 350409468, 1290907730, -492566468, 300358636, 501876267, 252441807, - 1233551975, -1431067042, 517177374, -1540299707, -948380761, - 1253997663, 693795998, 148707823, 152894502, 98729538, -30042824, - -563057441, 723726409, 367338961, 1395435261, 217868876, - 1220652431, 953572083, -1134905155, -734486813, -587470130, - -864647866, 1030737023, 781798521, -321076732, -460548153, - 122681678, -873728847, -1286304399, -75472885, 113390881, - -1556849198, -1070802176, 924389470, 957478910, 5974049, 709413506, - 476334647, 572869787, 776298405, -8822420, -99326499, -707855342, - -1187216303, 668038414, 262454769, -1120293198, -32011040, - 249812104, -101835410, 1082281087, -570183855, -954535179, - 1384361473, -983199686, 2017611313, 328926483, -878162849, - -1202254181, -225604951, 966898955, 247213529, -1257544612, - -197005970, -1039902730, -1947925142, 1752780907, -313410699, - -464474556, 416580338, -1063356643, -292212702, 57509168, - 1034124629, 1059212593, 468522867, 845369497, 1872717306, - -1216544764, -1419907623, 1376869956, -66585488, -1590974467, - -367070705, -1456529060, 791844031, 336217635, -1106832215, - 1476739427, -751018210, -1411671555, -1880387375, -1714242595, - 1169006474, -479442380, -892267555, -1471250266, -267888858, - 808634418, 1324777189, -585449929, 1127186951, 468768901, - -2002989138, -52352849, 186493053, 1258464606, 117157186, - 445919258, 908401949, -1112221136, 863904453, -942718649, - 796754809, -38943966, -781978872, -56814078, 1273857459, - -1781920832, 209979504, 811828269, -1150814437, 850061883, - -532968763, 252506408, -885025629, 391567580, -1295702482, - 574894420, 1462248349, 1622584325, -88443443, -1122006092, - -169758578, 456282338, -443233309, 436693483, -956563815, - -480221349, 435252860, -1114099391, 1060053979, -470893945, - -1273682879, -734596176, 639950927, -1278648701, 306274747, - -410562146, 1137869228, -1970746553, 1313830798, 1248071822, - -247297704, 1015218053, -1607348116, -261817613, -821413148, - -782942639, -628711083, 240953091, -629550668, -1584736319, - 856616893, -186759752, 197905373, 541638393, 603407919, -278480495, - 410077039, 544065371, -1509627427, 402918436, -450463799, - -131169308, 249920630, 1079548609, -927911828, 1444577689, - -353002528, -224292462, 1247795279, -790844631, -40427503, - 59829765, -332587567, 1319862109, -1261340753, 121711726, - 1342756342, -643495787, 100326201, -934436714, -69134888, - -898880561, -379524737, -577234570, -805827092, -1575493557, - -289920678, -476605057, 1235714994, -317239591, 418553949, - 410053338, -204985448, 1206503615, 202610372, -932244873, - 782207875, -288661931, -806814809, 1270953679, 2060991595, - -311412846, 327279979, 1148562672, 55239149, -610114433, - -1511688434, 87619740, -433503545, 326150519, -581293393, - -97417688, -289736140, -1543886029, -1251976119, 1585774446, - 1570011421, 432602745, 486343696, -834680922, 265004849, - -1132107706, 502627197, -815873818, 249635389, 1985714127, - -1095817653, -130743522, -645266828, -334621094, 199921747, - 1059256177, 378031303, 1519740920, 925540689, 1405957844, - 1387748290, -56138046, -770637828, -187984510, -1361735163, - 1294823206, -608941238, 451860688, -510549867, 1143516283, - -779090703, 1459305047, -600335915, -1684168049, 1516622316, - -631733335, -4360068, 499778796, 587600402, -1296000335, -37959743, - -1084203927, 1162902556, 246374600, -515103645, 341724568, - -702303954, 452229900, 485108287, 1170048553, -1510148355, - 611133912, 1997927484, -142022671, -724776653, -336090522, - 708283514, -1409637378, -2052637687, 376055110, 226628105, - -1714452033, -1776158002, 369167930, 1800807012, 710680889, - -69951947, -1223849766, -1862239787, 218536127, -656411794, - -1202269188, 609634805, -224425858, 519797951, 284223080, - 869408930, 270750206, -544967439, 2097168510, 31650971, -600985417, - -165303097, -257809088, -1043223971, 1827891621, -156827355, - 499719603 -}; - -#define IVEC_LEN (sizeof(initvector) / sizeof(initvector[0])) - -#endif diff --git a/tools/regression/lib/libc/string/Makefile b/tools/regression/lib/libc/string/Makefile deleted file mode 100644 index 2c34ca3..0000000 --- a/tools/regression/lib/libc/string/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# $FreeBSD$ - -TESTS= test-stpncpy test-strerror test-wcscasecmp test-wcsnlen - -.PHONY: tests -tests: ${TESTS} - for p in ${TESTS}; do ${.OBJDIR}/$$p; done - -.PHONY: clean -clean: - -rm -f ${TESTS} diff --git a/tools/regression/lib/libc/string/test-stpncpy.c b/tools/regression/lib/libc/string/test-stpncpy.c deleted file mode 100644 index 91120cb..0000000 --- a/tools/regression/lib/libc/string/test-stpncpy.c +++ /dev/null @@ -1,93 +0,0 @@ -/*- - * Copyright (c) 2009 David Schultz <das@FreeBSD.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/mman.h> -#include <sys/param.h> -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -static char * -makebuf(size_t len, int guard_at_end) -{ - char *buf; - size_t alloc_size = roundup2(len, PAGE_SIZE) + PAGE_SIZE; - - buf = mmap(NULL, alloc_size, PROT_READ | PROT_WRITE, MAP_ANON, -1, 0); - assert(buf); - if (guard_at_end) { - assert(munmap(buf + alloc_size - PAGE_SIZE, PAGE_SIZE) == 0); - return (buf + alloc_size - PAGE_SIZE - len); - } else { - assert(munmap(buf, PAGE_SIZE) == 0); - return (buf + PAGE_SIZE); - } -} - -static void -test_stpncpy(const char *s) -{ - char *src, *dst; - size_t size, len, bufsize, x; - int i, j; - - size = strlen(s) + 1; - for (i = 0; i <= 1; i++) { - for (j = 0; j <= 1; j++) { - for (bufsize = 0; bufsize <= size + 10; bufsize++) { - src = makebuf(size, i); - memcpy(src, s, size); - dst = makebuf(bufsize, j); - memset(dst, 'X', bufsize); - len = (bufsize < size) ? bufsize : size - 1; - assert(stpncpy(dst, src, bufsize) == dst+len); - assert(memcmp(src, dst, len) == 0); - for (x = len; x < bufsize; x++) - assert(dst[x] == '\0'); - } - } - } -} - -int -main(int argc, char *argv[]) -{ - - printf("1..3\n"); - - test_stpncpy(""); - printf("ok 1 - stpncpy\n"); - test_stpncpy("foo"); - printf("ok 2 - stpncpy\n"); - test_stpncpy("glorp"); - printf("ok 3 - stpncpy\n"); - - exit(0); -} diff --git a/tools/regression/lib/libc/string/test-strerror.c b/tools/regression/lib/libc/string/test-strerror.c deleted file mode 100644 index 84e1b45..0000000 --- a/tools/regression/lib/libc/string/test-strerror.c +++ /dev/null @@ -1,147 +0,0 @@ -/*- - * Copyright (c) 2001 Wes Peters <wes@FreeBSD.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <assert.h> -#include <errno.h> -#include <limits.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -static int test_count = 1; -static int exit_status = EXIT_SUCCESS; - -#define CHECK(x) \ - do { \ - if (x) { \ - printf("ok %d\n", test_count); \ - } else { \ - printf("not ok %d # %s\n", test_count, #x); \ - exit_status = EXIT_FAILURE; \ - } \ - ++test_count; \ - } while (0) - -int -main(void) -{ - char buf[64]; - char *sret; - int iret; - - printf("1..27\n"); - - /* - * strerror() failure tests. - */ - errno = 0; - sret = strerror(INT_MAX); - snprintf(buf, sizeof(buf), "Unknown error: %d", INT_MAX); - CHECK(strcmp(sret, buf) == 0); - CHECK(errno == EINVAL); - - /* - * strerror() success tests. - */ - errno = 0; - sret = strerror(0); - CHECK(strcmp(sret, "No error: 0") == 0); - CHECK(errno == 0); - - errno = 0; - sret = strerror(EPERM); - CHECK(strcmp(sret, "Operation not permitted") == 0); - CHECK(errno == 0); - - errno = 0; - sret = strerror(EPFNOSUPPORT); - CHECK(strcmp(sret, "Protocol family not supported") == 0); - CHECK(errno == 0); - - errno = 0; - sret = strerror(ELAST); - CHECK(errno == 0); - - /* - * strerror_r() failure tests. - */ - memset(buf, '*', sizeof(buf)); - iret = strerror_r(-1, buf, sizeof(buf)); - CHECK(strcmp(buf, "Unknown error: -1") == 0); - CHECK(iret == EINVAL); - - memset(buf, '*', sizeof(buf)); - /* One byte too short. */ - iret = strerror_r(EPERM, buf, strlen("Operation not permitted")); - CHECK(strcmp(buf, "Operation not permitte") == 0); - CHECK(iret == ERANGE); - - memset(buf, '*', sizeof(buf)); - /* One byte too short. */ - iret = strerror_r(-1, buf, strlen("Unknown error: -1")); - CHECK(strcmp(buf, "Unknown error: -") == 0); - CHECK(iret == EINVAL); - - memset(buf, '*', sizeof(buf)); - /* Two bytes too short. */ - iret = strerror_r(-2, buf, strlen("Unknown error: -2") - 1); - CHECK(strcmp(buf, "Unknown error: ") == 0); - CHECK(iret == EINVAL); - - memset(buf, '*', sizeof(buf)); - /* Three bytes too short. */ - iret = strerror_r(-2, buf, strlen("Unknown error: -2") - 2); - CHECK(strcmp(buf, "Unknown error:") == 0); - CHECK(iret == EINVAL); - - memset(buf, '*', sizeof(buf)); - /* One byte too short. */ - iret = strerror_r(12345, buf, strlen("Unknown error: 12345")); - CHECK(strcmp(buf, "Unknown error: 1234") == 0); - CHECK(iret == EINVAL); - - /* - * strerror_r() success tests. - */ - memset(buf, '*', sizeof(buf)); - iret = strerror_r(0, buf, sizeof(buf)); - CHECK(strcmp(buf, "No error: 0") == 0); - CHECK(iret == 0); - - memset(buf, '*', sizeof(buf)); - iret = strerror_r(EDEADLK, buf, sizeof(buf)); - CHECK(strcmp(buf, "Resource deadlock avoided") == 0); - CHECK(iret == 0); - - memset(buf, '*', sizeof(buf)); - iret = strerror_r(EPROCLIM, buf, sizeof(buf)); - CHECK(strcmp(buf, "Too many processes") == 0); - CHECK(iret == 0); - - return exit_status; -} diff --git a/tools/regression/lib/libc/string/test-strerror.t b/tools/regression/lib/libc/string/test-strerror.t deleted file mode 100644 index 8bdfd03..0000000 --- a/tools/regression/lib/libc/string/test-strerror.t +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -cd `dirname $0` - -executable=`basename $0 .t` - -make $executable 2>&1 > /dev/null - -exec ./$executable diff --git a/tools/regression/lib/libc/string/test-wcscasecmp.c b/tools/regression/lib/libc/string/test-wcscasecmp.c deleted file mode 100644 index 0236507..0000000 --- a/tools/regression/lib/libc/string/test-wcscasecmp.c +++ /dev/null @@ -1,88 +0,0 @@ -/*- - * Copyright (c) 2009 David Schultz <das@FreeBSD.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <assert.h> -#include <locale.h> -#include <stdio.h> -#include <stdlib.h> -#include <wchar.h> -#include <wctype.h> - -int -main(int argc, char *argv[]) -{ - - printf("1..6\n"); - - setlocale(LC_CTYPE, "C"); - - assert(wcscasecmp(L"", L"") == 0); - assert(wcsncasecmp(L"", L"", 50) == 0); - assert(wcsncasecmp(L"", L"", 0) == 0); - printf("ok 1 - wcscasecmp\n"); - - assert(wcscasecmp(L"abc", L"abc") == 0); - assert(wcscasecmp(L"ABC", L"ABC") == 0); - assert(wcscasecmp(L"abc", L"ABC") == 0); - assert(wcscasecmp(L"ABC", L"abc") == 0); - printf("ok 2 - wcscasecmp\n"); - - assert(wcscasecmp(L"abc", L"xyz") < 0); - assert(wcscasecmp(L"ABC", L"xyz") < 0); - assert(wcscasecmp(L"abc", L"XYZ") < 0); - assert(wcscasecmp(L"ABC", L"XYZ") < 0); - assert(wcscasecmp(L"xyz", L"abc") > 0); - assert(wcscasecmp(L"XYZ", L"abc") > 0); - assert(wcscasecmp(L"xyz", L"ABC") > 0); - assert(wcscasecmp(L"XYZ", L"ABC") > 0); - printf("ok 3 - wcscasecmp\n"); - - assert(wcscasecmp(L"abc", L"ABCD") < 0); - assert(wcscasecmp(L"ABC", L"abcd") < 0); - assert(wcscasecmp(L"abcd", L"ABC") > 0); - assert(wcscasecmp(L"ABCD", L"abc") > 0); - printf("ok 4 - wcscasecmp\n"); - - assert(wcsncasecmp(L"abc", L"ABCD", 4) < 0); - assert(wcsncasecmp(L"ABC", L"abcd", 4) < 0); - assert(wcsncasecmp(L"abcd", L"ABC", 4) > 0); - assert(wcsncasecmp(L"ABCD", L"abc", 4) > 0); - assert(wcsncasecmp(L"abc", L"ABCD", 3) == 0); - assert(wcsncasecmp(L"ABC", L"abcd", 3) == 0); - printf("ok 5 - wcsncasecmp\n"); - - assert(wcscasecmp(L"λ", L"Λ") != 0); - setlocale(LC_CTYPE, "el_GR.UTF-8"); - assert(wcscasecmp(L"λ", L"Λ") == 0); - assert(wcscasecmp(L"λ", L"Ω") < 0); - assert(wcscasecmp(L"Ω", L"λ") > 0); - printf("ok 6 - greek\n"); - - exit(0); -} diff --git a/tools/regression/lib/libc/string/test-wcsnlen.c b/tools/regression/lib/libc/string/test-wcsnlen.c deleted file mode 100644 index fda8a40..0000000 --- a/tools/regression/lib/libc/string/test-wcsnlen.c +++ /dev/null @@ -1,87 +0,0 @@ -/*- - * Copyright (c) 2009 David Schultz <das@FreeBSD.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/mman.h> -#include <sys/param.h> -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <wchar.h> - -static void * -makebuf(size_t len, int guard_at_end) -{ - char *buf; - size_t alloc_size = roundup2(len, PAGE_SIZE) + PAGE_SIZE; - - buf = mmap(NULL, alloc_size, PROT_READ | PROT_WRITE, MAP_ANON, -1, 0); - assert(buf); - if (guard_at_end) { - assert(munmap(buf + alloc_size - PAGE_SIZE, PAGE_SIZE) == 0); - return (buf + alloc_size - PAGE_SIZE - len); - } else { - assert(munmap(buf, PAGE_SIZE) == 0); - return (buf + PAGE_SIZE); - } -} - -static void -test_wcsnlen(const wchar_t *s) -{ - wchar_t *s1; - size_t size, len, bufsize; - int i; - - size = wcslen(s) + 1; - for (i = 0; i <= 1; i++) { - for (bufsize = 0; bufsize <= size + 10; bufsize++) { - s1 = makebuf(bufsize * sizeof(wchar_t), i); - wmemcpy(s1, s, bufsize); - len = (size > bufsize) ? bufsize : size - 1; - assert(wcsnlen(s1, bufsize) == len); - } - } -} - -int -main(int argc, char *argv[]) -{ - - printf("1..3\n"); - - test_wcsnlen(L""); - printf("ok 1 - wcsnlen\n"); - test_wcsnlen(L"foo"); - printf("ok 2 - wcsnlen\n"); - test_wcsnlen(L"glorp"); - printf("ok 3 - wcsnlen\n"); - - exit(0); -} |