1# CDDL HEADER START 2# 3# The contents of this file are subject to the terms of the 4# Common Development and Distribution License (the "License"). 5# You may not use this file except in compliance with the License. 6# 7# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 8# or http://www.opensolaris.org/os/licensing. 9# See the License for the specific language governing permissions 10# and limitations under the License. 11# 12# When distributing Covered Code, include this CDDL HEADER in each 13# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 14# If applicable, add the following below this CDDL HEADER, with the 15# fields enclosed by brackets "[]" replaced with your own identifying 16# information: Portions Copyright [yyyy] [name of copyright owner] 17# 18# CDDL HEADER END 19# 20 21# $FreeBSD$ 22 23# 24# Copyright 2012 Spectra Logic. All rights reserved. 25# Use is subject to license terms. 26# 27 28 29atf_test_case zfs_mount_001_pos cleanup 30zfs_mount_001_pos_head() 31{ 32 atf_set "descr" "Verify that '$ZFS $mountcmd <filesystem>' succeeds as root." 33 atf_set "require.progs" zfs 34} 35zfs_mount_001_pos_body() 36{ 37 . $(atf_get_srcdir)/../../../include/default.cfg 38 . $(atf_get_srcdir)/zfs_mount.kshlib 39 . $(atf_get_srcdir)/zfs_mount.cfg 40 41 verify_disk_count "$DISKS" 1 42 if other_pools_exist; then 43 atf_skip "Can't test unmount -a with existing pools" 44 fi 45 46 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 47 ksh93 $(atf_get_srcdir)/zfs_mount_001_pos.ksh || atf_fail "Testcase failed" 48} 49zfs_mount_001_pos_cleanup() 50{ 51 . $(atf_get_srcdir)/../../../include/default.cfg 52 . $(atf_get_srcdir)/zfs_mount.kshlib 53 . $(atf_get_srcdir)/zfs_mount.cfg 54 55 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 56} 57 58 59atf_test_case zfs_mount_002_pos cleanup 60zfs_mount_002_pos_head() 61{ 62 atf_set "descr" "Verify that '$ZFS $mountcmd' with a filesystemwhose name is not in 'zfs list' will fail with return code 1." 63 atf_set "require.progs" zfs 64} 65zfs_mount_002_pos_body() 66{ 67 . $(atf_get_srcdir)/../../../include/default.cfg 68 . $(atf_get_srcdir)/zfs_mount.kshlib 69 . $(atf_get_srcdir)/zfs_mount.cfg 70 71 verify_disk_count "$DISKS" 1 72 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 73 ksh93 $(atf_get_srcdir)/zfs_mount_002_pos.ksh || atf_fail "Testcase failed" 74} 75zfs_mount_002_pos_cleanup() 76{ 77 . $(atf_get_srcdir)/../../../include/default.cfg 78 . $(atf_get_srcdir)/zfs_mount.kshlib 79 . $(atf_get_srcdir)/zfs_mount.cfg 80 81 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 82} 83 84 85atf_test_case zfs_mount_003_pos cleanup 86zfs_mount_003_pos_head() 87{ 88 atf_set "descr" "Verify that '$ZFS $mountcmd' with a filesystemwhose mountpoint property is 'legacy' or 'none' \will fail with return code 1." 89 atf_set "require.progs" zfs 90} 91zfs_mount_003_pos_body() 92{ 93 . $(atf_get_srcdir)/../../../include/default.cfg 94 . $(atf_get_srcdir)/zfs_mount.kshlib 95 . $(atf_get_srcdir)/zfs_mount.cfg 96 97 verify_disk_count "$DISKS" 1 98 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 99 ksh93 $(atf_get_srcdir)/zfs_mount_003_pos.ksh || atf_fail "Testcase failed" 100} 101zfs_mount_003_pos_cleanup() 102{ 103 . $(atf_get_srcdir)/../../../include/default.cfg 104 . $(atf_get_srcdir)/zfs_mount.kshlib 105 . $(atf_get_srcdir)/zfs_mount.cfg 106 107 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 108} 109 110 111atf_test_case zfs_mount_004_pos cleanup 112zfs_mount_004_pos_head() 113{ 114 atf_set "descr" "Verify that '$ZFS $mountcmd <filesystem>'with a mounted filesystem will fail with return code 1." 115 atf_set "require.progs" zfs 116} 117zfs_mount_004_pos_body() 118{ 119 . $(atf_get_srcdir)/../../../include/default.cfg 120 . $(atf_get_srcdir)/zfs_mount.kshlib 121 . $(atf_get_srcdir)/zfs_mount.cfg 122 123 verify_disk_count "$DISKS" 1 124 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 125 ksh93 $(atf_get_srcdir)/zfs_mount_004_pos.ksh || atf_fail "Testcase failed" 126} 127zfs_mount_004_pos_cleanup() 128{ 129 . $(atf_get_srcdir)/../../../include/default.cfg 130 . $(atf_get_srcdir)/zfs_mount.kshlib 131 . $(atf_get_srcdir)/zfs_mount.cfg 132 133 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 134} 135 136 137atf_test_case zfs_mount_005_pos cleanup 138zfs_mount_005_pos_head() 139{ 140 atf_set "descr" "Verify that '$ZFS $mountcmd' with a filesystemwhose mountpoint is currently in use will fail with return code 1." 141 atf_set "require.progs" zfs 142} 143zfs_mount_005_pos_body() 144{ 145 [[ `uname -s` = "FreeBSD" ]] && atf_skip "Unlike Illumos, FreeBSD allows the behavior the prohibition of which is tested by this testcase" 146 . $(atf_get_srcdir)/../../../include/default.cfg 147 . $(atf_get_srcdir)/zfs_mount.kshlib 148 . $(atf_get_srcdir)/zfs_mount.cfg 149 150 verify_disk_count "$DISKS" 1 151 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 152 ksh93 $(atf_get_srcdir)/zfs_mount_005_pos.ksh || atf_fail "Testcase failed" 153} 154zfs_mount_005_pos_cleanup() 155{ 156 . $(atf_get_srcdir)/../../../include/default.cfg 157 . $(atf_get_srcdir)/zfs_mount.kshlib 158 . $(atf_get_srcdir)/zfs_mount.cfg 159 160 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 161} 162 163 164atf_test_case zfs_mount_006_pos cleanup 165zfs_mount_006_pos_head() 166{ 167 atf_set "descr" "Verify that '$ZFS $mountcmd <filesystem>'which mountpoint be the identical or the top of an existing one \will fail with return code 1." 168 atf_set "require.progs" zfs 169} 170zfs_mount_006_pos_body() 171{ 172 [[ `uname -s` = "FreeBSD" ]] && atf_skip "Unlike Illumos, FreeBSD allows the behavior the prohibition of which is tested by this testcase" 173 . $(atf_get_srcdir)/../../../include/default.cfg 174 . $(atf_get_srcdir)/zfs_mount.kshlib 175 . $(atf_get_srcdir)/zfs_mount.cfg 176 177 verify_disk_count "$DISKS" 1 178 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 179 ksh93 $(atf_get_srcdir)/zfs_mount_006_pos.ksh || atf_fail "Testcase failed" 180} 181zfs_mount_006_pos_cleanup() 182{ 183 . $(atf_get_srcdir)/../../../include/default.cfg 184 . $(atf_get_srcdir)/zfs_mount.kshlib 185 . $(atf_get_srcdir)/zfs_mount.cfg 186 187 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 188} 189 190 191atf_test_case zfs_mount_007_pos cleanup 192zfs_mount_007_pos_head() 193{ 194 atf_set "descr" "Verify '-o' will set filesystem property temporarily,without affecting the property that is stored on disk." 195 atf_set "require.progs" zfs 196} 197zfs_mount_007_pos_body() 198{ 199 . $(atf_get_srcdir)/../../../include/default.cfg 200 . $(atf_get_srcdir)/zfs_mount.kshlib 201 . $(atf_get_srcdir)/zfs_mount.cfg 202 203 verify_disk_count "$DISKS" 1 204 atf_expect_fail "PR 115361 zfs get setuid doesn't reflect setuid state as set by zfs mount" 205 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 206 ksh93 $(atf_get_srcdir)/zfs_mount_007_pos.ksh || atf_fail "Testcase failed" 207} 208zfs_mount_007_pos_cleanup() 209{ 210 . $(atf_get_srcdir)/../../../include/default.cfg 211 . $(atf_get_srcdir)/zfs_mount.kshlib 212 . $(atf_get_srcdir)/zfs_mount.cfg 213 214 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 215} 216 217 218atf_test_case zfs_mount_008_pos cleanup 219zfs_mount_008_pos_head() 220{ 221 atf_set "descr" "Verify 'zfs mount -O' will override existing mount point." 222 atf_set "require.progs" zfs 223} 224zfs_mount_008_pos_body() 225{ 226 . $(atf_get_srcdir)/../../../include/default.cfg 227 . $(atf_get_srcdir)/zfs_mount.kshlib 228 . $(atf_get_srcdir)/zfs_mount.cfg 229 230 verify_disk_count "$DISKS" 1 231 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 232 ksh93 $(atf_get_srcdir)/zfs_mount_008_pos.ksh || atf_fail "Testcase failed" 233} 234zfs_mount_008_pos_cleanup() 235{ 236 . $(atf_get_srcdir)/../../../include/default.cfg 237 . $(atf_get_srcdir)/zfs_mount.kshlib 238 . $(atf_get_srcdir)/zfs_mount.cfg 239 240 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 241} 242 243 244atf_test_case zfs_mount_009_neg cleanup 245zfs_mount_009_neg_head() 246{ 247 atf_set "descr" "Badly-formed 'zfs $mountcmd' with inapplicable scenariosshould return an error." 248 atf_set "require.progs" zfs 249} 250zfs_mount_009_neg_body() 251{ 252 . $(atf_get_srcdir)/../../../include/default.cfg 253 . $(atf_get_srcdir)/zfs_mount.kshlib 254 . $(atf_get_srcdir)/zfs_mount.cfg 255 256 if other_pools_exist; then 257 atf_skip "Can't test unmount -a with existing pools" 258 fi 259 260 verify_disk_count "$DISKS" 1 261 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 262 ksh93 $(atf_get_srcdir)/zfs_mount_009_neg.ksh || atf_fail "Testcase failed" 263} 264zfs_mount_009_neg_cleanup() 265{ 266 . $(atf_get_srcdir)/../../../include/default.cfg 267 . $(atf_get_srcdir)/zfs_mount.kshlib 268 . $(atf_get_srcdir)/zfs_mount.cfg 269 270 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 271} 272 273 274atf_test_case zfs_mount_010_neg cleanup 275zfs_mount_010_neg_head() 276{ 277 atf_set "descr" "zfs mount fails with mounted filesystem or busy mountpoint" 278 atf_set "require.progs" zfs 279} 280zfs_mount_010_neg_body() 281{ 282 [[ `uname -s` = "FreeBSD" ]] && atf_skip "Unlike Illumos, FreeBSD allows the behavior the prohibition of which is tested by this testcase" 283 . $(atf_get_srcdir)/../../../include/default.cfg 284 . $(atf_get_srcdir)/zfs_mount.kshlib 285 . $(atf_get_srcdir)/zfs_mount.cfg 286 287 verify_disk_count "$DISKS" 1 288 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 289 ksh93 $(atf_get_srcdir)/zfs_mount_010_neg.ksh || atf_fail "Testcase failed" 290} 291zfs_mount_010_neg_cleanup() 292{ 293 . $(atf_get_srcdir)/../../../include/default.cfg 294 . $(atf_get_srcdir)/zfs_mount.kshlib 295 . $(atf_get_srcdir)/zfs_mount.cfg 296 297 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 298} 299 300 301atf_test_case zfs_mount_011_neg cleanup 302zfs_mount_011_neg_head() 303{ 304 atf_set "descr" "zfs mount fails with bad parameters" 305 atf_set "require.progs" zfs 306} 307zfs_mount_011_neg_body() 308{ 309 . $(atf_get_srcdir)/../../../include/default.cfg 310 . $(atf_get_srcdir)/zfs_mount.kshlib 311 . $(atf_get_srcdir)/zfs_mount.cfg 312 313 verify_disk_count "$DISKS" 1 314 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 315 ksh93 $(atf_get_srcdir)/zfs_mount_011_neg.ksh || atf_fail "Testcase failed" 316} 317zfs_mount_011_neg_cleanup() 318{ 319 . $(atf_get_srcdir)/../../../include/default.cfg 320 . $(atf_get_srcdir)/zfs_mount.kshlib 321 . $(atf_get_srcdir)/zfs_mount.cfg 322 323 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 324} 325 326 327atf_test_case zfs_mount_all_001_pos cleanup 328zfs_mount_all_001_pos_head() 329{ 330 atf_set "descr" "Verify that 'zfs $mountall' succeeds as root,and all available ZFS filesystems are mounted." 331 atf_set "require.progs" zfs 332} 333zfs_mount_all_001_pos_body() 334{ 335 . $(atf_get_srcdir)/../../../include/default.cfg 336 . $(atf_get_srcdir)/zfs_mount.kshlib 337 . $(atf_get_srcdir)/zfs_mount.cfg 338 339 if other_pools_exist; then 340 atf_skip "Can't test unmount -a with existing pools" 341 fi 342 343 verify_disk_count "$DISKS" 1 344 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 345 ksh93 $(atf_get_srcdir)/zfs_mount_all_001_pos.ksh || atf_fail "Testcase failed" 346} 347zfs_mount_all_001_pos_cleanup() 348{ 349 . $(atf_get_srcdir)/../../../include/default.cfg 350 . $(atf_get_srcdir)/zfs_mount.kshlib 351 . $(atf_get_srcdir)/zfs_mount.cfg 352 353 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 354} 355 356 357atf_init_test_cases() 358{ 359 360 atf_add_test_case zfs_mount_001_pos 361 atf_add_test_case zfs_mount_002_pos 362 atf_add_test_case zfs_mount_003_pos 363 atf_add_test_case zfs_mount_004_pos 364 atf_add_test_case zfs_mount_005_pos 365 atf_add_test_case zfs_mount_006_pos 366 atf_add_test_case zfs_mount_007_pos 367 atf_add_test_case zfs_mount_008_pos 368 atf_add_test_case zfs_mount_009_neg 369 atf_add_test_case zfs_mount_010_neg 370 atf_add_test_case zfs_mount_011_neg 371 atf_add_test_case zfs_mount_all_001_pos 372} 373