rename03.at 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. # Test suite for GNU tar.
  3. # Copyright (C) 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. # 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. 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
  45. echo "Begin directory listing 1"
  46. find foo | sort
  47. echo "End directory listing 1"
  48. tar xfgv arch.2 /dev/null
  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. Second dump
  101. tar: foo/a: Directory has been renamed from `foo/c'
  102. tar: foo/b: Directory has been renamed from `foo/a'
  103. tar: foo/c: Directory has been renamed from `foo/b'
  104. ],
  105. [],[],[gnu, oldgnu, posix])
  106. AT_CLEANUP
  107. # End of rename03.at