diff options
author | Jim Meyering <meyering@redhat.com> | 2012-04-03 20:32:44 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2012-04-04 12:20:56 +0200 |
commit | e43d30eab3215bc9ff49ec7db3d3e2baa95ba070 (patch) | |
tree | b3828ca5bdc794f9b8648af1996d2863663c8590 /tests/init.cfg | |
parent | 64ecea53d9b4c1ecbf6d02ff8c4ae98b3a82e9a2 (diff) | |
download | coreutils-e43d30eab3215bc9ff49ec7db3d3e2baa95ba070.tar.xz |
tests: convert nearly all `...` expressions to $(...)
Exempt init.sh because it runs before we're assured to have a
shell that groks $(...). Exempt *.mk because "$" would have to
be doubled, and besides, any `...` expression in a .mk file is
almost certainly evaluated before init.sh is run. Finally, also
exempt the perl-based tests, because perl's `...` cannot be
converted to $(...). Do that by running this command:
git grep -l '`.*`' tests \
| grep -Ev 'init\.sh|\.mk$' | xargs grep -Lw perl \
| xargs perl -pi -e 's/`(.*?)`/\$($1)/g'
One minor fix-up change was required after that, due to how
quoting differs:
diff --git a/tests/chmod/equals b/tests/chmod/equals
- expected_perms=$(eval 'echo \$expected_'$dest)
+ expected_perms=$(eval 'echo $expected_'$dest)
Another was to make these required quoting adjustments:
diff --git a/tests/misc/stty b/tests/misc/stty
...
- rev=$(eval echo "\\\$REV_$opt")
+ rev=$(eval echo "\$REV_$opt")
...
- rev1=$(eval echo "\\\$REV_$opt1")
- rev2=$(eval echo "\\\$REV_$opt2")
+ rev1=$(eval echo "\$REV_$opt1")
+ rev2=$(eval echo "\$REV_$opt2")
Also, transform two files that were needlessly excluded above:
(both use perl, but are mostly bourne shell)
perl -pi -e 's/`(.*?)`/\$($1)/g' \
tests/du/long-from-unreadable tests/init.cfg
Diffstat (limited to 'tests/init.cfg')
-rw-r--r-- | tests/init.cfg | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/init.cfg b/tests/init.cfg index 17713d924..7bcd512a3 100644 --- a/tests/init.cfg +++ b/tests/init.cfg @@ -235,9 +235,9 @@ rwx_to_mode_() s='s/S/@/;s/s/x@/;s/@/s/' t='s/T/@/;s/t/x@/;s/@/t/' - u=`echo $rwx|sed 's/^.\(...\).*/,u=\1/;s/-//g;s/^,u=$//;'$s` - g=`echo $rwx|sed 's/^....\(...\).*/,g=\1/;s/-//g;s/^,g=$//;'$s` - o=`echo $rwx|sed 's/^.......\(...\).*/,o=\1/;s/-//g;s/^,o=$//;'$s';'$t` + u=$(echo $rwx|sed 's/^.\(...\).*/,u=\1/;s/-//g;s/^,u=$//;'$s) + g=$(echo $rwx|sed 's/^....\(...\).*/,g=\1/;s/-//g;s/^,g=$//;'$s) + o=$(echo $rwx|sed 's/^.......\(...\).*/,o=\1/;s/-//g;s/^,o=$//;'$s';'$t) echo "=$u$g$o" } @@ -259,7 +259,7 @@ require_selinux_() # Independent of whether SELinux is enabled system-wide, # the current file system may lack SELinux support. - case `ls -Zd .` in + case $(ls -Zd .) in '? .'|'unlabeled .') skip_ "this system (or maybe just" \ "the current file system) lacks SELinux support" @@ -316,7 +316,7 @@ require_membership_in_two_groups_() { test $# = 0 || framework_failure_ - groups=${COREUTILS_GROUPS-`(id -G || /usr/xpg4/bin/id -G) 2>/dev/null`} + groups=${COREUTILS_GROUPS-$( (id -G || /usr/xpg4/bin/id -G) 2>/dev/null)} case "$groups" in *' '*) ;; *) skip_ 'requires membership in two groups @@ -389,7 +389,7 @@ require_sparse_support_() # NTFS requires 128K before a hole appears in a sparse file. t=sparse.$$ dd bs=1 seek=128K of=$t < /dev/null 2> /dev/null - set x `du -sk $t` + set x $(du -sk $t) kb_size=$2 rm -f $t if test $kb_size -ge 128; then @@ -447,7 +447,7 @@ working_umask_or_skip_() umask 022 touch file1 file2 chmod 644 file2 - perms=`ls -l file1 file2 | sed 's/ .*//' | uniq` + perms=$(ls -l file1 file2 | sed 's/ .*//' | uniq) rm -f file1 file2 case $perms in @@ -463,7 +463,7 @@ working_umask_or_skip_() # an initial delay of .1 second and call it at most 6 times # with a max delay of 3.2s (doubled each time), or a total of 6.3s # Note ensure you do _not_ quote the parameter to GNU sleep in -# your function, as it may contain separate values that `sleep` +# your function, as it may contain separate values that sleep # needs to accumulate. retry_delay_() { |