tests: convert nearly all `...` expressions to $(...)
commite43d30eab3215bc9ff49ec7db3d3e2baa95ba070
authorJim Meyering <meyering@redhat.com>
Tue, 3 Apr 2012 18:32:44 +0000 (3 20:32 +0200)
committerJim Meyering <meyering@redhat.com>
Wed, 4 Apr 2012 10:20:56 +0000 (4 12:20 +0200)
treeb3828ca5bdc794f9b8648af1996d2863663c8590
parent64ecea53d9b4c1ecbf6d02ff8c4ae98b3a82e9a2
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
124 files changed:
tests/chgrp/basic
tests/chgrp/default-no-deref
tests/chgrp/deref
tests/chgrp/posix-H
tests/chgrp/recurse
tests/chmod/c-option
tests/chmod/equal-x
tests/chmod/equals
tests/chmod/setgid
tests/chmod/usage
tests/chown/basic
tests/chown/deref
tests/chown/preserve-root
tests/chown/separator
tests/cp/acl
tests/cp/cp-a-selinux
tests/cp/cp-mv-backup
tests/cp/cp-mv-enotsup-xattr
tests/cp/cp-parents
tests/cp/fail-perm
tests/cp/fiemap-empty
tests/cp/file-perm-race
tests/cp/link-preserve
tests/cp/link-symlink
tests/cp/no-deref-link1
tests/cp/no-deref-link2
tests/cp/no-deref-link3
tests/cp/parent-perm-race
tests/cp/perm
tests/cp/preserve-gid
tests/cp/preserve-link
tests/cp/r-vs-symlink
tests/cp/same-file
tests/cp/sparse
tests/cp/special-bits
tests/cp/symlink-slash
tests/dd/bytes
tests/dd/misc
tests/dd/not-rewound
tests/dd/skip-seek2
tests/du/2g
tests/du/8gb
tests/du/basic
tests/du/deref
tests/du/inaccessible-cwd
tests/du/long-from-unreadable
tests/du/long-sloop
tests/du/slink
tests/init.cfg
tests/install/basic-1
tests/install/trap
tests/ln/hard-to-sym
tests/ln/misc
tests/ln/sf-1
tests/ls/inode
tests/ls/nameless-uid
tests/ls/stat-dtype
tests/ls/stat-vs-dirent
tests/ls/symlink-slash
tests/misc/close-stdout
tests/misc/date-sec
tests/misc/df
tests/misc/env
tests/misc/head-c
tests/misc/ls-time
tests/misc/mknod
tests/misc/nice
tests/misc/nohup
tests/misc/od-multiple-t
tests/misc/runcon-no-reorder
tests/misc/selinux
tests/misc/shuf
tests/misc/sort-compress
tests/misc/sort-merge-fdlimit
tests/misc/sort-rand
tests/misc/stat-fmt
tests/misc/stty
tests/misc/stty-invalid
tests/misc/stty-row-col
tests/misc/tee
tests/misc/timeout
tests/mkdir/p-1
tests/mkdir/p-2
tests/mkdir/p-3
tests/mkdir/parents
tests/mkdir/perm
tests/mkdir/special-1
tests/mv/acl
tests/mv/atomic
tests/mv/atomic2
tests/mv/childproof
tests/mv/force
tests/mv/hard-2
tests/mv/hard-3
tests/mv/hard-link-1
tests/mv/i-2
tests/mv/i-3
tests/mv/i-4
tests/mv/i-link-no
tests/mv/leak-fd
tests/mv/part-hardlink
tests/mv/part-symlink
tests/mv/partition-perm
tests/mv/to-symlink
tests/mv/update
tests/other-fs-tmpdir
tests/readlink/can-e
tests/readlink/can-f
tests/readlink/can-m
tests/readlink/rl-1
tests/rm/hash
tests/rm/inaccessible
tests/rm/ir-1
tests/rm/read-only
tests/rm/readdir-bug
tests/rm/unread3
tests/rmdir/ignore
tests/tail-2/assert
tests/tail-2/assert-2
tests/touch/dangling-symlink
tests/touch/empty-file
tests/touch/no-dereference
tests/touch/no-rights
tests/touch/trailing-slash