/tests/sys/cddl/zfs/tests/history/history_004_pos.ksh

https://bitbucket.org/freebsd/freebsd-base · Korn Shell · 114 lines · 40 code · 22 blank · 52 comment · 3 complexity · 8b2fb4ac6ec3fbd10d4a72322cc2f719 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 2007 Sun Microsystems, Inc. All rights reserved.
  25. # Use is subject to license terms.
  26. #
  27. # ident "@(#)history_004_pos.ksh 1.2 07/01/09 SMI"
  28. #
  29. . $STF_SUITE/tests/history/history_common.kshlib
  30. #################################################################################
  31. #
  32. # __stc_assertion_start
  33. #
  34. # ID: history_004_pos
  35. #
  36. # DESCRIPTION:
  37. # 'zpool history' can copes with many simultaneous command.
  38. #
  39. # STRATEGY:
  40. # 1. Create test pool and test fs.
  41. # 2. Loop 100 times, set properties to test fs simultaneously.
  42. # 3. Wait for all the command execution complete.
  43. # 4. Make sure all the commands was logged by 'zpool history'.
  44. #
  45. # TESTABILITY: explicit
  46. #
  47. # TEST_AUTOMATION_LEVEL: automated
  48. #
  49. # CODING_STATUS: COMPLETED (2006-07-05)
  50. #
  51. # __stc_assertion_end
  52. #
  53. ################################################################################
  54. verify_runnable "global"
  55. log_assert "'zpool history' can copes with many simultaneous command."
  56. typeset -i orig_count=$($ZPOOL history $TESTPOOL | $WC -l | $AWK '{print $1}')
  57. typeset -i i=0
  58. while ((i < 10)); do
  59. $ZFS set compression=off $TESTPOOL/$TESTFS &
  60. $ZFS set atime=off $TESTPOOL/$TESTFS &
  61. $ZFS create $TESTPOOL/$TESTFS1 &
  62. $ZFS create $TESTPOOL/$TESTFS2 &
  63. $ZFS create $TESTPOOL/$TESTFS3 &
  64. wait
  65. $ZFS snapshot $TESTPOOL/$TESTFS1@snap &
  66. $ZFS snapshot $TESTPOOL/$TESTFS2@snap &
  67. $ZFS snapshot $TESTPOOL/$TESTFS3@snap &
  68. wait
  69. $ZFS clone $TESTPOOL/$TESTFS1@snap $TESTPOOL/clone1 &
  70. $ZFS clone $TESTPOOL/$TESTFS2@snap $TESTPOOL/clone2 &
  71. $ZFS clone $TESTPOOL/$TESTFS3@snap $TESTPOOL/clone3 &
  72. wait
  73. $ZFS promote $TESTPOOL/clone1 &
  74. $ZFS promote $TESTPOOL/clone2 &
  75. $ZFS promote $TESTPOOL/clone3 &
  76. wait
  77. $ZFS destroy $TESTPOOL/$TESTFS1 &
  78. $ZFS destroy $TESTPOOL/$TESTFS2 &
  79. $ZFS destroy $TESTPOOL/$TESTFS3 &
  80. wait
  81. $ZFS destroy -Rf $TESTPOOL/clone1 &
  82. $ZFS destroy -Rf $TESTPOOL/clone2 &
  83. $ZFS destroy -Rf $TESTPOOL/clone3 &
  84. wait
  85. ((i += 1))
  86. done
  87. typeset -i count=$($ZPOOL history $TESTPOOL | $WC -l | $AWK '{print $1}')
  88. if ((count - orig_count != 200)); then
  89. $ZPOOL history $spool
  90. log_fail "Expected 200 more than $orig_count entries, but got $count"
  91. fi
  92. log_pass "zpool history copes with simultaneous commands passed."