]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: convert 'if test "$VERBOSE" = yes; then' to test ... &&
authorJim Meyering <meyering@redhat.com>
Sun, 14 Nov 2010 11:02:39 +0000 (12:02 +0100)
committerJim Meyering <meyering@redhat.com>
Wed, 17 Nov 2010 19:48:57 +0000 (20:48 +0100)
38 files changed:
tests/chmod/silent
tests/cp/acl
tests/cp/cp-mv-backup
tests/cp/cp-mv-enotsup-xattr
tests/cp/perm
tests/cp/preserve-gid
tests/ln/sf-1
tests/ls/nameless-uid
tests/ls/rt-1
tests/misc/arch
tests/misc/env-null
tests/misc/md5sum-parallel
tests/misc/printenv
tests/misc/printf
tests/misc/printf-hex
tests/misc/printf-surprise
tests/misc/pwd-long
tests/misc/pwd-option
tests/misc/pwd-unreadable-parent
tests/misc/selinux
tests/misc/stdbuf
tests/misc/stty
tests/misc/stty-row-col
tests/misc/su-fail
tests/misc/sum-sysv
tests/misc/truncate-owned-by-other
tests/misc/wc-parallel
tests/misc/xattr
tests/mkdir/selinux
tests/mv/acl
tests/mv/childproof
tests/mv/diag
tests/mv/dup-source
tests/mv/hard-2
tests/mv/i-2
tests/mv/part-symlink
tests/mv/update
tests/rm/one-file-system

index 9f9f86f97fbb2dcceabd2d386f8e6a93ca5bdacf..2cfbcbbd750bc7e9965a667aa3c6b41a883c1ac8 100755 (executable)
 # 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
index c19eb4e935d064e91612f8d2ad3b14eac99896ca..3e93645abde908b9bd35c98dd6ae0449dbf1f42e 100755 (executable)
 # 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:
index 515c0c54c98956daee4489b96b7bb2d41fa95b83..c978ba253b19700f9e96b52ab84eb8122d734871 100755 (executable)
 # 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
 
index 7e7b6456fa4a68193cc6f35056ca1a718252379f..bd0ef0ed89d3a6efaa82a1bcefca655757d81bbe 100755 (executable)
 # 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`
index f68e529f74ca9cf77b897cb8bddd8924e4e87d7a..346b24536de98cff5f49f9b4d6b7dfdfaa35fcc3 100755 (executable)
 # 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
index f9a9d2a7e73f58ec1e963d75d3037367a0b16982..a5190e4e701cdcba9af021532e17622ff7464762 100755 (executable)
@@ -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 }'`
index 518990cabec4c52cf76ea2fa6ecd9ae1d5491d4d..fdfc3f711174434f34772448e5370fcaffdaaa8f 100755 (executable)
 # 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
index 55e8d16720c6af8f745e73b72c44c816d6929a3a..bf2dfcd52925d9474c6e1f0d524f4ec069ab9fd2 100755 (executable)
 # 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 }'`
index da632bbe52f35c30bc17a530d4d351bdc24e5891..51d023642bd455634e9d9c991a659394abe6be2e 100755 (executable)
 # 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
 
index b7164e455004dac625e5dc496bc18c902bb40b6d..a4475e6d0577a9df0ee92429229a437f31f0ee04 100755 (executable)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . $srcdir/test-lib.sh
-require_built_ arch
-
-if test "$VERBOSE" = yes; then
-  set -x
-  arch --version
-fi
+test "$VERBOSE" = yes && arch --version
 
+require_built_ arch
 
 arch > out || fail=1
 uname -m > exp || fail=1
index 53d1b62c57989cebfdc2f9c69a9c0192eab907ea..ed2e21d582a1d6cc9a499bc49127d828da55e7ed 100755 (executable)
 # 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
index 0243e8503bf09aa3c0a7121ff1b93265e89a8420..6f38b8b1bf47a7ad65d30e99a731de25631c7749 100755 (executable)
 # 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)
 
index f0e2cd25710720842fd6134310f91bd770f565d8..dd82c0509696918a435b14622527c8ed65b4d03a 100755 (executable)
 # 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".
index e8e4f2e5d41af95a3ab28947faf8fdec508edaf2..cf376f3baca65a3169974852c6dae09e83717b22 100755 (executable)
 
 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_
 
 
index e428d26052ff0df4f39e7bc3de547d9717caa645..39b70d6efc1965b63fa6120d10dd87b58cc24c56 100755 (executable)
 # 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
