PageRenderTime 41ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/zfs-tests/tests/functional/cache/cache_010_neg.ksh

http://github.com/zfsonlinux/zfs
Korn Shell | 90 lines | 34 code | 14 blank | 42 comment | 3 complexity | 27d4d777842f5212c0c82710ddc8d828 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 2008 Sun Microsystems, Inc. All rights reserved.
  24. # Use is subject to license terms.
  25. #
  26. #
  27. # Copyright (c) 2013 by Delphix. All rights reserved.
  28. #
  29. . $STF_SUITE/tests/functional/cache/cache.cfg
  30. . $STF_SUITE/tests/functional/cache/cache.kshlib
  31. #
  32. # DESCRIPTION:
  33. # Verify cache device must be a block device.
  34. #
  35. # STRATEGY:
  36. # 1. Create a pool
  37. # 2. Add different object as cache
  38. # 3. Verify character devices and files fail
  39. #
  40. verify_runnable "global"
  41. function cleanup_testenv
  42. {
  43. cleanup
  44. if [[ -n $lofidev ]]; then
  45. log_must $LOFIADM -d $lofidev
  46. fi
  47. }
  48. log_assert "Cache device can only be block devices."
  49. log_onexit cleanup_testenv
  50. TESTVOL=testvol1$$
  51. dsk1=${DISKS%% *}
  52. log_must $ZPOOL create $TESTPOOL ${DISKS#$dsk1}
  53. if is_linux; then
  54. SLICE="p1"
  55. else
  56. SLICE="s0"
  57. fi
  58. # Add nomal ${DEV_RDSKDIR} device
  59. log_mustnot $ZPOOL add $TESTPOOL cache ${DEV_RDSKDIR}/${dsk1}${SLICE}
  60. #log_must verify_cache_device $TESTPOOL $dsk1 'ONLINE'
  61. # Add nomal file
  62. log_mustnot $ZPOOL add $TESTPOOL cache $VDEV2
  63. # Add /dev/rlofi device
  64. lofidev=${VDEV2%% *}
  65. log_must $LOFIADM -a $lofidev
  66. lofidev=$($LOFIADM $lofidev)
  67. log_mustnot $ZPOOL add $TESTPOOL cache "/dev/rlofi/${lofidev#/dev/lofi/}"
  68. if [[ -n $lofidev ]]; then
  69. log_must $LOFIADM -d $lofidev
  70. lofidev=""
  71. fi
  72. # Add ${ZVOL_RDEVDIR} device
  73. log_must $ZPOOL create $TESTPOOL2 $VDEV2
  74. log_must $ZFS create -V $SIZE $TESTPOOL2/$TESTVOL
  75. log_mustnot $ZPOOL add $TESTPOOL cache ${ZVOL_RDEVDIR}/$TESTPOOL2/$TESTVOL
  76. log_pass "Cache device can only be block devices."