#!/bin/sh1#2# Copyright (c) 2008, 2009 Edward Tomasz Napierała <[email protected]>3#4# Redistribution and use in source and binary forms, with or without5# modification, are permitted provided that the following conditions6# are met:7# 1. Redistributions of source code must retain the above copyright8# notice, this list of conditions and the following disclaimer.9# 2. Redistributions in binary form must reproduce the above copyright10# notice, this list of conditions and the following disclaimer in the11# documentation and/or other materials provided with the distribution.12#13# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND14# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE15# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE16# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE17# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL18# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS19# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)20# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT21# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY22# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF23# SUCH DAMAGE.24#25#2627# This is a wrapper script to run tools-crossfs.test between UFS without28# ACLs, UFS with POSIX.1e ACLs, and ZFS with NFSv4 ACLs.29#30# WARNING: It uses hardcoded ZFS pool name "acltools"31#32# Output should be obvious.3334if ! sysctl vfs.zfs.version.spa >/dev/null 2>&1; then35echo "1..0 # SKIP system doesn't have ZFS loaded"36exit 037fi38if [ $(id -u) -ne 0 ]; then39echo "1..0 # SKIP you must be root"40exit 041fi42if [ ! -c /dev/mdctl ]; then43echo "1..0 # SKIP no /dev/mdctl to create md devices"44exit 045fi4647echo "1..5"4849TESTDIR=$(dirname $(realpath $0))50MNTROOT=`mktemp -dt acltools`5152# Set up the test filesystems.53MD1=`mdconfig -at swap -s 64m`54MNT1=$MNTROOT/nfs455mkdir $MNT156zpool create -m $MNT1 acltools /dev/$MD157if [ $? -ne 0 ]; then58echo "not ok 1 - 'zpool create' failed."59echo 'Bail out!'60exit 161fi6263echo "ok 1"6465MD2=`mdconfig -at swap -s 10m`66MNT2=$MNTROOT/posix67mkdir $MNT268newfs /dev/$MD2 > /dev/null69mount -o acls /dev/$MD2 $MNT270if [ $? -ne 0 ]; then71echo "not ok 2 - mount failed."72echo 'Bail out!'73exit 174fi7576echo "ok 2"7778MD3=`mdconfig -at swap -s 10m`79MNT3=$MNTROOT/none80mkdir $MNT381newfs /dev/$MD3 > /dev/null82mount /dev/$MD3 $MNT383if [ $? -ne 0 ]; then84echo "not ok 3 - mount failed."85echo 'Bail out!'86exit 187fi8889echo "ok 3"9091cd $MNTROOT9293perl $TESTDIR/run $TESTDIR/tools-crossfs.test >&29495if [ $? -eq 0 ]; then96echo "ok 4"97else98echo "not ok 4"99fi100101cd /102103umount -f $MNT3104rmdir $MNT3105mdconfig -du $MD3106107umount -f $MNT2108rmdir $MNT2109mdconfig -du $MD2110111zpool destroy -f acltools112rmdir $MNT1113mdconfig -du $MD1114115rmdir $MNTROOT116117echo "ok 5"118119120121