]> git.cworth.org Git - tar/blob - tests/listed02.at
Imported Upstream version 1.20
[tar] / tests / listed02.at
1 # Process this file with autom4te to create testsuite. -*- Autotest -*-
2
3 # Test suite for GNU tar.
4 # Copyright (C) 2004, 2005, 2006, 2007 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 3, 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 # Check if listed-incremental backups work for files moved from one directory
22 # to another. 
23 # Based on a script by Martin Simmons <ZYHYLCRMZPRP@spammotel.com>
24 # References: 
25 #  <20040626230315.163AA1D148@cpc5-cmbg1-6-0-cust208.cmbg.cable.ntl.com>
26 #  http://lists.gnu.org/archive/html/bug-tar/2004-06/msg00028.html
27
28 AT_SETUP([working --listed])
29 AT_KEYWORDS([listed incremental listed02])
30
31 AT_TAR_CHECK([
32 AT_SORT_PREREQ
33 echo Create directories
34
35 mkdir tart
36 sleep 1
37 mkdir tart/c0
38 sleep 1
39 mkdir tart/c1
40 sleep 1
41
42 for file in tart/a1 tart/b1 tart/c0/cq1 tart/c0/cq2 tart/c1/ca1 tart/c1/ca2
43 do
44   echo File $file > $file
45   sleep 1
46 done
47
48 sleep 1
49 echo Creating main archive
50 tar -c -v --listed-incremental=tart.incr1 -f archive.1 tart 2> err || exit 1
51
52 # The above prints two lines to stderr announcing the new directories c0 and c1.
53 # Ensure that they appear in this script's stderr in sorted order.
54 sort err 1>&2; rm -f err
55
56 sleep 1
57 echo Modifying filesystem
58 rm tart/a1
59
60 mv tart/b1 tart/b2
61 mv tart/c1 tart/c2
62 touch tart/c2/ca3
63
64 echo Directory contents
65 find tart -print | sort 2>/dev/null
66
67 sleep 1
68 echo Creating incremental archive
69 cp -p tart.incr1 tart.incr2
70 tar -c -v --listed-incremental=tart.incr2 -f archive.2 tart || exit 1 
71
72 sleep 1
73
74 rm -rf tart/*
75 echo Extracting main archive
76 tar -x -v --listed-incremental=tart.incr1 -f archive.1 || exit 1
77 echo Extracting incremental archive
78 # This command should produce three messages about deletion
79 # of the existing files, that may appear in any order. Piping
80 # to sort makes sure we don't depend on any particular ordering.
81 tar -x -v --listed-incremental=tart.incr2 -f archive.2 | sort 2>/dev/null 
82
83 echo Final files:
84 find tart -print | sort 2>/dev/null
85 ],
86 [0],
87 [Create directories
88 Creating main archive
89 tart/
90 tart/c0/
91 tart/c1/
92 tart/a1
93 tart/b1
94 tart/c0/cq1
95 tart/c0/cq2
96 tart/c1/ca1
97 tart/c1/ca2
98 Modifying filesystem
99 Directory contents
100 tart
101 tart/b2
102 tart/c0
103 tart/c0/cq1
104 tart/c0/cq2
105 tart/c2
106 tart/c2/ca1
107 tart/c2/ca2
108 tart/c2/ca3
109 Creating incremental archive
110 tart/
111 tart/c0/
112 tart/c2/
113 tart/b2
114 tart/c2/ca3
115 Extracting main archive
116 tart/
117 tart/c0/
118 tart/c1/
119 tart/a1
120 tart/b1
121 tart/c0/cq1
122 tart/c0/cq2
123 tart/c1/ca1
124 tart/c1/ca2
125 Extracting incremental archive
126 tar: Deleting `tart/a1'
127 tar: Deleting `tart/b1'
128 tart/
129 tart/b2
130 tart/c0/
131 tart/c2/
132 tart/c2/ca3
133 Final files:
134 tart
135 tart/b2
136 tart/c0
137 tart/c0/cq1
138 tart/c0/cq2
139 tart/c2
140 tart/c2/ca1
141 tart/c2/ca2
142 tart/c2/ca3
143 ],
144 [tar: tart/c0: Directory is new
145 tar: tart/c1: Directory is new
146 tar: tart/c2: Directory has been renamed from `tart/c1'
147 ],
148 [],[],[gnu, oldgnu])
149
150 AT_CLEANUP