tests: convert 'if test "$VERBOSE" = yes; then' to test ... &&

This commit is contained in:
Jim Meyering 2010-11-14 12:02:39 +01:00
parent f38becab02
commit ff7f0ff85c
38 changed files with 59 additions and 235 deletions

View File

@ -16,14 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
chgrp --version
chmod --version
chown --version
fi
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && { chgrp --version; chmod --version; chown --version; }
chmod -f 0 no-such 2> out && fail=1
chgrp -f 0 no-such 2>> out && fail=1

View File

@ -17,16 +17,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Make sure we get English translations.
if test "$VERBOSE" = yes; then
set -x
mv --version
getfacl --version
setfacl --version
fi
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && { mv --version; getfacl --version; setfacl --version; }
require_acl_
# Skip this test if cp was built without ACL support:

View File

@ -16,14 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
cp --version
fi
# Ensure that ls sorts the same way for everyone.
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && cp --version
umask 022

View File

@ -18,13 +18,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
cp --version
mv --version
fi
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && { cp --version; mv --version; }
require_root_
cwd=`pwd`

View File

@ -16,13 +16,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
cp --version
mv --version
fi
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && { cp --version; mv --version; }
very_expensive_
umask 037

View File

@ -17,6 +17,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && cp --version
require_root_
# Some of the tests expect a umask that grants group and/or world read access.
@ -58,11 +60,6 @@ t1() {
"$nameless_uid" "$@"
}
if test "x$VERBOSE" = xyes; then
set -x
cp --version
fi
nameless_uid=`$PERL -le 'foreach my $i (1000..16*1024-1) { getpwuid $i or (print $i), exit }'`
nameless_gid1=`$PERL -le 'foreach my $i (1000..16*1024) { getgrgid $i or (print $i), exit }'`
nameless_gid2=`$PERL -le 'foreach my $i ('"$nameless_gid1"'+1..16*1024) { getgrgid $i or (print $i), exit }'`

View File

@ -16,13 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
ln --version
fi
# Make sure we get English translations.
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && ln --version
echo foo > a || framework_failure
ln -s . b || framework_failure

View File

@ -16,15 +16,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
ls --version
fi
: ${srcdir=.}
. $srcdir/require-perl
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && ls --version
require_root_
nameless_uid=`$PERL -e 'foreach my $i (1000..16*1024) { getpwuid $i or (print "$i\n"), exit }'`

View File

@ -16,14 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
ls --version
touch --version
fi
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && { ls --version; touch --version; }
date=1998-01-15

View File

@ -17,14 +17,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && arch --version
require_built_ arch
if test "$VERBOSE" = yes; then
set -x
arch --version
fi
arch > out || fail=1
uname -m > exp || fail=1

View File

@ -16,15 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
env --version
env -- printenv --version
fi
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && { env --version; env -- printenv --version; }
# POSIX is clear that environ may, but need not be, sorted.
# Environment variable values may contain newlines, which cannot be

View File

@ -18,12 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
. $srcdir/test-lib.sh
if test "$VERBOSE" = yes; then
set -x
md5sum --version
fi
test "$VERBOSE" = yes && md5sum --version
(mkdir tmp && cd tmp && seq 500 | xargs touch)

View File

@ -16,13 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
env -- printenv --version
fi
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && env -- printenv --version
# Without arguments, printenv behaves like env. Some shells provide
# printenv as a builtin, so we must invoke it via "env".

View File

@ -18,12 +18,9 @@
prog="$abs_top_builddir/src/printf"
if test "$VERBOSE" = yes; then
set -x
"$prog" --version
fi
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && env -- printf --version
getlimits_

View File

@ -16,18 +16,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
prog="$abs_top_builddir/src/printf"
if test "$VERBOSE" = yes; then
set -x
"$prog" --version
fi
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && env -- printf --version
"$prog" '\x7e3\n' > out || fail=1
env printf '\x7e3\n' > out || fail=1
cat <<\EOF > exp
~3
EOF

View File

@ -18,12 +18,9 @@
prog=printf
if test "$VERBOSE" = yes; then
set -x
env $prog --version
fi
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && env -- printf --version
require_ulimit_

View File

@ -21,6 +21,8 @@
. $srcdir/require-perl
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && env -- pwd --version
require_readable_root_
ARGV_0=$0

View File

@ -16,12 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
env -- pwd --version
fi
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && env -- pwd --version
mkdir -p a/b || framework_failure
ln -s a/b c || framework_failure

View File

@ -18,13 +18,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
env -- pwd --version
readlink --version
fi
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && { env -- pwd --version; readlink --version; }
test $host_os != linux-gnu &&
skip_test_ 'vendor getcwd may be inadequate'

