rename03.at 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. 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
  46. echo "Begin directory listing 1"
  47. find foo | sort
  48. echo "End directory listing 1"
  49. tar xfgv arch.2 /dev/null
  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. 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