PageRenderTime 75ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/sys/cddl/zfs/tests/no_space/enospc_001_pos.ksh

https://bitbucket.org/freebsd/freebsd-base
Korn Shell | 81 lines | 17 code | 10 blank | 54 comment | 4 complexity | 6a8b3674a7adf39b5b0606405a50ac11 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 "@(#)enospc_001_pos.ksh 1.2 07/01/09 SMI"
  28. #
  29. . $STF_SUITE/include/libtest.kshlib
  30. ################################################################################
  31. #
  32. # __stc_assertion_start
  33. #
  34. # ID: enospc_001
  35. #
  36. # DESCRIPTION:
  37. # ENOSPC is returned on an attempt to write a second file
  38. # to a file system after a first file was written that terminated
  39. # with ENOSPC on a cleanly initialized file system.
  40. #
  41. # STRATEGY:
  42. # 1. Write a file until the file system is full.
  43. # 2. Ensure that ENOSPC is returned.
  44. # 3. Write a second file while the file system remains full.
  45. # 4. Verify the return code is ENOSPC.
  46. #
  47. # TESTABILITY: explicit
  48. #
  49. # TEST_AUTOMATION_LEVEL: automated
  50. #
  51. # CODING_STATUS: COMPLETED (2005-07-04)
  52. #
  53. # __stc_assertion_end
  54. #
  55. ################################################################################
  56. verify_runnable "both"
  57. log_assert "ENOSPC is returned when file system is full."
  58. log_must $ZFS set compression=off $TESTPOOL/$TESTFS
  59. log_note "Writing file: $TESTFILE0 until ENOSPC."
  60. $FILE_WRITE -o create -f $TESTDIR/$TESTFILE0 -b $BLOCKSZ \
  61. -c $NUM_WRITES -d $DATA
  62. ret=$?
  63. (( $ret != $ENOSPC )) && \
  64. log_fail "$TESTFILE0 returned: $ret rather than ENOSPC."
  65. log_note "Write another file: $TESTFILE1 but expect ENOSPC."
  66. $FILE_WRITE -o create -f $TESTDIR/$TESTFILE1 -b $BLOCKSZ \
  67. -c $NUM_WRITES -d $DATA
  68. ret=$?
  69. (( $ret != $ENOSPC )) && \
  70. log_fail "$TESTFILE1 returned: $ret rather than ENOSPC."
  71. log_pass "ENOSPC returned as expected."