From: Jim Meyering Date: Wed, 17 Nov 2010 20:38:38 +0000 (+0100) Subject: tests: convert the multi-prog $VERBOSE/--version uses X-Git-Tag: v8.8~65 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8f9be76b0d6995919ee960ce5864715faa11ea5b;p=platform%2Fupstream%2Fcoreutils.git 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' --- diff --git a/tests/chmod/silent b/tests/chmod/silent index 20c232b..f56e347 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 a3b909a..3926757 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 bcee421..d3516f6 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 cb4709f..e5fdb09 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 909deb1..56de502 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 c08856c..8d5b85a 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 b24a97c..9483981 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 4a694c7..59c7803 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 13e0857..67dfdef 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 f055cb8..e7fadf9 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 75f5007..4157ab5 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 ed6c180..fadf44e 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 34ef633..c70753f 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 eb83b11..d86435a 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 7e49bca..0308282 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 3f67d6c..425718a 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 5bee53c..94a8927 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