View File

@ -16,16 +16,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
chcon --version
cp --version
ls --version
mv --version
stat --version
fi
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && for i in chcon cp ls mv stat; do $i --version; done
require_root_
require_selinux_
skip_if_mcstransd_is_running_

View File

@ -17,14 +17,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && { stdbuf --version; mv --version; }
getlimits_
require_built_ stdbuf
if test "$VERBOSE" = yes; then
set -x
stdbuf --version
fi
# stdbuf fails when the absolute top build dir name contains e.g., space, TAB, NL
lf='
'

View File

@ -16,13 +16,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
stty --version
fi
# Make sure there's a tty on stdin.
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && stty --version
require_controlling_input_terminal_
trap '' TTOU # Ignore SIGTTOU

View File

@ -16,14 +16,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This script takes no arguments.
if test "$VERBOSE" = yes; then
set -x
stty --version
fi
# Setting this envvar to a very small value used to cause e.g., `stty size'
# to generate slightly different output on certain systems.
COLUMNS=80
@ -37,6 +29,8 @@ LC_ALL=C
export LC_ALL
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && stty --version
require_controlling_input_terminal_
trap '' TTOU # Ignore SIGTTOU

View File

@ -17,14 +17,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && su --version
require_built_ su
if test "$VERBOSE" = yes; then
set -x
su --version
fi
# Very little that we can test without a root password
su --- / true # unknown option
test $? = 125 || fail=1

View File

@ -16,11 +16,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
sum --version
fi
: ${srcdir=.}
. $srcdir/require-perl
@ -31,7 +26,7 @@ LC_ALL=C
export LC_ALL
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && sum --version
# FYI, 16843009 is floor (2^32 / 255).

View File

@ -16,13 +16,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
truncate --version
fi
. $srcdir/envvar-check
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && truncate --version
require_root_
group_num=$(id -g $NON_ROOT_USERNAME)

View File

@ -18,12 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
. $srcdir/test-lib.sh
if test "$VERBOSE" = yes; then
set -x
md5sum --version
fi
test "$VERBOSE" = yes && md5sum --version
(mkdir tmp && cd tmp && seq 2000 | xargs touch)

View File

@ -18,14 +18,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
cp --version
mv --version
ginstall --version
fi
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && { cp --version; mv --version; ginstall --version; }
# Skip this test if cp was built without xattr support:
touch src dest || framework_failure

View File

@ -16,14 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
mkdir --version
mkfifo --version
mknod --version
fi
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && { mkdir --version; mkfifo --version; mknod --version; }
# Note: on an SELinux/enforcing system running mcstransd older than
# mcstrans-0.2.8-1.fc9, the following commands may mistakenly exit

View File

@ -17,14 +17,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
mv --version
getfacl --version
setfacl --version
fi
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && { mv --version; getfacl --version; setfacl --version; }
require_acl_
# Skip this test if cp was built without ACL support:

View File

@ -18,14 +18,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
cp --version
mv --version
ln --version
fi
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && { cp --version; mv --version; ln --version; }
skip_if_root_
mkdir a b c || framework_failure

View File

@ -16,13 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
mv --version
fi
# Make sure we get English translations.
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && mv --version
touch f1 || framework_failure
touch f2 || framework_failure

View File

@ -19,15 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
cp --version
mv --version
fi
. $srcdir/test-lib.sh
skip_if_root_
test "$VERBOSE" = yes && { cp --version; mv --version; }
skip_if_root_
for i in cp; do

View File

@ -17,13 +17,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
mv --version
cp --version
fi
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && { cp --version; mv --version; }
skip_if_root_
mkdir dst || framework_failure

View File

@ -17,16 +17,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
mv --version
cp --version
fi
# Make sure we get English translations.
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && { cp --version; mv --version; }
skip_if_root_
for i in a b c d e f g h; do

View File

@ -17,13 +17,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
mv --version
cp --version
fi
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && { cp --version; mv --version; }
cleanup_() { rm -rf "$other_partition_tmpdir"; }
. "$abs_srcdir/other-fs-tmpdir"

View File

@ -16,13 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
cp --version
mv --version
fi
. $srcdir/test-lib.sh
test "$VERBOSE" = yes && { cp --version; mv --version; }
echo old > old || framework_failure
touch -d yesterday old || framework_failure

View File

@ -20,7 +20,6 @@
test "$VERBOSE" = yes && rm --version
require_root_
# If used, these must *follow* test-lib.sh.
cleanup_()
{
# When you take the undesirable shortcut of making /etc/mtab a link