listed02.at 3.1 KB

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