1196938Strasz#!/bin/sh 2196938Strasz# 3196938Strasz# Copyright (c) 2008, 2009 Edward Tomasz Napiera��a <trasz@FreeBSD.org> 4196938Strasz# All rights reserved. 5196938Strasz# 6196938Strasz# Redistribution and use in source and binary forms, with or without 7196938Strasz# modification, are permitted provided that the following conditions 8196938Strasz# are met: 9196938Strasz# 1. Redistributions of source code must retain the above copyright 10196938Strasz# notice, this list of conditions and the following disclaimer. 11196938Strasz# 2. Redistributions in binary form must reproduce the above copyright 12196938Strasz# notice, this list of conditions and the following disclaimer in the 13196938Strasz# documentation and/or other materials provided with the distribution. 14196938Strasz# 15196938Strasz# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16196938Strasz# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17196938Strasz# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18196938Strasz# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19196938Strasz# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20196938Strasz# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21196938Strasz# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22196938Strasz# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23196938Strasz# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24196938Strasz# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25196938Strasz# SUCH DAMAGE. 26196938Strasz# 27196938Strasz# $FreeBSD$ 28196938Strasz# 29196938Strasz 30196938Strasz# This is a wrapper script to run tools-nfs4.test on ZFS filesystem. 31196938Strasz# 32196938Strasz# WARNING: It uses hardcoded ZFS pool name "acltools" 33196938Strasz# 34196938Strasz# If any of the tests fails, here is how to debug it: go to 35196938Strasz# the directory with problematic filesystem mounted on it, 36196938Strasz# and do /path/to/test run /path/to/test tools-nfs4.test, e.g. 37196938Strasz# 38196938Strasz# /usr/src/tools/regression/acltools/run /usr/src/tools/regression/acltools/tools-nfs4.test 39196938Strasz# 40196938Strasz# Output should be obvious. 41196938Strasz 42196938Straszecho "1..4" 43196938Strasz 44196938Straszif [ `whoami` != "root" ]; then 45196938Strasz echo "not ok 1 - you need to be root to run this test." 46196938Strasz exit 1 47196938Straszfi 48196938Strasz 49219266StraszTESTDIR=$(dirname $(realpath $0)) 50196938Strasz 51196938Strasz# Set up the test filesystem. 52196938StraszMD=`mdconfig -at swap -s 64m` 53196938StraszMNT=`mktemp -dt acltools` 54196938Straszzpool create -R $MNT acltools /dev/$MD 55196938Straszif [ $? -ne 0 ]; then 56196938Strasz echo "not ok 1 - 'zpool create' failed." 57196938Strasz exit 1 58196938Straszfi 59196938Strasz 60196938Straszecho "ok 1" 61196938Strasz 62196938Straszcd $MNT 63196938Strasz 64196938Strasz# First, check whether we can crash the kernel by creating too many 65196938Strasz# entries. For some reason this won't work in the test file. 66196938Strasztouch xxx 67219267Straszsetfacl -x2 xxx 68196938Straszwhile :; do setfacl -a0 u:42:rwx:allow xxx 2> /dev/null; if [ $? -ne 0 ]; then break; fi; done 69196938Straszchmod 600 xxx 70196938Straszrm xxx 71196938Straszecho "ok 2" 72196938Strasz 73219267Straszperl $TESTDIR/run $TESTDIR/tools-nfs4-psarc.test > /dev/null 74196938Strasz 75196938Straszif [ $? -eq 0 ]; then 76196938Strasz echo "ok 3" 77196938Straszelse 78196938Strasz echo "not ok 3" 79196938Straszfi 80196938Strasz 81196938Straszcd / 82196938Straszzpool destroy -f acltools 83196938Straszrmdir $MNT 84196938Straszmdconfig -du $MD 85196938Strasz 86196938Straszecho "ok 4" 87