listed02.at 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. # Test suite for GNU tar.
  3. # Copyright (C) 2004 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([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 || exit 1
  40. sleep 1
  41. echo Modifying filesystem
  42. rm tart/a1
  43. # Current incremental backup algorithm is not able to cope with
  44. # renamed files on filesystems that do not change ctime when
  45. # renaming. So, if we're on such filesystem, we skip this test.
  46. CTIME=`genfile --stat=ctime tart/b1`
  47. mv tart/b1 tart/b2
  48. if test $CTIME -eq `genfile --stat=ctime tart/b2`; then
  49. AT_SKIP_TEST
  50. fi
  51. #
  52. mv tart/c1 tart/c2
  53. touch tart/c2/ca3
  54. echo Directory contents
  55. find tart -print | sort 2>/dev/null
  56. sleep 1
  57. echo Creating incremental archive
  58. cp -p tart.incr1 tart.incr2
  59. tar -c -v --listed-incremental=tart.incr2 -f archive.2 tart || exit 1
  60. sleep 1
  61. rm -rf tart/*
  62. echo Extracting main archive
  63. tar -x -v --listed-incremental=tart.incr1 -f archive.1 || exit 1
  64. echo Extracting incremental archive
  65. # This command should produce three messages about deletion
  66. # of the existing files, that may appear in any order. Piping
  67. # to sort makes sure we don't depend on any particular ordering.
  68. tar -x -v --listed-incremental=tart.incr2 -f archive.2 | sort 2>/dev/null
  69. echo Final files:
  70. find tart -print | sort 2>/dev/null
  71. ],
  72. [0],
  73. [Create directories
  74. Creating main archive
  75. tart/
  76. tart/c0/
  77. tart/c1/
  78. tart/a1
  79. tart/b1
  80. tart/c0/cq1
  81. tart/c0/cq2
  82. tart/c1/ca1
  83. tart/c1/ca2
  84. Modifying filesystem
  85. Directory contents
  86. tart
  87. tart/b2
  88. tart/c0
  89. tart/c0/cq1
  90. tart/c0/cq2
  91. tart/c2
  92. tart/c2/ca1
  93. tart/c2/ca2
  94. tart/c2/ca3
  95. Creating incremental archive
  96. tart/
  97. tart/c0/
  98. tart/c2/
  99. tart/b2
  100. tart/c2/ca1
  101. tart/c2/ca2
  102. tart/c2/ca3
  103. Extracting main archive
  104. tart/
  105. tart/c0/
  106. tart/c1/
  107. tart/a1
  108. tart/b1
  109. tart/c0/cq1
  110. tart/c0/cq2
  111. tart/c1/ca1
  112. tart/c1/ca2
  113. Extracting incremental archive
  114. tar: Deleting `tart/a1'
  115. tar: Deleting `tart/b1'
  116. tar: Deleting `tart/c1'
  117. tart/
  118. tart/b2
  119. tart/c0/
  120. tart/c2/
  121. tart/c2/ca1
  122. tart/c2/ca2
  123. tart/c2/ca3
  124. Final files:
  125. tart
  126. tart/b2
  127. tart/c0
  128. tart/c0/cq1
  129. tart/c0/cq2
  130. tart/c2
  131. tart/c2/ca1
  132. tart/c2/ca2
  133. tart/c2/ca3
  134. ],
  135. [tar: tart/c0: Directory is new
  136. tar: tart/c1: Directory is new
  137. tar: tart/c2: Directory is new
  138. ],
  139. [],[],[gnu, oldgnu])
  140. AT_CLEANUP