multiv01.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #! /bin/sh
  2. # This file is part of GNU tar testsuite.
  3. # Copyright (C) 2004 Free Software Foundation, Inc.
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2, or (at your option)
  8. # any later version.
  9. #
  10. # This program 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. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  18. # 02111-1307, USA.
  19. # Test multivolume dumps from pipes.
  20. . ./preset
  21. TAR_ARCHIVE_FORMATS="gnu oldgnu"
  22. . $srcdir/before
  23. # Fixme: should be configurable
  24. # TRUSS=truss -o /tmp/tr
  25. # TRUSS=strace
  26. set -e
  27. genfile --length 7168 > file1
  28. for block in " 1" " 2" " 3" " 4" " 5" " 6" " 7" " 8" \
  29. " 9" "10" "11" "12" "13" "14" "15" "16" ; do \
  30. echo "file2 block ${block} bla!bla!bla!bla!bla!bla!bla!bla!bla!bla!bla!bla"
  31. for count in 2 3 4 5 6 7 8 ; do
  32. echo "bla!bla!bla!bla!bla!bla!bla!bla!bla!bla!bla!bla!bla!bla!bla!bla"
  33. done
  34. done >file2
  35. tar -c --multi-volume --tape-length=10 \
  36. --listed-incremental=t.snar \
  37. -f t1-pipe.tar -f t2-pipe.tar ./file1 ./file2
  38. mkdir extract-dir-pipe
  39. dd bs=4096 count=10 if=t2-pipe.tar 2>/dev/null |
  40. PATH=$PATH ${TRUSS} tar -f t1-pipe.tar -f - \
  41. -C extract-dir-pipe -x --multi-volume \
  42. --tape-length=10 --read-full-records
  43. cmp file1 extract-dir-pipe/file1
  44. cmp file2 extract-dir-pipe/file2
  45. out="\
  46. "
  47. . $srcdir/after