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 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., 59 Temple Place - Suite 330, Boston, MA
  15. # 02111-1307, 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. mkdir directory
  26. echo Create directories
  27. mkdir tart
  28. sleep 1
  29. mkdir tart/c0
  30. sleep 1
  31. mkdir tart/c1
  32. sleep 1
  33. for file in tart/a1 tart/b1 tart/c0/cq1 tart/c0/cq2 tart/c1/ca1 tart/c1/ca2
  34. do
  35. echo File $file > $file
  36. sleep 1
  37. done
  38. sleep 1
  39. echo Creating main archive
  40. tar -c -v --listed-incremental=tart.incr1 -f archive.1 tart || exit 1
  41. sleep 1
  42. echo Modifying filesystem
  43. rm tart/a1
  44. mv tart/b1 tart/b2
  45. mv tart/c1 tart/c2
  46. touch tart/c2/ca3
  47. echo Directory contents
  48. find tart|sort 2>/dev/null
  49. sleep 1
  50. echo Creating incremental archive
  51. cp -p tart.incr1 tart.incr2
  52. tar -c -v --listed-incremental=tart.incr2 -f archive.2 tart || exit 1
  53. sleep 1
  54. rm -rf tart/*
  55. echo Extracting main archive
  56. tar -x -v --listed-incremental=tart.incr1 -f archive.1 || exit 1
  57. echo Extracting incremental archive
  58. # This command should produce three messages about deletion
  59. # of the existing files, that may appear in any order. Piping
  60. # to sort makes sure we don't depend on any particular ordering.
  61. tar -x -v --listed-incremental=tart.incr2 -f archive.2 | sort 2>/dev/null
  62. echo Final files:
  63. find tart|sort 2>/dev/null
  64. ],
  65. [0],
  66. [Create directories
  67. Creating main archive
  68. tart/
  69. tart/c0/
  70. tart/c1/
  71. tart/a1
  72. tart/b1
  73. tart/c0/cq1
  74. tart/c0/cq2
  75. tart/c1/ca1
  76. tart/c1/ca2
  77. Modifying filesystem
  78. Directory contents
  79. tart
  80. tart/b2
  81. tart/c0
  82. tart/c0/cq1
  83. tart/c0/cq2
  84. tart/c2
  85. tart/c2/ca1
  86. tart/c2/ca2
  87. tart/c2/ca3
  88. Creating incremental archive
  89. tart/
  90. tart/c0/
  91. tart/c2/
  92. tart/b2
  93. tart/c2/ca1
  94. tart/c2/ca2
  95. tart/c2/ca3
  96. Extracting main archive
  97. tart/
  98. tart/c0/
  99. tart/c1/
  100. tart/a1
  101. tart/b1
  102. tart/c0/cq1
  103. tart/c0/cq2
  104. tart/c1/ca1
  105. tart/c1/ca2
  106. Extracting incremental archive
  107. tar: Deleting `tart/a1'
  108. tar: Deleting `tart/b1'
  109. tar: Deleting `tart/c1'
  110. tart/
  111. tart/b2
  112. tart/c0/
  113. tart/c2/
  114. tart/c2/ca1
  115. tart/c2/ca2
  116. tart/c2/ca3
  117. Final files:
  118. tart
  119. tart/b2
  120. tart/c0
  121. tart/c0/cq1
  122. tart/c0/cq2
  123. tart/c2
  124. tart/c2/ca1
  125. tart/c2/ca2
  126. tart/c2/ca3
  127. ],
  128. [tar: tart/c0: Directory is new
  129. tar: tart/c1: Directory is new
  130. tar: tart/c2: Directory is new
  131. ],
  132. [],[],[gnu, oldgnu])
  133. AT_CLEANUP