1b3af24b4SEnji Cooper#!/bin/sh 2b3af24b4SEnji Cooper# 3b3af24b4SEnji Cooper# Copyright (c) 2008, 2009 Edward Tomasz Napierała <trasz@FreeBSD.org> 4b3af24b4SEnji Cooper# All rights reserved. 5b3af24b4SEnji Cooper# 6b3af24b4SEnji Cooper# Redistribution and use in source and binary forms, with or without 7b3af24b4SEnji Cooper# modification, are permitted provided that the following conditions 8b3af24b4SEnji Cooper# are met: 9b3af24b4SEnji Cooper# 1. Redistributions of source code must retain the above copyright 10b3af24b4SEnji Cooper# notice, this list of conditions and the following disclaimer. 11b3af24b4SEnji Cooper# 2. Redistributions in binary form must reproduce the above copyright 12b3af24b4SEnji Cooper# notice, this list of conditions and the following disclaimer in the 13b3af24b4SEnji Cooper# documentation and/or other materials provided with the distribution. 14b3af24b4SEnji Cooper# 15b3af24b4SEnji Cooper# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16b3af24b4SEnji Cooper# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17b3af24b4SEnji Cooper# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18b3af24b4SEnji Cooper# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19b3af24b4SEnji Cooper# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20b3af24b4SEnji Cooper# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21b3af24b4SEnji Cooper# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22b3af24b4SEnji Cooper# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23b3af24b4SEnji Cooper# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24b3af24b4SEnji Cooper# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25b3af24b4SEnji Cooper# SUCH DAMAGE. 26b3af24b4SEnji Cooper# 27b3af24b4SEnji Cooper# $FreeBSD$ 28b3af24b4SEnji Cooper# 29b3af24b4SEnji Cooper 30b3af24b4SEnji Cooper# This is a wrapper script to run tools-nfs4.test on ZFS filesystem. 31b3af24b4SEnji Cooper# 32b3af24b4SEnji Cooper# WARNING: It uses hardcoded ZFS pool name "acltools" 33b3af24b4SEnji Cooper# 34b3af24b4SEnji Cooper# If any of the tests fails, here is how to debug it: go to 35b3af24b4SEnji Cooper# the directory with problematic filesystem mounted on it, 36b3af24b4SEnji Cooper# and do /path/to/test run /path/to/test tools-nfs4.test, e.g. 37b3af24b4SEnji Cooper# 38b3af24b4SEnji Cooper# /usr/src/tools/regression/acltools/run /usr/src/tools/regression/acltools/tools-nfs4.test 39b3af24b4SEnji Cooper# 40b3af24b4SEnji Cooper# Output should be obvious. 41b3af24b4SEnji Cooper 42b3af24b4SEnji Cooperif ! sysctl vfs.zfs.version.spa >/dev/null 2>&1; then 43b3af24b4SEnji Cooper echo "1..0 # SKIP system doesn't have ZFS loaded" 44b3af24b4SEnji Cooper exit 0 45b3af24b4SEnji Cooperfi 46b3af24b4SEnji Cooperif [ $(id -u) -ne 0 ]; then 47b3af24b4SEnji Cooper echo "1..0 # SKIP you must be root" 48b3af24b4SEnji Cooper exit 0 49b3af24b4SEnji Cooperfi 50b3af24b4SEnji Cooper 51b3af24b4SEnji Cooperecho "1..4" 52b3af24b4SEnji Cooper 53b3af24b4SEnji CooperTESTDIR=$(dirname $(realpath $0)) 54b3af24b4SEnji Cooper 55b3af24b4SEnji Cooper# Set up the test filesystem. 56b3af24b4SEnji CooperMD=`mdconfig -at swap -s 64m` 57b3af24b4SEnji CooperMNT=`mktemp -dt acltools` 58b3af24b4SEnji Coopertrap "cd /; zpool destroy -f acltools; rmdir $MNT; mdconfig -d -u $MD" EXIT 59b3af24b4SEnji Cooperzpool create -m $MNT acltools /dev/$MD 60b3af24b4SEnji Cooperif [ $? -ne 0 ]; then 61b3af24b4SEnji Cooper echo "not ok 1 - 'zpool create' failed." 62b3af24b4SEnji Cooper echo 'Bail out!' 63b3af24b4SEnji Cooper exit 1 64b3af24b4SEnji Cooperfi 65b3af24b4SEnji Cooper 66b3af24b4SEnji Cooperecho "ok 1" 67b3af24b4SEnji Cooper 68b3af24b4SEnji Coopercd $MNT 69b3af24b4SEnji Cooper 70b3af24b4SEnji Cooper# First, check whether we can crash the kernel by creating too many 71b3af24b4SEnji Cooper# entries. For some reason this won't work in the test file. 72b3af24b4SEnji Coopertouch xxx 73b3af24b4SEnji Coopersetfacl -x2 xxx 74b3af24b4SEnji Cooperwhile :; do setfacl -a0 u:42:rwx:allow xxx 2> /dev/null; if [ $? -ne 0 ]; then break; fi; done 75b3af24b4SEnji Cooperchmod 600 xxx 76b3af24b4SEnji Cooperrm xxx 77b3af24b4SEnji Cooperecho "ok 2" 78b3af24b4SEnji Cooper 79*708cc995SEnji Cooperperl $TESTDIR/run $TESTDIR/tools-nfs4-psarc.test >&2 80b3af24b4SEnji Cooper 81b3af24b4SEnji Cooperif [ $? -eq 0 ]; then 82b3af24b4SEnji Cooper echo "ok 3" 83b3af24b4SEnji Cooperelse 84b3af24b4SEnji Cooper echo "not ok 3" 85b3af24b4SEnji Cooperfi 86b3af24b4SEnji Cooper 87b3af24b4SEnji Cooperecho "ok 4" 88