rename03.at 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. # Test suite for GNU tar.
  3. # Copyright (C) 2006 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 2, 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. 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. echo "First dump"
  30. echo "First dump">&2
  31. tar -g incr -cf arch.1 -v foo 2>tmperr
  32. sort tmperr >&2
  33. # Shuffle directories:
  34. (cd foo
  35. mv a $$
  36. mv c a
  37. mv b c
  38. mv $$ b)
  39. echo "Second dump"
  40. echo "Second dump" >&2
  41. tar -g incr -cf arch.2 -v foo 2>tmperr
  42. sort tmperr >&2
  43. tar xfg arch.1 /dev/null
  44. echo "Begin directory listing 1"
  45. find foo | sort
  46. echo "End directory listing 1"
  47. tar xfgv arch.2 /dev/null
  48. echo Begin directory listing 2
  49. find foo | sort
  50. echo End directory listing 2
  51. ],
  52. [0],
  53. [First dump
  54. foo/
  55. foo/a/
  56. foo/b/
  57. foo/c/
  58. foo/file1
  59. foo/file2
  60. foo/a/filea
  61. foo/b/fileb
  62. foo/c/filec
  63. Second dump
  64. foo/
  65. foo/a/
  66. foo/b/
  67. foo/c/
  68. Begin directory listing 1
  69. foo
  70. foo/a
  71. foo/a/filea
  72. foo/b
  73. foo/b/fileb
  74. foo/c
  75. foo/c/filec
  76. foo/file1
  77. foo/file2
  78. End directory listing 1
  79. foo/
  80. foo/a/
  81. foo/b/
  82. foo/c/
  83. Begin directory listing 2
  84. foo
  85. foo/a
  86. foo/a/filec
  87. foo/b
  88. foo/b/filea
  89. foo/c
  90. foo/c/fileb
  91. foo/file1
  92. foo/file2
  93. End directory listing 2
  94. ],
  95. [First dump
  96. tar: foo/a: Directory is new
  97. tar: foo/b: Directory is new
  98. tar: foo/c: Directory is new
  99. Second dump
  100. tar: foo/a: Directory has been renamed from `foo/c'
  101. tar: foo/b: Directory has been renamed from `foo/a'
  102. tar: foo/c: Directory has been renamed from `foo/b'
  103. ],
  104. [],[],[gnu, oldgnu, posix])
  105. AT_CLEANUP
  106. # End of rename03.at