From: Sergey Poznyakoff Date: Mon, 8 May 2006 12:11:26 +0000 (+0000) Subject: New testcase X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Ftar;a=commitdiff_plain;h=71f2e412aecce6b958186b6bbcd2b8278e4d8997 New testcase --- diff --git a/tests/incr03.at b/tests/incr03.at new file mode 100644 index 0000000..0d5b835 --- /dev/null +++ b/tests/incr03.at @@ -0,0 +1,77 @@ +# Process this file with autom4te to create testsuite. -*- Autotest -*- + +# Test suite for GNU tar. +# Copyright (C) 2006 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# Description: +# Previous versions checked only mtime/ctime of directories during +# incremental backups. As a result, it sufficed to rename a single file +# to get full dump of the directory where it resided. Since v.1.15.91 +# tar checks directory contents as well, so in this case only the renamed +# file is dumped. + +AT_SETUP([renamed files in incrementals]) +AT_KEYWORDS([incremental incr03 rename]) + +AT_TAR_CHECK([ +mkdir directory +genfile --file=directory/x +genfile --file=directory/y + +tar -cf archive.1 -g db directory + +mv directory/x directory/z +tar -cf archive.2 -g db directory + +mv directory orig + +echo Listing of archive.1 +tar -tf archive.1 | sort 2>/dev/null +echo Listing of archive.2 +tar -tf archive.2 | sort 2>/dev/null + +echo Directory after first restore +tar -xf archive.1 -g db +find directory | sort 2>/dev/null + +echo Directory after second restore +tar -xf archive.2 -g db +find directory | sort 2>/dev/null +], +[0], +[Listing of archive.1 +directory/ +directory/x +directory/y +Listing of archive.2 +directory/ +directory/z +Directory after first restore +directory +directory/x +directory/y +Directory after second restore +directory +directory/y +directory/z +],[],[],[],[gnu, oldgnu, posix]) + +AT_CLEANUP + +# End of incr03.at + diff --git a/tests/rename01.at b/tests/rename01.at new file mode 100644 index 0000000..c992da8 --- /dev/null +++ b/tests/rename01.at @@ -0,0 +1,87 @@ +# Process this file with autom4te to create testsuite. -*- Autotest -*- + +# Test suite for GNU tar. +# Copyright (C) 2006 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# Description: Test basic handling of renamed directory in the incremental +# archives. + +AT_SETUP([renamed dirs in incrementals]) +AT_KEYWORDS([incremental rename rename01]) + +AT_TAR_CHECK([ +mkdir foo +genfile --file foo/file1 +genfile --file foo/file2 +mkdir foo/bar +genfile --file foo/bar/file + +echo "Creating base archive" +tar -g incr -cf arch.1 -v foo + +mv foo/bar foo/baz + +echo "Creating incremental archive" +tar -g incr -cf arch.2 -v foo + +mv foo old + +tar xfg arch.1 /dev/null + +echo "Begin directory listing 1" +find foo | sort +echo "End directory listing 1" + +tar xfg arch.2 /dev/null +echo Begin directory listing 2 +find foo | sort +echo End directory listing 2 +], +[0], +[Creating base archive +foo/ +foo/bar/ +foo/file1 +foo/file2 +foo/bar/file +Creating incremental archive +foo/ +foo/baz/ +Begin directory listing 1 +foo +foo/bar +foo/bar/file +foo/file1 +foo/file2 +End directory listing 1 +Begin directory listing 2 +foo +foo/baz +foo/baz/file +foo/file1 +foo/file2 +End directory listing 2 +], +[tar: foo/bar: Directory is new +tar: foo/baz: Directory has been renamed from `foo/bar' +], +[],[],[gnu, oldgnu, posix]) + +AT_CLEANUP + +# End of rename01.at diff --git a/tests/rename02.at b/tests/rename02.at new file mode 100644 index 0000000..8fffe73 --- /dev/null +++ b/tests/rename02.at @@ -0,0 +1,101 @@ +# Process this file with autom4te to create testsuite. -*- Autotest -*- + +# Test suite for GNU tar. +# Copyright (C) 2006 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# Description: Incremental archives should be able to handle directories +# moved between directory hierarchies. + +AT_SETUP([move between hierarchies]) +AT_KEYWORDS([incremental rename rename02]) + +AT_TAR_CHECK([ +mkdir foo +genfile --file foo/file1 +genfile --file foo/file2 +mkdir foo/bar +genfile --file foo/bar/file.r +mkdir foo/bar/baz +genfile --file foo/bar/baz/file.z + +echo "Creating base archive" +tar -g incr -cf arch.1 -v foo + +mv foo/bar/baz foo + +echo "Creating incremental archive" +tar -g incr -cf arch.2 -v foo + +mv foo old + +tar xfg arch.1 /dev/null 2>tmperr +sort tmperr >&2 + +echo "Begin directory listing 1" +find foo | sort +echo "End directory listing 1" + +tar xfgv arch.2 /dev/null +echo Begin directory listing 2 +find foo | sort +echo End directory listing 2 +], +[0], +[Creating base archive +foo/ +foo/bar/ +foo/bar/baz/ +foo/file1 +foo/file2 +foo/bar/file.r +foo/bar/baz/file.z +Creating incremental archive +foo/ +foo/bar/ +foo/baz/ +Begin directory listing 1 +foo +foo/bar +foo/bar/baz +foo/bar/baz/file.z +foo/bar/file.r +foo/file1 +foo/file2 +End directory listing 1 +foo/ +foo/bar/ +foo/baz/ +Begin directory listing 2 +foo +foo/bar +foo/bar/file.r +foo/baz +foo/baz/file.z +foo/file1 +foo/file2 +End directory listing 2 +], +[tar: foo/bar: Directory is new +tar: foo/bar/baz: Directory is new +tar: foo/baz: Directory has been renamed from `foo/bar/baz' +], +[],[],[gnu, oldgnu, posix]) + +AT_CLEANUP + +# End of rename02.at diff --git a/tests/rename03.at b/tests/rename03.at new file mode 100644 index 0000000..83b0c18 --- /dev/null +++ b/tests/rename03.at @@ -0,0 +1,124 @@ +# Process this file with autom4te to create testsuite. -*- Autotest -*- + +# Test suite for GNU tar. +# Copyright (C) 2006 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# Description: Handling of cyclic renames in incremental archives. + +AT_SETUP([cyclic renames]) +AT_KEYWORDS([incremental rename rename03 cyclic-rename]) + +AT_TAR_CHECK([ +mkdir foo +genfile --file foo/file1 +genfile --file foo/file2 + +mkdir foo/a +genfile --file foo/a/filea + +mkdir foo/b +genfile --file foo/b/fileb + +mkdir foo/c +genfile --file foo/c/filec + +echo "First dump" +echo "First dump">&2 +tar -g incr -cf arch.1 -v foo 2>tmperr +sort tmperr >&2 + +# Shuffle directories: +(cd foo +mv a $$ +mv c a +mv b c +mv $$ b) + +echo "Second dump" +echo "Second dump" >&2 +tar -g incr -cf arch.2 -v foo 2>tmperr +sort tmperr >&2 + +tar xfg arch.1 /dev/null + +echo "Begin directory listing 1" +find foo | sort +echo "End directory listing 1" + +tar xfgv arch.2 /dev/null +echo Begin directory listing 2 +find foo | sort +echo End directory listing 2 +], +[0], +[First dump +foo/ +foo/a/ +foo/b/ +foo/c/ +foo/file1 +foo/file2 +foo/a/filea +foo/b/fileb +foo/c/filec +Second dump +foo/ +foo/a/ +foo/b/ +foo/c/ +Begin directory listing 1 +foo +foo/a +foo/a/filea +foo/b +foo/b/fileb +foo/c +foo/c/filec +foo/file1 +foo/file2 +End directory listing 1 +foo/ +foo/a/ +foo/b/ +foo/c/ +Begin directory listing 2 +foo +foo/a +foo/a/filec +foo/b +foo/b/filea +foo/c +foo/c/fileb +foo/file1 +foo/file2 +End directory listing 2 +], +[First dump +tar: foo/a: Directory is new +tar: foo/b: Directory is new +tar: foo/c: Directory is new +Second dump +tar: foo/a: Directory has been renamed from `foo/c' +tar: foo/b: Directory has been renamed from `foo/a' +tar: foo/c: Directory has been renamed from `foo/b' +], +[],[],[gnu, oldgnu, posix]) + +AT_CLEANUP + +# End of rename03.at