index 581a6d47a826d8f8de119f633bacb2520a9d56a5..702ab67a382ef702bef86e2bc3ecb276a26fc51d 100755 (executable)
 
 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_
 
 
index 5702552397579758dea0fd60c184808db5e0ae98..c58207abe58d1dbd5391c6b760284bc789eaa0c0 100755 (executable)
@@ -21,6 +21,8 @@
 . $srcdir/require-perl
 
 . $srcdir/test-lib.sh
+test "$VERBOSE" = yes && env -- pwd --version
+
 require_readable_root_
 
 ARGV_0=$0
index c1a28fef8af1119d8d789377e677cd159edf45a4..e4ecf11f96212fffd72433297f39e4476342b8f5 100755 (executable)
 # 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
index dc6dde418a198116330e3869515d3723149856e5..1f3d914eb05bd76c17e072a8c901af6f99ec565c 100755 (executable)
 # 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'
index 3729024fa12312cc91b7b02445f21a98ac3fca76..0a8259fef3e060c0f1d720e1ab4a21e7569c6b89 100755 (executable)
 # 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_
index 5822698ea1dd6699e4337d05a6255002fb8585d4..8302c4896ff128e71197db7c2da7bbb190aa3404 100755 (executable)
 # 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='
 '
index 28dd90e1250833927f365ba36e8e04f392e40378..0659d51a5e4dcf729bc553d349436731e7018d98 100755 (executable)
 # 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
 
index bb1153a2d89b3a6b9905b0dddbebfc360bfaa81a..5acb3d0bbc992390d80cd38452d296d4c457e2fa 100755 (executable)
 # 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
 
index c230f1754ed6763838d62d465af443090412d8f6..4c57c945b56c8cf7f716375a0b3ca926b8cae0db 100755 (executable)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . $srcdir/test-lib.sh
-require_built_ su
-
-if test "$VERBOSE" = yes; then
-  set -x
-  su --version
-fi
+test "$VERBOSE" = yes && su --version
 
+require_built_ su
 
 # Very little that we can test without a root password
 su --- / true # unknown option
index 3de278414ad14cb6b7e2a9bcdccf11f71aa9495e..705de2766e82edaf022c509f777c7ce3e36d04aa 100755 (executable)
 # 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).
 
index 3a8bde0375acba3ef10c25e641c8cb4da0fb2291..86fd5288e27e339007574ec0c5a55857f47bfd50 100755 (executable)
 # 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)
index 8afdb2aa6f52dffb16ebf47b01c9f27da3e35cbc..47f10441c9baeee6c7a8861f35d64a17e06d277b 100755 (executable)
 # 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)
 
index 21e0f1ccbeefbf4ff8b2f44f24f9ca7545b14331..3a27f15e0a2589120008be726c319a014227eb01 100755 (executable)
 # 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
index 674b0b3532c05a24c210604b7292ecf300be768a..b0240eb0a0ea3b4053f1249f56fbf9e77d94a33a 100755 (executable)
 # 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
index 16d7692f5750bbaef3ec1e7b99d2524f25a875ab..c67630ed0a7fcb18b8bc8c8b070a22e1dc991188 100755 (executable)
 # 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:
index 057ce91d4a798b23c58c162d83e251b1af0d3a52..2e5e4611c87148d225639299f6cddee8a0e39fc4 100755 (executable)
 # 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
index 1a23b5333dff35b16f1bb16a317cd92218726a0f..f40fc7c42b05b76a08de9785ee43c0bf6eafd263 100755 (executable)
 # 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
index ad947b4b5b42585efaed8a6c2b282751a9c6b459..9ede87ef62f6472d5af80580119a5c2601e13813 100755 (executable)
 # 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
 
index 1ae0a34eff63262eddcb9980346c0a28e18dc7e7..704e2679d41252ea3c645c6e72be3c706c55d316 100755 (executable)
 # 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
index aed1c9eee248b09e02289ce6ec43a93c3257fceb..83596426e29472f661f5b188aebe98a692bf81f1 100755 (executable)
 # 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
index 3b8e442efc3177c6f6a665410f50c37ac21bca18..bf2fd451ac8ddf125a9cab827d07fa8d3f757acd 100755 (executable)
 # 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"
 
index a8035922e850687d82f45a565c932a8529a44c8f..b0a532c635215d48b2f324e37375c0131df4048f 100755 (executable)
 # 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
index 8abf7dc7197a81ae8d8bbf169e883b18eb616ef6..371607be67dedcc477cbceb2679c60c33182f6e9 100755 (executable)
@@ -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