From ff7f0ff85c40174f1885ec61fa4ab6b73d02b555 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 14 Nov 2010 12:02:39 +0100 Subject: tests: convert 'if test "$VERBOSE" = yes; then' to test ... && --- tests/misc/arch | 8 ++------ tests/misc/env-null | 9 +-------- tests/misc/md5sum-parallel | 7 +------ tests/misc/printenv | 7 +------ tests/misc/printf | 7 ++----- tests/misc/printf-hex | 12 ++---------- tests/misc/printf-surprise | 7 ++----- tests/misc/pwd-long | 2 ++ tests/misc/pwd-option | 6 +----- tests/misc/pwd-unreadable-parent | 7 +------ tests/misc/selinux | 11 ++--------- tests/misc/stdbuf | 7 ++----- tests/misc/stty | 7 ++----- tests/misc/stty-row-col | 10 ++-------- tests/misc/su-fail | 8 ++------ tests/misc/sum-sysv | 7 +------ tests/misc/truncate-owned-by-other | 8 ++------ tests/misc/wc-parallel | 7 +------ tests/misc/xattr | 8 +------- 19 files changed, 30 insertions(+), 115 deletions(-) (limited to 'tests/misc') diff --git a/tests/misc/arch b/tests/misc/arch index b7164e455..a4475e6d0 100755 --- a/tests/misc/arch +++ b/tests/misc/arch @@ -17,13 +17,9 @@ # along with this program. If not, see . . $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 diff --git a/tests/misc/env-null b/tests/misc/env-null index 53d1b62c5..ed2e21d58 100755 --- a/tests/misc/env-null +++ b/tests/misc/env-null @@ -16,15 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . - -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 diff --git a/tests/misc/md5sum-parallel b/tests/misc/md5sum-parallel index 0243e8503..6f38b8b1b 100755 --- a/tests/misc/md5sum-parallel +++ b/tests/misc/md5sum-parallel @@ -18,12 +18,7 @@ # along with this program. If not, see . . $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) diff --git a/tests/misc/printenv b/tests/misc/printenv index f0e2cd257..dd82c0509 100755 --- a/tests/misc/printenv +++ b/tests/misc/printenv @@ -16,13 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -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". diff --git a/tests/misc/printf b/tests/misc/printf index e8e4f2e5d..cf376f3ba 100755 --- a/tests/misc/printf +++ b/tests/misc/printf @@ -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_ diff --git a/tests/misc/printf-hex b/tests/misc/printf-hex index e428d2605..39b70d6ef 100755 --- a/tests/misc/printf-hex +++ b/tests/misc/printf-hex @@ -16,18 +16,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -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 diff --git a/tests/misc/printf-surprise b/tests/misc/printf-surprise index 581a6d47a..702ab67a3 100755 --- a/tests/misc/printf-surprise +++ b/tests/misc/printf-surprise @@ -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_ diff --git a/tests/misc/pwd-long b/tests/misc/pwd-long index 570255239..c58207abe 100755 --- a/tests/misc/pwd-long +++ b/tests/misc/pwd-long @@ -21,6 +21,8 @@ . $srcdir/require-perl . $srcdir/test-lib.sh +test "$VERBOSE" = yes && env -- pwd --version + require_readable_root_ ARGV_0=$0 diff --git a/tests/misc/pwd-option b/tests/misc/pwd-option index c1a28fef8..e4ecf11f9 100755 --- a/tests/misc/pwd-option +++ b/tests/misc/pwd-option @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -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 diff --git a/tests/misc/pwd-unreadable-parent b/tests/misc/pwd-unreadable-parent index dc6dde418..1f3d914eb 100755 --- a/tests/misc/pwd-unreadable-parent +++ b/tests/misc/pwd-unreadable-parent @@ -18,13 +18,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -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' diff --git a/tests/misc/selinux b/tests/misc/selinux index 3729024fa..0a8259fef 100755 --- a/tests/misc/selinux +++ b/tests/misc/selinux @@ -16,16 +16,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -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_ diff --git a/tests/misc/stdbuf b/tests/misc/stdbuf index 5822698ea..8302c4896 100755 --- a/tests/misc/stdbuf +++ b/tests/misc/stdbuf @@ -17,14 +17,11 @@ # along with this program. If not, see . . $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=' ' diff --git a/tests/misc/stty b/tests/misc/stty index 28dd90e12..0659d51a5 100755 --- a/tests/misc/stty +++ b/tests/misc/stty @@ -16,13 +16,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -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 diff --git a/tests/misc/stty-row-col b/tests/misc/stty-row-col index bb1153a2d..5acb3d0bb 100755 --- a/tests/misc/stty-row-col +++ b/tests/misc/stty-row-col @@ -16,14 +16,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . - -# 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 diff --git a/tests/misc/su-fail b/tests/misc/su-fail index c230f1754..4c57c945b 100755 --- a/tests/misc/su-fail +++ b/tests/misc/su-fail @@ -17,13 +17,9 @@ # along with this program. If not, see . . $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 diff --git a/tests/misc/sum-sysv b/tests/misc/sum-sysv index 3de278414..705de2766 100755 --- a/tests/misc/sum-sysv +++ b/tests/misc/sum-sysv @@ -16,11 +16,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -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). diff --git a/tests/misc/truncate-owned-by-other b/tests/misc/truncate-owned-by-other index 3a8bde037..86fd5288e 100755 --- a/tests/misc/truncate-owned-by-other +++ b/tests/misc/truncate-owned-by-other @@ -16,13 +16,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -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) diff --git a/tests/misc/wc-parallel b/tests/misc/wc-parallel index 8afdb2aa6..47f10441c 100755 --- a/tests/misc/wc-parallel +++ b/tests/misc/wc-parallel @@ -18,12 +18,7 @@ # along with this program. If not, see . . $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) diff --git a/tests/misc/xattr b/tests/misc/xattr index 21e0f1ccb..3a27f15e0 100755 --- a/tests/misc/xattr +++ b/tests/misc/xattr @@ -18,14 +18,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -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 -- cgit v1.2.3-54-g00ecf