tests: convert the multi-prog $VERBOSE/--version uses
authorJim Meyering <meyering@redhat.com>
Wed, 17 Nov 2010 20:38:38 +0000 (21:38 +0100)
committerJim Meyering <meyering@redhat.com>
Wed, 17 Nov 2010 20:46:25 +0000 (21:46 +0100)
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'

17 files changed:
tests/chmod/silent
tests/cp/acl
tests/cp/cp-mv-enotsup-xattr
tests/cp/perm
tests/ls/rt-1
tests/misc/env-null
tests/misc/pwd-unreadable-parent
tests/misc/stdbuf
tests/misc/xattr
tests/mkdir/selinux
tests/mv/acl
tests/mv/childproof
tests/mv/dup-source
tests/mv/hard-2
tests/mv/i-2
tests/mv/part-symlink
tests/mv/update

index 20c232b..f56e347 100755 (executable)
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${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
index a3b909a..3926757 100755 (executable)
@@ -18,7 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/init.sh"; path_prepend_ ../src
-test "$VERBOSE" = yes && { mv --version; getfacl --version; setfacl --version; }
+print_ver_ mv getfacl setfacl
 
 require_acl_
 
index bcee421..d3516f6 100755 (executable)
@@ -19,7 +19,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/init.sh"; path_prepend_ ../src
-test "$VERBOSE" = yes && { cp --version; mv --version; }
+print_ver_ cp mv
 
 require_root_
 
index cb4709f..e5fdb09 100755 (executable)
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/init.sh"; path_prepend_ ../src
-test "$VERBOSE" = yes && { cp --version; mv --version; }
+print_ver_ cp mv
 
 very_expensive_
 
index 909deb1..56de502 100755 (executable)
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/init.sh"; path_prepend_ ../src
-test "$VERBOSE" = yes && { ls --version; touch --version; }
+print_ver_ ls touch
 
 date=1998-01-15
 
index c08856c..8d5b85a 100755 (executable)
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${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
index b24a97c..9483981 100755 (executable)
@@ -19,7 +19,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${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'
index 4a694c7..59c7803 100755 (executable)
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/init.sh"; path_prepend_ ../src
-test "$VERBOSE" = yes && { stdbuf --version; mv --version; }
+print_ver_ stdbuf mv
 
 getlimits_
 require_built_ stdbuf
index 13e0857..67dfdef 100755 (executable)
@@ -19,7 +19,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${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
index f055cb8..e7fadf9 100755 (executable)
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${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
index 75f5007..4157ab5 100755 (executable)
@@ -18,7 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/init.sh"; path_prepend_ ../src
-test "$VERBOSE" = yes && { mv --version; getfacl --version; setfacl --version; }
+print_ver_ mv getfacl setfacl
 
 require_acl_
 
index ed6c180..fadf44e 100755 (executable)
@@ -19,7 +19,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/init.sh"; path_prepend_ ../src
-test "$VERBOSE" = yes && { cp --version; mv --version; ln --version; }
+print_ver_ cp mv ln
 
 skip_if_root_
 
index 34ef633..c70753f 100755 (executable)
@@ -20,7 +20,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/init.sh"; path_prepend_ ../src
-test "$VERBOSE" = yes && { cp --version; mv --version; }
+print_ver_ cp mv
 
 skip_if_root_
 
index eb83b11..d86435a 100755 (executable)
@@ -18,7 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/init.sh"; path_prepend_ ../src
-test "$VERBOSE" = yes && { cp --version; mv --version; }
+print_ver_ cp mv
 
 skip_if_root_
 
index 7e49bca..0308282 100755 (executable)
@@ -18,7 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/init.sh"; path_prepend_ ../src
-test "$VERBOSE" = yes && { cp --version; mv --version; }
+print_ver_ cp mv
 
 skip_if_root_
 
index 3f67d6c..425718a 100755 (executable)
@@ -18,7 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${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"
index 5bee53c..94a8927 100755 (executable)
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${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