X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Ftar;a=blobdiff_plain;f=tests%2Fextrac11.at;h=5a3f419b4cee4d86ecd2938ac92db9dcb2da1876;hp=f7ba587202b5ed60ed75904849f0e2f7dca9e2c5;hb=45ccda119355a1087450039a250359c1d0de0d08;hpb=3c0bedd49444d0f6435b8d5ffbf1f1ec97927b9c diff --git a/tests/extrac11.at b/tests/extrac11.at index f7ba587..5a3f419 100644 --- a/tests/extrac11.at +++ b/tests/extrac11.at @@ -1,14 +1,16 @@ # Process this file with autom4te to create testsuite. -*- Autotest -*- # Test suite for GNU tar. -# Copyright (C) 2010 Free Software Foundation, Inc. +# Copyright 2010, 2013-2014 Free Software Foundation, Inc. -# This program is free software; you can redistribute it and/or modify +# This file is part of GNU tar. + +# GNU tar 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 3, or (at your option) -# any later version. +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. -# This program is distributed in the hope that it will be useful, +# GNU tar 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. @@ -46,31 +48,37 @@ for dir in $dirs; do done done -# Check that "ulimit" itself works. -((ulimit -n 100 && - tar -cf archive1.tar a 3<&- 4<&- 5<&- 6<&- 7<&- 8<&- 9<&- && - tar -xf archive1.tar -C dest1 a 3<&- 4<&- 5<&- 6<&- 7<&- 8<&- 9<&- - ) && - diff -r a dest1/a +# Check that "ulimit" itself works. Close file descriptors before +# invoking ulimit, to work around a bug (or a "feature") in some shells, +# where they squirrel away dups of file descriptors into FD 10 and up +# before closing the originals. +( (exec 3<&- 4<&- 5<&- 6<&- 7<&- 8<&- 9<&- && + ulimit -n 100 && + tar -cf archive1.tar a && + tar -xf archive1.tar -C dest1 a + ) && + diff -r a dest1/a ) >/dev/null 2>&1 || AT_SKIP_TEST # Another test that "ulimit" itself works: # tar should fail when completely starved of file descriptors. -((ulimit -n 4 && - tar -cf archive2.tar a 3<&- 4<&- 5<&- 6<&- 7<&- 8<&- 9<&- && - tar -xf archive2.tar -C dest2 a 3<&- 4<&- 5<&- 6<&- 7<&- 8<&- 9<&- - ) && - diff -r a dest2/a +( (exec 3<&- 4<&- 5<&- 6<&- 7<&- 8<&- 9<&- && + ulimit -n 4 && + tar -cf archive2.tar a && + tar -xf archive2.tar -C dest2 a + ) && + diff -r a dest2/a ) >/dev/null 2>&1 && AT_SKIP_TEST # Tar should work when there are few, but enough, file descriptors. -((ulimit -n 10 && - tar -cf archive3.tar a 3<&- 4<&- 5<&- 6<&- 7<&- 8<&- 9<&- && - tar -xf archive3.tar -C dest3 a 3<&- 4<&- 5<&- 6<&- 7<&- 8<&- 9<&- - ) && - diff -r a dest3/a >/dev/null 2>&1 +( (exec 3<&- 4<&- 5<&- 6<&- 7<&- 8<&- 9<&- && + ulimit -n 10 && + tar -cf archive3.tar a && + tar -xf archive3.tar -C dest3 a + ) && + diff -r a dest3/a >/dev/null 2>&1 ) || { diff -r a dest3/a; exit 1; } ], [0],[],[],[],[],[gnu])