multiv01.sh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #! /bin/sh
  2. # Test multivolume dumps from pipes.
  3. # This file is part of GNU tar testsuite.
  4. # Copyright (C) 2004 Free Software Foundation, Inc.
  5. #
  6. # This program 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 2, or (at your option)
  9. # any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  19. # 02111-1307, USA.
  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