sparse06.at 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. #
  3. # Test suite for GNU tar.
  4. # Copyright 2014-2023 Free Software Foundation, Inc.
  5. # This file is part of GNU tar.
  6. # GNU tar is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 3 of the License, or
  9. # (at your option) any later version.
  10. # GNU tar is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. AT_SETUP([storing sparse file using seek method])
  17. AT_KEYWORDS([sparse sparse06 chdir])
  18. m4_define([check_pattern],[
  19. rm -rf out archive.tar smallsparse && mkdir out
  20. genfile --sparse --quiet --file smallsparse $1 || AT_SKIP_TEST
  21. tar -cSf archive.tar smallsparse
  22. tar -xf archive.tar -C out
  23. cmp smallsparse out/smallsparse
  24. ])
  25. AT_TAR_CHECK([
  26. AT_SEEKHOLE_PREREQ
  27. TAR_OPTIONS="$TAR_OPTIONS --hole-detection=seek"
  28. genfile --sparse --file bigsparse 0 ABC 8G DEF || AT_SKIP_TEST
  29. tar -cSf a bigsparse
  30. test $? -eq 0 || exit 1
  31. check_pattern([0 ABC])
  32. check_pattern([0 ABC 10M])
  33. check_pattern([0 ABC 10M DEF])
  34. check_pattern([10M])
  35. check_pattern([10M ABC])
  36. check_pattern([10M ABC 20M])
  37. check_pattern([10M DEF 20M GHI 30M JKL 40M])
  38. ],
  39. [0],,
  40. [],,,[posix])
  41. AT_CLEANUP