rename03.at 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. # Test suite for GNU tar.
  3. # Copyright 2006-2007, 2009, 2013-2014, 2016 Free Software Foundation,
  4. # Inc.
  5. # This file is part of GNU tar.
  6. # GNU tar is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 3 of the License, or
  9. # (at your option) any later version.
  10. # GNU tar is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. # Description: Handling of cyclic renames in incremental archives.
  17. AT_SETUP([cyclic renames])
  18. AT_KEYWORDS([incremental rename rename03 cyclic-rename])
  19. AT_TAR_CHECK([
  20. AT_SORT_PREREQ
  21. mkdir foo
  22. genfile --file foo/file1
  23. genfile --file foo/file2
  24. mkdir foo/a
  25. genfile --file foo/a/filea
  26. mkdir foo/b
  27. genfile --file foo/b/fileb
  28. mkdir foo/c
  29. genfile --file foo/c/filec
  30. sleep 1
  31. echo "First dump"
  32. echo "First dump">&2
  33. tar -g incr -cf arch.1 -v foo 2>tmperr
  34. sort tmperr >&2
  35. # Shuffle directories:
  36. (cd foo
  37. mv a $$
  38. mv c a
  39. mv b c
  40. mv $$ b)
  41. echo "Second dump"
  42. echo "Second dump" >&2
  43. tar -g incr -cf arch.2 -v foo 2>tmperr
  44. sort tmperr >&2
  45. tar xfg arch.1 /dev/null --warning=no-timestamp
  46. echo "Begin directory listing 1"
  47. find foo | sort
  48. echo "End directory listing 1"
  49. tar xfgv arch.2 /dev/null --warning=no-timestamp
  50. echo Begin directory listing 2
  51. find foo | sort
  52. echo End directory listing 2
  53. ],
  54. [0],
  55. [First dump
  56. foo/
  57. foo/a/
  58. foo/b/
  59. foo/c/
  60. foo/file1
  61. foo/file2
  62. foo/a/filea
  63. foo/b/fileb
  64. foo/c/filec
  65. Second dump
  66. foo/
  67. foo/a/
  68. foo/b/
  69. foo/c/
  70. Begin directory listing 1
  71. foo
  72. foo/a
  73. foo/a/filea
  74. foo/b
  75. foo/b/fileb
  76. foo/c
  77. foo/c/filec
  78. foo/file1
  79. foo/file2
  80. End directory listing 1
  81. foo/
  82. foo/a/
  83. foo/b/
  84. foo/c/
  85. Begin directory listing 2
  86. foo
  87. foo/a
  88. foo/a/filec
  89. foo/b
  90. foo/b/filea
  91. foo/c
  92. foo/c/fileb
  93. foo/file1
  94. foo/file2
  95. End directory listing 2
  96. ],
  97. [First dump
  98. tar: foo/a: Directory is new
  99. tar: foo/b: Directory is new
  100. tar: foo/c: Directory is new
  101. tar: foo: Directory is new
  102. Second dump
  103. tar: foo/a: Directory has been renamed from 'foo/c'
  104. tar: foo/b: Directory has been renamed from 'foo/a'
  105. tar: foo/c: Directory has been renamed from 'foo/b'
  106. ],
  107. [],[],[gnu, oldgnu, posix])
  108. AT_CLEANUP
  109. # End of rename03.at