PageRenderTime 26ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_003_pos.ksh

http://github.com/zfsonlinux/zfs
Korn Shell | 69 lines | 21 code | 11 blank | 37 comment | 3 complexity | 5047d81cc788e18c22722f25c896bee2 MD5 | raw file
Possible License(s): Apache-2.0, MPL-2.0-no-copyleft-exception
  1. #!/bin/ksh -p
  2. #
  3. # CDDL HEADER START
  4. #
  5. # The contents of this file are subject to the terms of the
  6. # Common Development and Distribution License (the "License").
  7. # You may not use this file except in compliance with the License.
  8. #
  9. # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10. # or http://www.opensolaris.org/os/licensing.
  11. # See the License for the specific language governing permissions
  12. # and limitations under the License.
  13. #
  14. # When distributing Covered Code, include this CDDL HEADER in each
  15. # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16. # If applicable, add the following below this CDDL HEADER, with the
  17. # fields enclosed by brackets "[]" replaced with your own identifying
  18. # information: Portions Copyright [yyyy] [name of copyright owner]
  19. #
  20. # CDDL HEADER END
  21. #
  22. #
  23. # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
  24. # Use is subject to license terms.
  25. #
  26. #
  27. # Copyright (c) 2012, 2016 by Delphix. All rights reserved.
  28. #
  29. . $STF_SUITE/include/libtest.shlib
  30. . $STF_SUITE/tests/functional/cli_root/zfs_create/zfs_create.cfg
  31. #
  32. # DESCRIPTION:
  33. # 'zfs create [-b <blocksize>] -V <size> <volume>' can create a volume
  34. # with specified blocksize, which is power of 2 between 512 - 128k.
  35. #
  36. # STRATEGY:
  37. # 1. Create a volume with blocksize in the storage pool
  38. # 2. Verify the volume created successfully
  39. #
  40. verify_runnable "global"
  41. function cleanup
  42. {
  43. datasetexists $vol && \
  44. log_must zfs destroy -f $vol
  45. }
  46. log_assert "Verify creating volume with specified blocksize works."
  47. log_onexit cleanup
  48. set -A options "" "-b 1k" "-b 1K" "-b 1024" "-b 1024b"
  49. vol=$TESTPOOL/$TESTVOL
  50. typeset -i i=0
  51. while (( i < ${#options[*]} )); do
  52. log_must zfs create ${options[i]} -V $VOLSIZE $vol
  53. datasetexists $vol || \
  54. log_fail "zfs create ${options[i]} -V $VOLSIZE $vol fail."
  55. log_must_busy zfs destroy -f $vol
  56. ((i = i + 1))
  57. done
  58. log_pass "'zfs create [-b <blocksize>] -V <size> <volume>' works as expected."