From 8f9be76b0d6995919ee960ce5864715faa11ea5b Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 17 Nov 2010 21:38:38 +0100 Subject: [PATCH] tests: convert the multi-prog $VERBOSE/--version uses E.g., -test "$VERBOSE" = yes && { env -- pwd --version; readlink --version; } +print_ver_ pwd readlink -test "$VERBOSE" = yes && { stdbuf --version; mv --version; } +print_ver_ stdbuf mv Use this command: git grep -l 'VERBOSE.*--version'|xargs perl -ni \ -e '/^test "\$VERBOSE" = yes && { .*--version/ or print,next;' \ -e 's/env -- //g;' \ -e 's/test "\$VERBOSE" = yes && { /print_ver_ /;' \ -e ' s/(\w+) --version;/$1/g; s/ *}$//; print' --- tests/chmod/silent | 2 +- tests/cp/acl | 2 +- tests/cp/cp-mv-enotsup-xattr | 2 +- tests/cp/perm | 2 +- tests/ls/rt-1 | 2 +- tests/misc/env-null | 2 +- tests/misc/pwd-unreadable-parent | 2 +- tests/misc/stdbuf | 2 +- tests/misc/xattr | 2 +- tests/mkdir/selinux | 2 +- tests/mv/acl | 2 +- tests/mv/childproof | 2 +- tests/mv/dup-source | 2 +- tests/mv/hard-2 | 2 +- tests/mv/i-2 | 2 +- tests/mv/part-symlink | 2 +- tests/mv/update | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/chmod/silent b/tests/chmod/silent index 20c232b94a..f56e34774b 100755 --- a/tests/chmod/silent +++ b/tests/chmod/silent @@ -17,7 +17,7 @@ # along with this program. If not, see . . "${srcdir=.}/init.sh"; path_prepend_ ../src -test "$VERBOSE" = yes && { chgrp --version; chmod --version; chown --version; } +print_ver_ chgrp chmod chown chmod -f 0 no-such 2> out && fail=1 chgrp -f 0 no-such 2>> out && fail=1 diff --git a/tests/cp/acl b/tests/cp/acl index a3b909ae44..392675703d 100755 --- a/tests/cp/acl +++ b/tests/cp/acl @@ -18,7 +18,7 @@ # along with this program. If not, see . . "${srcdir=.}/init.sh"; path_prepend_ ../src -test "$VERBOSE" = yes && { mv --version; getfacl --version; setfacl --version; } +print_ver_ mv getfacl setfacl require_acl_ diff --git a/tests/cp/cp-mv-enotsup-xattr b/tests/cp/cp-mv-enotsup-xattr index bcee4214f9..d3516f6d6e 100755 --- a/tests/cp/cp-mv-enotsup-xattr +++ b/tests/cp/cp-mv-enotsup-xattr @@ -19,7 +19,7 @@ # along with this program. If not, see . . "${srcdir=.}/init.sh"; path_prepend_ ../src -test "$VERBOSE" = yes && { cp --version; mv --version; } +print_ver_ cp mv require_root_ diff --git a/tests/cp/perm b/tests/cp/perm index cb4709f505..e5fdb098d6 100755 --- a/tests/cp/perm +++ b/tests/cp/perm @@ -17,7 +17,7 @@ # along with this program. If not, see . . "${srcdir=.}/init.sh"; path_prepend_ ../src -test "$VERBOSE" = yes && { cp --version; mv --version; } +print_ver_ cp mv very_expensive_ diff --git a/tests/ls/rt-1 b/tests/ls/rt-1 index 909deb161a..56de502dbc 100755 --- a/tests/ls/rt-1 +++ b/tests/ls/rt-1 @@ -17,7 +17,7 @@ # along with this program. If not, see . . "${srcdir=.}/init.sh"; path_prepend_ ../src -test "$VERBOSE" = yes && { ls --version; touch --version; } +print_ver_ ls touch date=1998-01-15 diff --git a/tests/misc/env-null b/tests/misc/env-null index c08856c01e..8d5b85af69 100755 --- a/tests/misc/env-null +++ b/tests/misc/env-null @@ -17,7 +17,7 @@ # along with this program. If not, see . . "${srcdir=.}/init.sh"; path_prepend_ ../src -test "$VERBOSE" = yes && { env --version; env -- printenv --version; } +print_ver_ env printenv # 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/pwd-unreadable-parent b/tests/misc/pwd-unreadable-parent index b24a97c89c..9483981b98 100755 --- a/tests/misc/pwd-unreadable-parent +++ b/tests/misc/pwd-unreadable-parent @@ -19,7 +19,7 @@ # along with this program. If not, see . . "${srcdir=.}/init.sh"; path_prepend_ ../src -test "$VERBOSE" = yes && { env -- pwd --version; readlink --version; } +print_ver_ pwd readlink test $host_os != linux-gnu && skip_test_ 'vendor getcwd may be inadequate' diff --git a/tests/misc/stdbuf b/tests/misc/stdbuf index 4a694c7cde..59c7803708 100755 --- a/tests/misc/stdbuf +++ b/tests/misc/stdbuf @@ -17,7 +17,7 @@ # along with this program. If not, see . . "${srcdir=.}/init.sh"; path_prepend_ ../src -test "$VERBOSE" = yes && { stdbuf --version; mv --version; } +print_ver_ stdbuf mv getlimits_ require_built_ stdbuf diff --git a/tests/misc/xattr b/tests/misc/xattr index 13e0857a59..67dfdef510 100755 --- a/tests/misc/xattr +++ b/tests/misc/xattr @@ -19,7 +19,7 @@ # along with this program. If not, see . . "${srcdir=.}/init.sh"; path_prepend_ ../src -test "$VERBOSE" = yes && { cp --version; mv --version; ginstall --version; } +print_ver_ cp mv ginstall # Skip this test if cp was built without xattr support: touch src dest || framework_failure diff --git a/tests/mkdir/selinux b/tests/mkdir/selinux index f055cb8ac4..e7fadf9583 100755 --- a/tests/mkdir/selinux +++ b/tests/mkdir/selinux @@ -17,7 +17,7 @@ # along with this program. If not, see . . "${srcdir=.}/init.sh"; path_prepend_ ../src -test "$VERBOSE" = yes && { mkdir --version; mkfifo --version; mknod --version; } +print_ver_ mkdir mkfifo mknod # Note: on an SELinux/enforcing system running mcstransd older than # mcstrans-0.2.8-1.fc9, the following commands may mistakenly exit diff --git a/tests/mv/acl b/tests/mv/acl index 75f5007866..4157ab52b1 100755 --- a/tests/mv/acl +++ b/tests/mv/acl @@ -18,7 +18,7 @@ # along with this program. If not, see . . "${srcdir=.}/init.sh"; path_prepend_ ../src -test "$VERBOSE" = yes && { mv --version; getfacl --version; setfacl --version; } +print_ver_ mv getfacl setfacl require_acl_ diff --git a/tests/mv/childproof b/tests/mv/childproof index ed6c1802e2..fadf44ed5d 100755 --- a/tests/mv/childproof +++ b/tests/mv/childproof @@ -19,7 +19,7 @@ # along with this program. If not, see . . "${srcdir=.}/init.sh"; path_prepend_ ../src -test "$VERBOSE" = yes && { cp --version; mv --version; ln --version; } +print_ver_ cp mv ln skip_if_root_ diff --git a/tests/mv/dup-source b/tests/mv/dup-source index 34ef63332b..c70753f064 100755 --- a/tests/mv/dup-source +++ b/tests/mv/dup-source @@ -20,7 +20,7 @@ # along with this program. If not, see . . "${srcdir=.}/init.sh"; path_prepend_ ../src -test "$VERBOSE" = yes && { cp --version; mv --version; } +print_ver_ cp mv skip_if_root_ diff --git a/tests/mv/hard-2 b/tests/mv/hard-2 index eb83b117f2..d86435ab71 100755 --- a/tests/mv/hard-2 +++ b/tests/mv/hard-2 @@ -18,7 +18,7 @@ # along with this program. If not, see . . "${srcdir=.}/init.sh"; path_prepend_ ../src -test "$VERBOSE" = yes && { cp --version; mv --version; } +print_ver_ cp mv skip_if_root_ diff --git a/tests/mv/i-2 b/tests/mv/i-2 index 7e49bcadd5..0308282385 100755 --- a/tests/mv/i-2 +++ b/tests/mv/i-2 @@ -18,7 +18,7 @@ # along with this program. If not, see . . "${srcdir=.}/init.sh"; path_prepend_ ../src -test "$VERBOSE" = yes && { cp --version; mv --version; } +print_ver_ cp mv skip_if_root_ diff --git a/tests/mv/part-symlink b/tests/mv/part-symlink index 3f67d6cdd9..425718aff7 100755 --- a/tests/mv/part-symlink +++ b/tests/mv/part-symlink @@ -18,7 +18,7 @@ # along with this program. If not, see . . "${srcdir=.}/init.sh"; path_prepend_ ../src -test "$VERBOSE" = yes && { cp --version; mv --version; } +print_ver_ cp mv cleanup_() { rm -rf "$other_partition_tmpdir"; } . "$abs_srcdir/other-fs-tmpdir" diff --git a/tests/mv/update b/tests/mv/update index 5bee53cb2e..94a892701d 100755 --- a/tests/mv/update +++ b/tests/mv/update @@ -17,7 +17,7 @@ # along with this program. If not, see . . "${srcdir=.}/init.sh"; path_prepend_ ../src -test "$VERBOSE" = yes && { cp --version; mv --version; } +print_ver_ cp mv echo old > old || framework_failure touch -d yesterday old || framework_failure -- 2.47.2