PageRenderTime 32ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_001_neg.ksh

http://github.com/zfsonlinux/zfs
Korn Shell | 73 lines | 25 code | 10 blank | 38 comment | 1 complexity | 056f296c78fc46a3af7b7de18745531e 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) 2012 by Delphix. All rights reserved.
  28. #
  29. . $STF_SUITE/include/libtest.shlib
  30. #
  31. # DESCRIPTION:
  32. # A badly formed parameter passed to zdb(1) should
  33. # return an error.
  34. #
  35. # STRATEGY:
  36. # 1. Create an array containg bad zdb parameters.
  37. # 2. For each element, execute the sub-command.
  38. # 3. Verify it returns an error.
  39. #
  40. verify_runnable "global"
  41. set -A args "create" "add" "destroy" "import fakepool" \
  42. "export fakepool" "create fakepool" "add fakepool" \
  43. "create mirror" "create raidz" \
  44. "create mirror fakepool" "create raidz fakepool" \
  45. "create raidz1 fakepool" "create raidz2 fakepool" \
  46. "create fakepool mirror" "create fakepool raidz" \
  47. "create fakepool raidz1" "create fakepool raidz2" \
  48. "add fakepool mirror" "add fakepool raidz" \
  49. "add fakepool raidz1" "add fakepool raidz2" \
  50. "add mirror fakepool" "add raidz fakepool" \
  51. "add raidz1 fakepool" "add raidz2 fakepool" \
  52. "setvprop" "blah blah" "-%" "--?" "-*" "-=" \
  53. "-a" "-f" "-g" "-h" "-j" "-k" "-m" "-n" "-o" "-p" "-p /tmp" \
  54. "-q" "-r" "-t" "-w" "-x" "-y" "-z" \
  55. "-D" "-E" "-G" "-H" "-I" "-J" "-K" "-M" \
  56. "-N" "-Q" "-R" "-S" "-W" "-Y" "-Z"
  57. log_assert "Execute zdb using invalid parameters."
  58. typeset -i i=0
  59. while [[ $i -lt ${#args[*]} ]]; do
  60. log_mustnot $ZDB ${args[i]}
  61. ((i = i + 1))
  62. done
  63. log_pass "Badly formed zdb parameters fail as expected."