listed02.at 3.3 KB

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