1# Process this file with autom4te to create testsuite. -*- Autotest -*-
2
3# Test suite for GNU tar.
4# Copyright (C) 2006 Free Software Foundation, Inc.
5
6# This program 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 2, or (at your option)
9# any later version.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# GNU General Public License for more details.
15
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19# 02110-1301, USA.
20
21# Description: Handling of cyclic renames in incremental archives.
22
23AT_SETUP([cyclic renames])
24AT_KEYWORDS([incremental rename rename03 cyclic-rename])
25
26AT_TAR_CHECK([
27AT_SORT_PREREQ
28
29mkdir foo
30genfile --file foo/file1
31genfile --file foo/file2
32
33mkdir foo/a
34genfile --file foo/a/filea
35
36mkdir foo/b
37genfile --file foo/b/fileb
38
39mkdir foo/c
40genfile --file foo/c/filec
41
42echo "First dump"
43echo "First dump">&2
44tar -g incr -cf arch.1 -v foo 2>tmperr
45sort tmperr >&2
46
47# Shuffle directories:
48(cd foo
49mv a $$
50mv c a
51mv b c
52mv $$ b)
53
54echo "Second dump"
55echo "Second dump" >&2
56tar -g incr -cf arch.2 -v foo 2>tmperr
57sort tmperr >&2
58
59tar xfg arch.1 /dev/null 
60
61echo "Begin directory listing 1"
62find foo | sort 
63echo "End directory listing 1"
64
65tar xfgv arch.2 /dev/null
66echo Begin directory listing 2
67find foo | sort
68echo End directory listing 2
69],
70[0],
71[First dump
72foo/
73foo/a/
74foo/b/
75foo/c/
76foo/file1
77foo/file2
78foo/a/filea
79foo/b/fileb
80foo/c/filec
81Second dump
82foo/
83foo/a/
84foo/b/
85foo/c/
86Begin directory listing 1
87foo
88foo/a
89foo/a/filea
90foo/b
91foo/b/fileb
92foo/c
93foo/c/filec
94foo/file1
95foo/file2
96End directory listing 1
97foo/
98foo/a/
99foo/b/
100foo/c/
101Begin directory listing 2
102foo
103foo/a
104foo/a/filec
105foo/b
106foo/b/filea
107foo/c
108foo/c/fileb
109foo/file1
110foo/file2
111End directory listing 2
112],
113[First dump
114tar: foo/a: Directory is new
115tar: foo/b: Directory is new
116tar: foo/c: Directory is new
117Second dump
118tar: foo/a: Directory has been renamed from `foo/c'
119tar: foo/b: Directory has been renamed from `foo/a'
120tar: foo/c: Directory has been renamed from `foo/b'
121],
122[],[],[gnu, oldgnu, posix])
123
124AT_CLEANUP
125
126# End of rename03.at
127