PageRenderTime 43ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/zfs-tests/tests/functional/features/large_dnode/large_dnode_005_pos.ksh

http://github.com/zfsonlinux/zfs
Korn Shell | 80 lines | 42 code | 13 blank | 25 comment | 4 complexity | 1942727b9f90f153f34eb57e97778e24 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 (c) 2016 by Lawrence Livermore National Security, LLC.
  24. # Use is subject to license terms.
  25. #
  26. . $STF_SUITE/include/libtest.shlib
  27. verify_runnable "both"
  28. TEST_SEND_FS=$TESTPOOL/send_large_dnode
  29. TEST_RECV_FS=$TESTPOOL/recv_large_dnode
  30. TEST_SNAP=$TEST_SEND_FS@ldnsnap
  31. TEST_SNAPINCR=$TEST_SEND_FS@ldnsnap_incr
  32. TEST_STREAM=$TESTDIR/ldnsnap
  33. TEST_STREAMINCR=$TESTDIR/ldnsnap_incr
  34. TEST_FILE=foo
  35. TEST_FILEINCR=bar
  36. function cleanup
  37. {
  38. if datasetexists $TEST_SEND_FS ; then
  39. log_must zfs destroy -r $TEST_SEND_FS
  40. fi
  41. if datasetexists $TEST_RECV_FS ; then
  42. log_must zfs destroy -r $TEST_RECV_FS
  43. fi
  44. rm -f $TEST_STREAM
  45. rm -f $TEST_STREAMINCR
  46. }
  47. log_onexit cleanup
  48. log_assert "zfs send stream with large dnodes accepted by new pool"
  49. log_must zfs create -o dnodesize=1k $TEST_SEND_FS
  50. log_must touch /$TEST_SEND_FS/$TEST_FILE
  51. log_must zfs snap $TEST_SNAP
  52. log_must zfs send $TEST_SNAP > $TEST_STREAM
  53. log_must rm -f /$TEST_SEND_FS/$TEST_FILE
  54. log_must touch /$TEST_SEND_FS/$TEST_FILEINCR
  55. log_must zfs snap $TEST_SNAPINCR
  56. log_must zfs send -i $TEST_SNAP $TEST_SNAPINCR > $TEST_STREAMINCR
  57. log_must eval "zfs recv $TEST_RECV_FS < $TEST_STREAM"
  58. inode=$(ls -li /$TEST_RECV_FS/$TEST_FILE | awk '{print $1}')
  59. dnsize=$(zdb -dddd $TEST_RECV_FS $inode | awk '/ZFS plain file/ {print $6}')
  60. if [[ "$dnsize" != "1K" ]]; then
  61. log_fail "dnode size is $dnsize (expected 1K)"
  62. fi
  63. log_must eval "zfs recv -F $TEST_RECV_FS < $TEST_STREAMINCR"
  64. log_must diff -r /$TEST_SEND_FS /$TEST_RECV_FS
  65. log_must zfs umount $TEST_SEND_FS
  66. log_must zfs umount $TEST_RECV_FS
  67. log_pass