03.sh revision 197436
1132956Smarkm#!/bin/sh
2132956Smarkm#
3132956Smarkm# Copyright (c) 2008, 2009 Edward Tomasz Napiera��a <trasz@FreeBSD.org>
4132956Smarkm# All rights reserved.
5132956Smarkm#
6132956Smarkm# Redistribution and use in source and binary forms, with or without
7132956Smarkm# modification, are permitted provided that the following conditions
8132956Smarkm# are met:
9132956Smarkm# 1. Redistributions of source code must retain the above copyright
10132956Smarkm#    notice, this list of conditions and the following disclaimer.
11132956Smarkm# 2. Redistributions in binary form must reproduce the above copyright
12132956Smarkm#    notice, this list of conditions and the following disclaimer in the
13132956Smarkm#    documentation and/or other materials provided with the distribution.
14132956Smarkm#
15132956Smarkm# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16132956Smarkm# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17132956Smarkm# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18132956Smarkm# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19132956Smarkm# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20132956Smarkm# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21132956Smarkm# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22132956Smarkm# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23132956Smarkm# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24132956Smarkm# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25132956Smarkm# SUCH DAMAGE.
26132956Smarkm#
27132956Smarkm# $FreeBSD: head/tools/regression/acltools/03.t 197436 2009-09-23 15:12:20Z trasz $
28132956Smarkm#
29132956Smarkm
30132956Smarkm# This is a wrapper script to run tools-crossfs.test between UFS without
31132956Smarkm# ACLs, UFS with POSIX.1e ACLs, and ZFS with NFSv4 ACLs.
32132956Smarkm#
33132956Smarkm# WARNING: It uses hardcoded ZFS pool name "acltools"
34207329Sattilio#
35132956Smarkm# Output should be obvious.
36132956Smarkm
37132956Smarkmecho "1..5"
38207329Sattilio
39132956Smarkmif [ `whoami` != "root" ]; then
40132956Smarkm	echo "not ok 1 - you need to be root to run this test."
41132956Smarkm	exit 1
42132956Smarkmfi
43132956Smarkm
44132956SmarkmTESTDIR=`dirname $0`
45132956SmarkmMNTROOT=`mktemp -dt acltools`
46207329Sattilio
47132956Smarkm# Set up the test filesystems.
48207329SattilioMD1=`mdconfig -at swap -s 64m`
49132956SmarkmMNT1=$MNTROOT/nfs4
50132956Smarkmmkdir $MNT1
51132956Smarkmzpool create -R $MNT1 acltools /dev/$MD1
52202097Smarcelif [ $? -ne 0 ]; then
53202097Smarcel	echo "not ok 1 - 'zpool create' failed."
54202097Smarcel	exit 1
55207329Sattiliofi
56202097Smarcel
57202097Smarcelecho "ok 1"
58207329Sattilio
59202097SmarcelMD2=`mdconfig -at swap -s 10m`
60MNT2=$MNTROOT/posix
61mkdir $MNT2
62newfs /dev/$MD2 > /dev/null
63mount -o acls /dev/$MD2 $MNT2
64if [ $? -ne 0 ]; then
65	echo "not ok 2 - mount failed."
66	exit 1
67fi
68
69echo "ok 2"
70
71MD3=`mdconfig -at swap -s 10m`
72MNT3=$MNTROOT/none
73mkdir $MNT3
74newfs /dev/$MD3 > /dev/null
75mount /dev/$MD3 $MNT3
76if [ $? -ne 0 ]; then
77	echo "not ok 3 - mount failed."
78	exit 1
79fi
80
81echo "ok 3"
82
83cd $MNTROOT
84
85perl $TESTDIR/run $TESTDIR/tools-crossfs.test > /dev/null
86
87if [ $? -eq 0 ]; then
88	echo "ok 4"
89else
90	echo "not ok 4"
91fi
92
93cd /
94
95umount -f $MNT3
96rmdir $MNT3
97mdconfig -du $MD3
98
99umount -f $MNT2
100rmdir $MNT2
101mdconfig -du $MD2
102
103zpool destroy -f acltools
104rmdir $MNT1
105mdconfig -du $MD1
106
107rmdir $MNTROOT
108
109echo "ok 5"
110
111