PageRenderTime 480ms CodeModel.GetById 40ms RepoModel.GetById 40ms app.codeStats 0ms

/tests/sys/cddl/zfs/tests/cli_root/zfs_rollback/zfs_rollback_003_neg.ksh

https://bitbucket.org/freebsd/freebsd-base
Korn Shell | 98 lines | 37 code | 7 blank | 54 comment | 2 complexity | a8dd7125682c76d91f34f1cc1ef4afda 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 2008 Sun Microsystems, Inc. All rights reserved.
  25. # Use is subject to license terms.
  26. #
  27. # ident "@(#)zfs_rollback_003_neg.ksh 1.5 08/08/15 SMI"
  28. #
  29. . $STF_SUITE/include/libtest.kshlib
  30. . $STF_SUITE/tests/cli_root/zfs_rollback/zfs_rollback_common.kshlib
  31. #################################################################################
  32. #
  33. # __stc_assertion_start
  34. #
  35. # ID: zfs_rollback_003_neg
  36. #
  37. # DESCRIPTION:
  38. # Separately verify 'zfs rollback ''|-f|-r|-rf|-R|-rR will fail in
  39. # different conditions.
  40. #
  41. # STRATEGY:
  42. # 1. Create pool and file system
  43. # 2. Create 'snap' and 'snap1' of this file system.
  44. # 3. Run 'zfs rollback ""|-f <snap>' and it should fail.
  45. # 4. Create 'clone1' based on 'snap1'.
  46. # 5. Run 'zfs rollback -r|-rf <snap>' and it should fail.
  47. #
  48. # TESTABILITY: explicit
  49. #
  50. # TEST_AUTOMATION_LEVEL: automated
  51. #
  52. # CODING_STATUS: COMPLETED (2005-07-20)
  53. #
  54. # __stc_assertion_end
  55. #
  56. ################################################################################
  57. verify_runnable "both"
  58. function cleanup
  59. {
  60. $PKILL ${DD##*/}
  61. for snap in $FSSNAP0 $FSSNAP1 $FSSNAP2; do
  62. if snapexists $snap; then
  63. log_must $ZFS destroy -Rf $snap
  64. fi
  65. done
  66. }
  67. log_assert "Separately verify 'zfs rollback ''|-f|-r|-rf will fail in " \
  68. "different conditions."
  69. log_onexit cleanup
  70. # Create snapshot1 and snapshot2 for this file system.
  71. #
  72. create_snapshot $TESTPOOL/$TESTFS $TESTSNAP
  73. create_snapshot $TESTPOOL/$TESTFS $TESTSNAP1
  74. # Run 'zfs rollback ""|-f <snap>' and it should fail.
  75. #
  76. log_mustnot $ZFS rollback $TESTPOOL/$TESTFS@$TESTSNAP
  77. log_mustnot $ZFS rollback -f $TESTPOOL/$TESTFS@$TESTSNAP
  78. # Create 'clone1' based on 'snap1'.
  79. #
  80. create_clone $TESTPOOL/$TESTFS@$TESTSNAP1 $TESTPOOL/$TESTCLONE1
  81. # Run 'zfs rollback -r|-rf <snap>' and it should fail.
  82. #
  83. log_mustnot $ZFS rollback -r $TESTPOOL/$TESTFS@$TESTSNAP
  84. log_mustnot $ZFS rollback -rf $TESTPOOL/$TESTFS@$TESTSNAP
  85. log_pass "zfs rollback ''|-f|-r|-rf will fail in different conditions " \
  86. "passed."