1197436Strasz#!/bin/sh 2197436Strasz# 3197436Strasz# Copyright (c) 2008, 2009 Edward Tomasz Napiera��a <trasz@FreeBSD.org> 4197436Strasz# All rights reserved. 5197436Strasz# 6197436Strasz# Redistribution and use in source and binary forms, with or without 7197436Strasz# modification, are permitted provided that the following conditions 8197436Strasz# are met: 9197436Strasz# 1. Redistributions of source code must retain the above copyright 10197436Strasz# notice, this list of conditions and the following disclaimer. 11197436Strasz# 2. Redistributions in binary form must reproduce the above copyright 12197436Strasz# notice, this list of conditions and the following disclaimer in the 13197436Strasz# documentation and/or other materials provided with the distribution. 14197436Strasz# 15197436Strasz# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16197436Strasz# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17197436Strasz# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18197436Strasz# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19197436Strasz# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20197436Strasz# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21197436Strasz# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22197436Strasz# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23197436Strasz# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24197436Strasz# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25197436Strasz# SUCH DAMAGE. 26197436Strasz# 27197436Strasz# $FreeBSD$ 28197436Strasz# 29197436Strasz 30197436Strasz# This is a wrapper script to run tools-crossfs.test between UFS without 31197436Strasz# ACLs, UFS with POSIX.1e ACLs, and ZFS with NFSv4 ACLs. 32197436Strasz# 33197436Strasz# WARNING: It uses hardcoded ZFS pool name "acltools" 34197436Strasz# 35197436Strasz# Output should be obvious. 36197436Strasz 37288680Sngieif ! sysctl vfs.zfs.version.spa >/dev/null 2>&1; then 38288680Sngie echo "1..0 # SKIP system doesn't have ZFS loaded" 39288680Sngie exit 0 40288680Sngiefi 41288680Sngieif [ $(id -u) -ne 0 ]; then 42288680Sngie echo "1..0 # SKIP you must be root" 43288680Sngie exit 0 44288680Sngiefi 45288680Sngie 46197436Straszecho "1..5" 47197436Strasz 48219266StraszTESTDIR=$(dirname $(realpath $0)) 49197436StraszMNTROOT=`mktemp -dt acltools` 50197436Strasz 51197436Strasz# Set up the test filesystems. 52197436StraszMD1=`mdconfig -at swap -s 64m` 53197436StraszMNT1=$MNTROOT/nfs4 54197436Straszmkdir $MNT1 55271459Straszzpool create -m $MNT1 acltools /dev/$MD1 56197436Straszif [ $? -ne 0 ]; then 57197436Strasz echo "not ok 1 - 'zpool create' failed." 58288680Sngie echo 'Bail out!' 59197436Strasz exit 1 60197436Straszfi 61197436Strasz 62197436Straszecho "ok 1" 63197436Strasz 64197436StraszMD2=`mdconfig -at swap -s 10m` 65197436StraszMNT2=$MNTROOT/posix 66197436Straszmkdir $MNT2 67197436Strasznewfs /dev/$MD2 > /dev/null 68197436Straszmount -o acls /dev/$MD2 $MNT2 69197436Straszif [ $? -ne 0 ]; then 70197436Strasz echo "not ok 2 - mount failed." 71288680Sngie echo 'Bail out!' 72197436Strasz exit 1 73197436Straszfi 74197436Strasz 75197436Straszecho "ok 2" 76197436Strasz 77197436StraszMD3=`mdconfig -at swap -s 10m` 78197436StraszMNT3=$MNTROOT/none 79197436Straszmkdir $MNT3 80197436Strasznewfs /dev/$MD3 > /dev/null 81197436Straszmount /dev/$MD3 $MNT3 82197436Straszif [ $? -ne 0 ]; then 83197436Strasz echo "not ok 3 - mount failed." 84288680Sngie echo 'Bail out!' 85197436Strasz exit 1 86197436Straszfi 87197436Strasz 88197436Straszecho "ok 3" 89197436Strasz 90197436Straszcd $MNTROOT 91197436Strasz 92305227Sngieperl $TESTDIR/run $TESTDIR/tools-crossfs.test >&2 93197436Strasz 94197436Straszif [ $? -eq 0 ]; then 95197436Strasz echo "ok 4" 96197436Straszelse 97197436Strasz echo "not ok 4" 98197436Straszfi 99197436Strasz 100197436Straszcd / 101197436Strasz 102197436Straszumount -f $MNT3 103197436Straszrmdir $MNT3 104197436Straszmdconfig -du $MD3 105197436Strasz 106197436Straszumount -f $MNT2 107197436Straszrmdir $MNT2 108197436Straszmdconfig -du $MD2 109197436Strasz 110197436Straszzpool destroy -f acltools 111197436Straszrmdir $MNT1 112197436Straszmdconfig -du $MD1 113197436Strasz 114197436Straszrmdir $MNTROOT 115197436Strasz 116197436Straszecho "ok 5" 117197436Strasz 118