PageRenderTime 49ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/sys/cddl/zfs/tests/userquota/userquota_005_neg.ksh

https://bitbucket.org/freebsd/freebsd-base
Korn Shell | 108 lines | 38 code | 19 blank | 51 comment | 4 complexity | e3726cd61fdefb9e0be7ade9ae8155aa MD5 | raw file
  1. #!/usr/local/bin/ksh93 -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. # $FreeBSD$
  23. #
  24. # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
  25. # Use is subject to license terms.
  26. #
  27. # ident "@(#)userquota_005_neg.ksh 1.1 09/06/22 SMI"
  28. #
  29. ################################################################################
  30. #
  31. # __stc_assertion_start
  32. #
  33. # ID: userquota_005_neg
  34. #
  35. # DESCRIPTION:
  36. # Check the invalid parameter of zfs set user|group quota
  37. #
  38. #
  39. # STRATEGY:
  40. # 1. check the invalid zfs set user|group quota to fs
  41. # 1. check the valid zfs set user|group quota to snapshots
  42. #
  43. # TESTABILITY: explicit
  44. #
  45. # TEST_AUTOMATION_LEVEL: automated
  46. #
  47. # CODING STATUS: COMPLETED (2009-04-16)
  48. #
  49. # __stc_assertion_end
  50. #
  51. ###############################################################################
  52. . $STF_SUITE/include/libtest.kshlib
  53. . $STF_SUITE/tests/userquota/userquota_common.kshlib
  54. function cleanup
  55. {
  56. if datasetexists $snap_fs; then
  57. log_must $ZFS destroy $snap_fs
  58. fi
  59. log_must cleanup_quota
  60. }
  61. log_onexit cleanup
  62. log_assert "Check the invalid parameter of zfs set user|group quota"
  63. typeset snap_fs=$QFS@snap
  64. log_must $ZFS snapshot $snap_fs
  65. set -A no_users "mms1234" "ss@#" "root-122"
  66. for user in "${no_users[@]}"; do
  67. log_mustnot $ID $user
  68. log_mustnot $ZFS set userquota@$user=100m $QFS
  69. done
  70. log_note "can set all numberic id even that id is not existed"
  71. log_must $ZFS set userquota@12345678=100m $QFS
  72. log_mustnot $ZFS set userquota@12345678=100m $snap_fs
  73. set -A sizes "100mfsd" "m0.12m" "GGM" "-1234-m" "123m-m"
  74. for size in "${sizes[@]}"; do
  75. log_note "can not set user quota with invalid size parameter"
  76. log_mustnot $ZFS set userquota@root=$size $QFS
  77. done
  78. log_note "can not set user quota to snapshot $snap_fs"
  79. log_mustnot $ZFS set userquota@root=100m $snap_fs
  80. set -A no_groups "aidsf@dfsd@" "123223-dsfds#sdfsd" "mss_#ss" "@@@@"
  81. for group in "${no_groups[@]}"; do
  82. log_mustnot eval "$GREP $group /etc/group"
  83. log_mustnot $ZFS set groupquota@$group=100m $QFS
  84. done
  85. log_note "can not set group quota with invalid size parameter"
  86. log_mustnot $ZFS set groupquota@root=100msfsd $QFS
  87. log_note "can not set group quota to snapshot $snap_fs"
  88. log_mustnot $ZFS set groupquota@root=100m $snap_fs
  89. log_pass "Check the invalid parameter of zfs set user|group quota pas as expect"