1# Process this file with autom4te to create testsuite. -*- Autotest -*- 2 3# Test suite for GNU tar. 4# Copyright (C) 2004, 2005, 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# 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 28AT_SETUP([working --listed]) 29AT_KEYWORDS([listed incremental listed02]) 30 31AT_TAR_CHECK([ 32AT_SORT_PREREQ 33echo Create directories 34 35mkdir tart 36sleep 1 37mkdir tart/c0 38sleep 1 39mkdir tart/c1 40sleep 1 41 42for file in tart/a1 tart/b1 tart/c0/cq1 tart/c0/cq2 tart/c1/ca1 tart/c1/ca2 43do 44 echo File $file > $file 45 sleep 1 46done 47 48sleep 1 49echo Creating main archive 50tar -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. 54sort err 1>&2; rm -f err 55 56sleep 1 57echo Modifying filesystem 58rm tart/a1 59 60mv tart/b1 tart/b2 61mv tart/c1 tart/c2 62touch tart/c2/ca3 63 64echo Directory contents 65find tart -print | sort 2>/dev/null 66 67sleep 1 68echo Creating incremental archive 69cp -p tart.incr1 tart.incr2 70tar -c -v --listed-incremental=tart.incr2 -f archive.2 tart || exit 1 71 72sleep 1 73 74rm -rf tart/* 75echo Extracting main archive 76tar -x -v --listed-incremental=tart.incr1 -f archive.1 || exit 1 77echo 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. 81tar -x -v --listed-incremental=tart.incr2 -f archive.2 | sort 2>/dev/null 82 83echo Final files: 84find tart -print | sort 2>/dev/null 85], 86[0], 87[Create directories 88Creating main archive 89tart/ 90tart/c0/ 91tart/c1/ 92tart/a1 93tart/b1 94tart/c0/cq1 95tart/c0/cq2 96tart/c1/ca1 97tart/c1/ca2 98Modifying filesystem 99Directory contents 100tart 101tart/b2 102tart/c0 103tart/c0/cq1 104tart/c0/cq2 105tart/c2 106tart/c2/ca1 107tart/c2/ca2 108tart/c2/ca3 109Creating incremental archive 110tart/ 111tart/c0/ 112tart/c2/ 113tart/b2 114tart/c2/ca3 115Extracting main archive 116tart/ 117tart/c0/ 118tart/c1/ 119tart/a1 120tart/b1 121tart/c0/cq1 122tart/c0/cq2 123tart/c1/ca1 124tart/c1/ca2 125Extracting incremental archive 126tar: Deleting `tart/a1' 127tar: Deleting `tart/b1' 128tart/ 129tart/b2 130tart/c0/ 131tart/c2/ 132tart/c2/ca3 133Final files: 134tart 135tart/b2 136tart/c0 137tart/c0/cq1 138tart/c0/cq2 139tart/c2 140tart/c2/ca1 141tart/c2/ca2 142tart/c2/ca3 143], 144[tar: tart/c0: Directory is new 145tar: tart/c1: Directory is new 146tar: tart/c2: Directory has been renamed from `tart/c1' 147], 148[],[],[gnu, oldgnu]) 149 150AT_CLEANUP 151