From 8f9be76b0d6995919ee960ce5864715faa11ea5b Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 17 Nov 2010 21:38:38 +0100 Subject: 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(-) (limited to 'tests') diff --git a/tests/chmod/silent b/tests/chmod/silent index 20c232b94..f56e34774 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 a3b909ae4..392675703 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 bcee4214f..d3516f6d6 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 cb4709f50..e5fdb098d 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 909deb161..56de502db 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 c08856c01..8d5b85af6 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 b24a97c89..9483981b9 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 4a694c7cd..59c780370 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 13e0857a5..67dfdef51 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 f055cb8ac..e7fadf958 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 75f500786..4157ab52b 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 ed6c1802e..fadf44ed5 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 34ef63332..c70753f06 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 eb83b117f..d86435ab7 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 7e49bcadd..030828238 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 3f67d6cdd..425718aff 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 5bee53cb2..94a892701 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 -- cgit v1.2.3-70-g09d2