listed02.at 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. # Test suite for GNU tar.
  3. # Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2, or (at your option)
  7. # any later version.
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. # You should have received a copy of the GNU General Public License
  13. # along with this program; if not, write to the Free Software
  14. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  15. # 02110-1301, USA.
  16. # Check if listed-incremental backups work for files moved from one directory
  17. # to another.
  18. # Based on a script by Martin Simmons <[email protected]>
  19. # References:
  20. # <20040626230315.163AA1D148@cpc5-cmbg1-6-0-cust208.cmbg.cable.ntl.com>
  21. # http://lists.gnu.org/archive/html/bug-tar/2004-06/msg00028.html
  22. AT_SETUP([working --listed])
  23. AT_KEYWORDS([listed incremental listed02])
  24. AT_TAR_CHECK([
  25. echo Create directories
  26. mkdir tart
  27. sleep 1
  28. mkdir tart/c0
  29. sleep 1
  30. mkdir tart/c1
  31. sleep 1
  32. for file in tart/a1 tart/b1 tart/c0/cq1 tart/c0/cq2 tart/c1/ca1 tart/c1/ca2
  33. do
  34. echo File $file > $file
  35. sleep 1
  36. done
  37. sleep 1
  38. echo Creating main archive
  39. tar -c -v --listed-incremental=tart.incr1 -f archive.1 tart 2> err || exit 1
  40. # The above prints two lines to stderr announcing the new directories c0 and c1.
  41. # Ensure that they appear in this script's stderr in sorted order.
  42. sort err 1>&2 2>/dev/null; rm -f err
  43. sleep 1
  44. echo Modifying filesystem
  45. rm tart/a1
  46. mv tart/b1 tart/b2
  47. mv tart/c1 tart/c2
  48. touch tart/c2/ca3
  49. echo Directory contents
  50. find tart -print | sort 2>/dev/null
  51. sleep 1
  52. echo Creating incremental archive
  53. cp -p tart.incr1 tart.incr2
  54. tar -c -v --listed-incremental=tart.incr2 -f archive.2 tart || exit 1
  55. sleep 1
  56. rm -rf tart/*
  57. echo Extracting main archive
  58. tar -x -v --listed-incremental=tart.incr1 -f archive.1 || exit 1
  59. echo Extracting incremental archive
  60. # This command should produce three messages about deletion
  61. # of the existing files, that may appear in any order. Piping
  62. # to sort makes sure we don't depend on any particular ordering.
  63. tar -x -v --listed-incremental=tart.incr2 -f archive.2 | sort 2>/dev/null
  64. echo Final files:
  65. find tart -print | sort 2>/dev/null
  66. ],
  67. [0],
  68. [Create directories
  69. Creating main archive
  70. tart/
  71. tart/c0/
  72. tart/c1/
  73. tart/a1
  74. tart/b1
  75. tart/c0/cq1
  76. tart/c0/cq2
  77. tart/c1/ca1
  78. tart/c1/ca2
  79. Modifying filesystem
  80. Directory contents
  81. tart
  82. tart/b2
  83. tart/c0
  84. tart/c0/cq1
  85. tart/c0/cq2
  86. tart/c2
  87. tart/c2/ca1
  88. tart/c2/ca2
  89. tart/c2/ca3
  90. Creating incremental archive
  91. tart/
  92. tart/c0/
  93. tart/c2/
  94. tart/b2
  95. tart/c2/ca1
  96. tart/c2/ca2
  97. tart/c2/ca3
  98. Extracting main archive
  99. tart/
  100. tart/c0/
  101. tart/c1/
  102. tart/a1
  103. tart/b1
  104. tart/c0/cq1
  105. tart/c0/cq2
  106. tart/c1/ca1
  107. tart/c1/ca2
  108. Extracting incremental archive
  109. tar: Deleting `tart/a1'
  110. tar: Deleting `tart/b1'
  111. tar: Deleting `tart/c1'
  112. tart/
  113. tart/b2
  114. tart/c0/
  115. tart/c2/
  116. tart/c2/ca1
  117. tart/c2/ca2
  118. tart/c2/ca3
  119. Final files:
  120. tart
  121. tart/b2
  122. tart/c0
  123. tart/c0/cq1
  124. tart/c0/cq2
  125. tart/c2
  126. tart/c2/ca1
  127. tart/c2/ca2
  128. tart/c2/ca3
  129. ],
  130. [tar: tart/c0: Directory is new
  131. tar: tart/c1: Directory is new
  132. tar: tart/c2: Directory is new
  133. ],
  134. [],[],[gnu, oldgnu])
  135. AT_CLEANUP