Debian Codegraph @

tests/dirrem01.at

raw
1 # Process this file with autom4te to create testsuite. -*- Autotest -*-
2
3 # Test suite for GNU tar.
4 # Copyright 2017-2023 Free Software Foundation, Inc.
5
6 # This file is part of GNU tar.
7
8 # GNU tar is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
12
13 # GNU tar is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20
21 # Description:
22 #
23 # When a directory in a deep directory disappeared during creation
24 # of incremental dump, tar <= 1.29 exits with TAREXIT_FAILURE (2).
25 #
26 # In case of files tar does not return TAREXIT_FAILURE, but instead
27 # it prints a warning and exits with TAREXIT_DIFFERS.
28 #
29 # This test checks whether this behaviour is mimicked for directories, too.
30 #
31 # Notes:
32 # 1. This file is based on 'filerem01.at', which is the test-case for
33 # a vanishing file.
34 # 2. Depending on the stat.st_ctime resolution, the "file changed as we
35 # read it" warning might be issued for dir/sub. The test takes care to
36 # suppress it.
37
38 AT_SETUP([directory removed before reading])
39 AT_KEYWORDS([create incremental listed dirchange dirrem dirrem01])
40
41 AT_TAR_CHECK([
42 mkdir dir
43 mkdir dir/sub
44 genfile --file dir/file1
45 genfile --file dir/sub/file2
46
47 case "$TEST_TAR_FORMAT" in
48 posix) CPT=5;;
49 gnu) CPT=3;;
50 *) AT_SKIP_TEST
51 esac
52
53 genfile --run --checkpoint=$CPT --unlink dir/sub/file2 --unlink dir/sub -- \
54 tar --blocking-factor=1 -c -f archive.tar \
55 --listed-incremental db \
56 --warning=no-file-changed \
57 -v dir >/dev/null
58 ],
59 [1],
60 [ignore],
61 [tar: dir: Directory is new
62 tar: dir/sub: Directory is new
63 tar: dir/sub: File removed before we read it
64 ],[],[],[gnu,posix])
65
66 AT_CLEANUP
67