]> Dogcows Code - chaz/tar/blob - tests/listed02.sh
Updated
[chaz/tar] / tests / listed02.sh
1 #! /bin/sh
2 # This file is part of GNU tar testsuite.
3 # Copyright (C) 2004 Free Software Foundation, Inc.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18 # 02111-1307, USA.
19
20 # Check if listed-incremental backups work for files moved from one directory
21 # to another.
22 # Based on a script by Martin Simmons <ZYHYLCRMZPRP@spammotel.com>
23 # References:
24 # <20040626230315.163AA1D148@cpc5-cmbg1-6-0-cust208.cmbg.cable.ntl.com>
25 # http://lists.gnu.org/archive/html/bug-tar/2004-06/msg00028.html
26
27 . ./preset
28 TAR_ARCHIVE_FORMATS="gnu oldgnu"
29 . $srcdir/before
30
31 mkdir directory
32
33 echo Create directories
34 mkdir tart
35 sleep 1
36 mkdir tart/c0
37 sleep 1
38 mkdir tart/c1
39 sleep 1
40
41 for file in tart/a1 tart/b1 tart/c0/cq1 tart/c0/cq2 tart/c1/ca1 tart/c1/ca2
42 do
43 echo File $file > $file
44 sleep 1
45 done
46
47 sleep 1
48 echo Creating main archive
49 tar -c -v --listed-incremental=tart.incr1 -f archive.1 tart
50
51 sleep 1
52 echo Modifying filesystem
53 rm tart/a1
54 mv tart/b1 tart/b2
55 mv tart/c1 tart/c2
56 touch tart/c2/ca3
57
58 echo Directory contents
59 find tart|sort
60
61 sleep 1
62 echo Creating incremental archive
63 cp -p tart.incr1 tart.incr2
64 tar -c -v --listed-incremental=tart.incr2 -f archive.2 tart
65
66 sleep 1
67
68 rm -rf tart/*
69 echo Extracting main archive
70 tar -x -v --listed-incremental=tart.incr1 -f archive.1
71 echo Extracting incremental archive
72 # This command should produce three messages about deletion
73 # of the existing files, that may appear in any order. Piping
74 # to sort makes sure we don't depend on any particular ordering.
75 tar -x -v --listed-incremental=tart.incr2 -f archive.2 | sort
76
77 echo Final files:
78 find tart|sort
79
80 err="tar: tart/c0: Directory is new
81 tar: tart/c1: Directory is new
82 tar: tart/c2: Directory is new
83 "
84
85 out="Create directories
86 Creating main archive
87 tart/
88 tart/c0/
89 tart/c1/
90 tart/a1
91 tart/b1
92 tart/c0/cq1
93 tart/c0/cq2
94 tart/c1/ca1
95 tart/c1/ca2
96 Modifying filesystem
97 Directory contents
98 tart
99 tart/b2
100 tart/c0
101 tart/c0/cq1
102 tart/c0/cq2
103 tart/c2
104 tart/c2/ca1
105 tart/c2/ca2
106 tart/c2/ca3
107 Creating incremental archive
108 tart/
109 tart/c0/
110 tart/c2/
111 tart/b2
112 tart/c2/ca1
113 tart/c2/ca2
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 tar: Deleting \`tart/c1'
129 tart/
130 tart/b2
131 tart/c0/
132 tart/c2/
133 tart/c2/ca1
134 tart/c2/ca2
135 tart/c2/ca3
136 Final files:
137 tart
138 tart/b2
139 tart/c0
140 tart/c0/cq1
141 tart/c0/cq2
142 tart/c2
143 tart/c2/ca1
144 tart/c2/ca2
145 tart/c2/ca3
146 "
147
148 . $srcdir/after
This page took 0.042376 seconds and 4 git commands to generate.