]> Dogcows Code - chaz/tar/blob - tests/extrac11.at
Update copyright years.
[chaz/tar] / tests / extrac11.at
1 # Process this file with autom4te to create testsuite. -*- Autotest -*-
2
3 # Test suite for GNU tar.
4 # Copyright 2010, 2013-2014 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 # written by Paul Eggert
22
23 # Check that 'tar' works even in a file-descriptor-limited environment.
24
25 AT_SETUP([scarce file descriptors])
26 AT_KEYWORDS([extract extrac11])
27
28 AT_TAR_CHECK([
29 exec </dev/null
30 dirs='a
31 a/b
32 a/b/c
33 a/b/c/d
34 a/b/c/d/e
35 a/b/c/d/e/f
36 a/b/c/d/e/f/g
37 a/b/c/d/e/f/g/h
38 a/b/c/d/e/f/g/h/i
39 a/b/c/d/e/f/g/h/i/j
40 a/b/c/d/e/f/g/h/i/j/k
41 '
42 files=
43 mkdir $dirs dest1 dest2 dest3 || exit
44 for dir in $dirs; do
45 for file in X Y Z; do
46 echo $file >$dir/$file || exit
47 files="$files $file"
48 done
49 done
50
51 # Check that "ulimit" itself works. Close file descriptors before
52 # invoking ulimit, to work around a bug (or a "feature") in some shells,
53 # where they squirrel away dups of file descriptors into FD 10 and up
54 # before closing the originals.
55 ( (exec 3<&- 4<&- 5<&- 6<&- 7<&- 8<&- 9<&- &&
56 ulimit -n 100 &&
57 tar -cf archive1.tar a &&
58 tar -xf archive1.tar -C dest1 a
59 ) &&
60 diff -r a dest1/a
61 ) >/dev/null 2>&1 ||
62 AT_SKIP_TEST
63
64 # Another test that "ulimit" itself works:
65 # tar should fail when completely starved of file descriptors.
66 ( (exec 3<&- 4<&- 5<&- 6<&- 7<&- 8<&- 9<&- &&
67 ulimit -n 4 &&
68 tar -cf archive2.tar a &&
69 tar -xf archive2.tar -C dest2 a
70 ) &&
71 diff -r a dest2/a
72 ) >/dev/null 2>&1 &&
73 AT_SKIP_TEST
74
75 # Tar should work when there are few, but enough, file descriptors.
76 ( (exec 3<&- 4<&- 5<&- 6<&- 7<&- 8<&- 9<&- &&
77 ulimit -n 10 &&
78 tar -cf archive3.tar a &&
79 tar -xf archive3.tar -C dest3 a
80 ) &&
81 diff -r a dest3/a >/dev/null 2>&1
82 ) || { diff -r a dest3/a; exit 1; }
83 ],
84 [0],[],[],[],[],[gnu])
85
86 AT_CLEANUP
This page took 0.032047 seconds and 4 git commands to generate.