03.sh revision 288680
11539Srgrimes#!/bin/sh
21539Srgrimes#
31539Srgrimes# Copyright (c) 2008, 2009 Edward Tomasz Napiera��a <trasz@FreeBSD.org>
41539Srgrimes# All rights reserved.
51539Srgrimes#
61539Srgrimes# Redistribution and use in source and binary forms, with or without
71539Srgrimes# modification, are permitted provided that the following conditions
81539Srgrimes# are met:
91539Srgrimes# 1. Redistributions of source code must retain the above copyright
101539Srgrimes#    notice, this list of conditions and the following disclaimer.
111539Srgrimes# 2. Redistributions in binary form must reproduce the above copyright
121539Srgrimes#    notice, this list of conditions and the following disclaimer in the
13203964Simp#    documentation and/or other materials provided with the distribution.
141539Srgrimes#
151539Srgrimes# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
161539Srgrimes# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
171539Srgrimes# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
181539Srgrimes# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
191539Srgrimes# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
201539Srgrimes# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
211539Srgrimes# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
221539Srgrimes# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
231539Srgrimes# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
241539Srgrimes# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
251539Srgrimes# SUCH DAMAGE.
261539Srgrimes#
271539Srgrimes# $FreeBSD: user/ngie/more-tests/tests/sys/acl/03.sh 288680 2015-10-05 00:55:16Z ngie $
281539Srgrimes#
2923657Speter
3055031Sbde# This is a wrapper script to run tools-crossfs.test between UFS without
311539Srgrimes# ACLs, UFS with POSIX.1e ACLs, and ZFS with NFSv4 ACLs.
321539Srgrimes#
331539Srgrimes# WARNING: It uses hardcoded ZFS pool name "acltools"
347865Sbde#
351539Srgrimes# Output should be obvious.
3633861Sbde
37123257Smarcelif ! sysctl vfs.zfs.version.spa >/dev/null 2>&1; then
38102227Smike	echo "1..0 # SKIP system doesn't have ZFS loaded"
3933861Sbde	exit 0
40103728Swollmanfi
41102227Smikeif [ $(id -u) -ne 0 ]; then
42102227Smike	echo "1..0 # SKIP you must be root"
43102227Smike	exit 0
4415483Sbdefi
4515483Sbde
4615483Sbdeecho "1..5"
47102227Smike
48102227SmikeTESTDIR=$(dirname $(realpath $0))
49102227SmikeMNTROOT=`mktemp -dt acltools`
501539Srgrimes
511539Srgrimes# Set up the test filesystems.
5299640SobrienMD1=`mdconfig -at swap -s 64m`
53102227SmikeMNT1=$MNTROOT/nfs4
54264496Stijlmkdir $MNT1
55102227Smikezpool create -m $MNT1 acltools /dev/$MD1
561539Srgrimesif [ $? -ne 0 ]; then
5799640Sobrien	echo "not ok 1 - 'zpool create' failed."
581539Srgrimes	echo 'Bail out!'
591539Srgrimes	exit 1
60103766Sbdefi
61103766Sbde
621539Srgrimesecho "ok 1"
631539Srgrimes
641539SrgrimesMD2=`mdconfig -at swap -s 10m`
65103766SbdeMNT2=$MNTROOT/posix
66103766Sbdemkdir $MNT2
671539Srgrimesnewfs /dev/$MD2 > /dev/null
681539Srgrimesmount -o acls /dev/$MD2 $MNT2
691539Srgrimesif [ $? -ne 0 ]; then
701539Srgrimes	echo "not ok 2 - mount failed."
711539Srgrimes	echo 'Bail out!'
72252608Sache	exit 1
731539Srgrimesfi
74227753Stheraven
75233600Stheravenecho "ok 2"
76233600Stheraven
77233600StheravenMD3=`mdconfig -at swap -s 10m`
781539SrgrimesMNT3=$MNTROOT/none
79227753Stheravenmkdir $MNT3
80227753Stheravennewfs /dev/$MD3 > /dev/null
811539Srgrimesmount /dev/$MD3 $MNT3
82228330Stheravenif [ $? -ne 0 ]; then
8393032Simp	echo "not ok 3 - mount failed."
8493032Simp	echo 'Bail out!'
8593032Simp	exit 1
8693032Simpfi
8793032Simp
8893032Simpecho "ok 3"
8993032Simp
90187961Sdascd $MNTROOT
9193032Simp
92228330Stheravenperl $TESTDIR/run $TESTDIR/tools-crossfs.test > /dev/null
9393032Simp
9493032Simpif [ $? -eq 0 ]; then
9593032Simp	echo "ok 4"
9693032Simpelse
97187961Sdas	echo "not ok 4"
98103728Swollmanfi
99103766Sbde
100103728Swollmancd /
10193032Simp
10293032Simpumount -f $MNT3
10393032Simprmdir $MNT3
10493032Simpmdconfig -du $MD3
10593032Simp
106103766Sbdeumount -f $MNT2
107112163Sdasrmdir $MNT2
108103766Sbdemdconfig -du $MD2
109112163Sdas
110112163Sdaszpool destroy -f acltools
1111539Srgrimesrmdir $MNT1
112103012Stjrmdconfig -du $MD1
11393032Simp
11493032Simprmdir $MNTROOT
115103012Stjr
1161539Srgrimesecho "ok 5"
117103728Swollman
118103728Swollman