re-mark 1.29b-2 as not yet uploaded (merge madness!)
[debian/tar] / tests / listed02.at
1 # Process this file with autom4te to create testsuite. -*- Autotest -*-
2
3 # Test suite for GNU tar.
4 # Copyright 2004-2007, 2009, 2013-2014, 2016 Free Software Foundation,
5 # Inc.
6
7 # This file is part of GNU tar.
8
9 # GNU tar is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or
12 # (at your option) any later version.
13
14 # GNU tar is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18
19 # You should have received a copy of the GNU General Public License
20 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
22 # Check if listed-incremental backups work for files moved from one directory
23 # to another.
24 # Based on a script by Martin Simmons <ZYHYLCRMZPRP@spammotel.com>
25 # References:
26 #  <20040626230315.163AA1D148@cpc5-cmbg1-6-0-cust208.cmbg.cable.ntl.com>
27 #  http://lists.gnu.org/archive/html/bug-tar/2004-06/msg00028.html
28
29 AT_SETUP([working --listed])
30 AT_KEYWORDS([listed incremental listed02])
31
32 AT_TAR_CHECK([
33 AT_CHECK_TIMESTAMP
34 AT_SORT_PREREQ
35 echo Create directories
36
37 mkdir tart
38 sleep 1
39 mkdir tart/c0
40 sleep 1
41 mkdir tart/c1
42 sleep 1
43
44 for file in tart/a1 tart/b1 tart/c0/cq1 tart/c0/cq2 tart/c1/ca1 tart/c1/ca2
45 do
46   echo File $file > $file
47   sleep 1
48 done
49
50 sleep 1
51 echo Creating main archive
52 echo >&2 "Creating main archive"
53 tar -c -v --listed-incremental=tart.incr1 -f archive.1 tart 2> err || exit 1
54
55 # The above prints two lines to stderr announcing the new directories c0 and c1.
56 # Ensure that they appear in this script's stderr in sorted order.
57 sort err 1>&2; rm -f err
58
59 sleep 1
60 echo Modifying filesystem
61 rm tart/a1
62
63 mv tart/b1 tart/b2
64 mv tart/c1 tart/c2
65 touch tart/c2/ca3
66
67 echo Directory contents
68 find tart -print | sort 2>/dev/null
69
70 sleep 1
71 echo Creating incremental archive
72 echo >&2 "Creating incremental archive"
73 cp -p tart.incr1 tart.incr2
74 tar -c -v --listed-incremental=tart.incr2 -f archive.2 tart || exit 1
75
76 sleep 1
77
78 rm -rf tart/*
79 echo Extracting main archive
80 echo >&2 "Extracting main archive"
81 tar -x -v --listed-incremental=tart.incr1 -f archive.1 || exit 1
82 echo Extracting incremental archive
83 # This command should produce three messages about deletion
84 # of the existing files, that may appear in any order. Piping
85 # to sort makes sure we don't depend on any particular ordering.
86 tar -x -v --listed-incremental=tart.incr2 -f archive.2 | sort 2>/dev/null
87
88 echo Final files:
89 find tart -print | sort 2>/dev/null
90 ],
91 [0],
92 [Create directories
93 Creating main archive
94 tart/
95 tart/c0/
96 tart/c1/
97 tart/a1
98 tart/b1
99 tart/c0/cq1
100 tart/c0/cq2
101 tart/c1/ca1
102 tart/c1/ca2
103 Modifying filesystem
104 Directory contents
105 tart
106 tart/b2
107 tart/c0
108 tart/c0/cq1
109 tart/c0/cq2
110 tart/c2
111 tart/c2/ca1
112 tart/c2/ca2
113 tart/c2/ca3
114 Creating incremental archive
115 tart/
116 tart/c0/
117 tart/c2/
118 tart/b2
119 tart/c2/ca3
120 Extracting main archive
121 tart/
122 tart/c0/
123 tart/c1/
124 tart/a1
125 tart/b1
126 tart/c0/cq1
127 tart/c0/cq2
128 tart/c1/ca1
129 tart/c1/ca2
130 Extracting incremental archive
131 tar: Deleting 'tart/a1'
132 tar: Deleting 'tart/b1'
133 tart/
134 tart/b2
135 tart/c0/
136 tart/c2/
137 tart/c2/ca3
138 Final files:
139 tart
140 tart/b2
141 tart/c0
142 tart/c0/cq1
143 tart/c0/cq2
144 tart/c2
145 tart/c2/ca1
146 tart/c2/ca2
147 tart/c2/ca3
148 ],
149 [Creating main archive
150 tar: tart/c0: Directory is new
151 tar: tart/c1: Directory is new
152 tar: tart: Directory is new
153 Creating incremental archive
154 tar: tart/c2: Directory has been renamed from 'tart/c1'
155 Extracting main archive
156 ],
157 [],[],[gnu, oldgnu])
158
159 AT_CLEANUP