4
0

rename03.at 2.4 KB

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