10 echo "Usage: `basename $0` [unpack]<[smbfs][snapshot][all]>"
19 current
=`zfs get -H $type -o value $dataset`
20 if [ "$current" != "$toggle" ]; then
21 run
"zfs set $type=$toggle $dataset"
29 [ -n "$2" ] && extra
="$2"
31 zfs get all
"$dataset" > /dev
/null
2>&1
33 run
"zfs create $extra $dataset"
38 if [ "$TEST_SMBFS" == "1" ]; then
40 echo "=> usershare list:"
43 echo "=> /etc/dfs/sharetab:"
53 echo "======================================"
65 if echo "$*" |
grep -qi "unpack"; then
68 run
"zfs destroy -r $BASETANK/tests"
70 sh
/etc
/init.d
/zfs stop
72 # for tid in `grep ^tid /proc/net/iet/volume | sed "s@.*:\([0-9].*\) name.*@\1@"`
74 # ietadm --op delete --tid $tid
78 rmmod
`lsmod | grep ^z | grep -v zlib_deflate | sed 's@ .*@@'` spl zlib_deflate
81 [ -f "tmp/zfs.tgz" ] && tar xzf tmp
/zfs.tgz
&& rm tmp
/zfs.tgz
82 [ -f "tmp/spl.tgz" ] && tar xzf tmp
/spl.tgz
&& rm tmp
/spl.tgz
87 sh
/etc
/init.d
/zfs start
92 if echo "$*" |
egrep -qi "smbfs|all"; then
93 check_exists
$BASETANK/tests
97 test_header
"Exists || Create"
99 for volnr
in 1 2 3; do
100 check_exists
$BASETANK/tests
/smbfs
$volnr
102 str
="$str $BASETANK/tests/smbfs$volnr"
104 run
"zfs get sharesmb $str"
107 test_header
"Enable SMB share"
108 for volnr
in 1 2 3; do
109 set_onoff sharesmb
"$BASETANK/tests/smbfs$volnr" on
114 test_header
"Share all (individually)"
115 for volnr
in 1 2 3; do
116 run
"zfs share $BASETANK/tests/smbfs$volnr"
121 test_header
"Unshare all (individually)"
122 for volnr
in 1 2 3; do
123 run
"zfs unshare $BASETANK/tests/smbfs$volnr"
127 # Change mountpoint - first unshare and then share individual
128 test_header
"Change mount point (unshare ; share)"
130 set_onoff sharesmb
"$str" off
131 for volnr
in 3 1 2; do
132 run
"zfs set mountpoint=/tests/smbfs$volnr $BASETANK/tests/smbfs$volnr"
133 echo "CMD: mount | grep ^$BASETANK/tests/smbfs$volnr"
134 mount |
grep ^
$BASETANK/tests
/smbfs
$volnr
137 run
"zfs mount $BASETANK/tests/smbfs$volnr"
138 echo "CMD: mount | grep ^$BASETANK/tests/smbfs$volnr"
139 mount |
grep ^
$BASETANK/tests
/smbfs
$volnr
142 set_onoff sharesmb
"$BASETANK/tests/smbfs$volnr" on
145 run
"zfs share $BASETANK/tests/smbfs$volnr"
148 echo "-------------------"
151 # Change mountpoint - remounting
152 test_header
"Change mount point (remounting)"
153 for volnr
in 3 1 2; do
154 run
"zfs set mountpoint=/$BASETANK/tests/smbfs$volnr $BASETANK/tests/smbfs$volnr"
155 echo "CMD: mount | grep ^$BASETANK/tests/smbfs$volnr"
156 mount |
grep ^
$BASETANK/tests
/smbfs
$volnr
158 # => Doesn't seem to remount (!?)
160 run
"zfs mount $BASETANK/tests/smbfs$volnr"
161 echo "CMD: mount | grep ^$BASETANK/tests/smbfs$volnr"
162 mount |
grep ^
$BASETANK/tests
/smbfs
$volnr
164 # => Doesn't seem to reshare (!?)
168 run
"zfs share $BASETANK/tests/smbfs$volnr"
171 echo "-------------------"
176 if echo "$*" |
egrep -qi "smbfs|all"; then
177 test_header
"Unshare + Share all"
179 run
"zfs share -a" ; check_shares
180 run
"zfs unshare -a" ; check_shares
184 if echo "$*" |
grep -qi "snapshot|all"; then
185 test_header
"Snapshots"
187 echo ; echo "-------------------"
188 check_exists
$BASETANK/tests
/destroy
189 check_exists
$BASETANK/tests
/destroy
/destroy1
190 run
"zfs destroy -r $BASETANK/tests/destroy"
192 echo ; echo "-------------------"
193 check_exists
$BASETANK/tests
/destroy
194 run
"zfs snapshot $BASETANK/tests/destroy@$DATE"
195 run
"zfs destroy -r $BASETANK/tests/destroy"
197 echo ; echo "-------------------"
198 check_exists
$BASETANK/tests
/destroy
199 run
"zfs snapshot $BASETANK/tests/destroy@$DATE"
200 run
"zfs destroy -r $BASETANK/tests/destroy@$DATE"
201 run
"zfs destroy -r $BASETANK/tests/destroy"
204 if echo "$*" |
egrep -qi "smbfs|snapshot|all"; then
205 test_header
"Cleanup (Share all + Destroy all)"
210 run
"zfs destroy -r $BASETANK/tests"