diff options
author | Jim Meyering <meyering@redhat.com> | 2010-11-14 11:05:05 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2010-11-17 20:48:57 +0100 |
commit | f38becab02472e6872048a1951b249b2a3c054df (patch) | |
tree | e5b531384b55abae8b1829ada892891bfee58fe3 /tests/mv | |
parent | 30b74dfff16240ea0e4a4c5b705f1e9631e5d0a7 (diff) | |
download | coreutils-f38becab02472e6872048a1951b249b2a3c054df.tar.xz |
tests: convert first batch of tests from test-lib.sh to init.sh
Initially, I did this,
git grep -l srcdir/test-lib.sh|xargs perl -p0i -e '~180-byte script'
but that line would have been much longer than the maximum permitted
by coreutils' commit hook, and wasn't readable besides, so here's a
more readable version:
lhs=$(printf '%s\\n' \
'if test "$VERBOSE" = yes; then' \
' set -x' \
' touch --version' \
'fi' \
'' \
'. $srcdir/test-lib.sh' \
| sed 's/\$/\\\$/g;s/touch/(\\w+)/')
rhs=$(printf '%s\\n' \
'. "${srcdir=.}/init.sh"; path_prepend_ ../src' \
'test "$VERBOSE" = yes && FIXME --version' \
| sed 's/\$/\\\$/g;s/FIXME/\$1/')
git grep -l srcdir/test-lib.sh|xargs perl -p0i -e "s,$lhs,$rhs,"
Diffstat (limited to 'tests/mv')
-rwxr-xr-x | tests/mv/atomic | 8 | ||||
-rwxr-xr-x | tests/mv/atomic2 | 8 | ||||
-rwxr-xr-x | tests/mv/backup-dir | 8 | ||||
-rwxr-xr-x | tests/mv/backup-is-src | 8 | ||||
-rwxr-xr-x | tests/mv/dir-file | 8 | ||||
-rwxr-xr-x | tests/mv/dir2dir | 8 | ||||
-rwxr-xr-x | tests/mv/force | 8 | ||||
-rwxr-xr-x | tests/mv/hard-3 | 8 | ||||
-rwxr-xr-x | tests/mv/hard-4 | 8 | ||||
-rwxr-xr-x | tests/mv/hard-link-1 | 8 | ||||
-rwxr-xr-x | tests/mv/hard-verbose | 8 | ||||
-rwxr-xr-x | tests/mv/i-3 | 8 | ||||
-rwxr-xr-x | tests/mv/i-4 | 8 | ||||
-rwxr-xr-x | tests/mv/i-5 | 8 | ||||
-rwxr-xr-x | tests/mv/i-link-no | 8 | ||||
-rwxr-xr-x | tests/mv/into-self | 8 | ||||
-rwxr-xr-x | tests/mv/into-self-2 | 8 | ||||
-rwxr-xr-x | tests/mv/into-self-3 | 8 | ||||
-rwxr-xr-x | tests/mv/into-self-4 | 8 | ||||
-rwxr-xr-x | tests/mv/leak-fd | 8 | ||||
-rwxr-xr-x | tests/mv/mv-n | 8 | ||||
-rwxr-xr-x | tests/mv/mv-special-1 | 8 | ||||
-rwxr-xr-x | tests/mv/no-target-dir | 8 | ||||
-rwxr-xr-x | tests/mv/part-fail | 8 | ||||
-rwxr-xr-x | tests/mv/part-hardlink | 8 | ||||
-rwxr-xr-x | tests/mv/part-rename | 8 | ||||
-rwxr-xr-x | tests/mv/partition-perm | 8 | ||||
-rwxr-xr-x | tests/mv/perm-1 | 8 | ||||
-rwxr-xr-x | tests/mv/sticky-to-xpart | 8 | ||||
-rwxr-xr-x | tests/mv/to-symlink | 8 | ||||
-rwxr-xr-x | tests/mv/trailing-slash | 8 |
31 files changed, 62 insertions, 186 deletions
diff --git a/tests/mv/atomic b/tests/mv/atomic index 1d313c59e..5df2d60fd 100755 --- a/tests/mv/atomic +++ b/tests/mv/atomic @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version require_strace_ unlink # Before the fix, mv would unnecessarily unlink the destination symlink: diff --git a/tests/mv/atomic2 b/tests/mv/atomic2 index 49949bd7c..4bc0e73fe 100755 --- a/tests/mv/atomic2 +++ b/tests/mv/atomic2 @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version require_strace_ unlink # Before the fix, mv would unnecessarily unlink the destination symlink: diff --git a/tests/mv/backup-dir b/tests/mv/backup-dir index 3c2bb5262..a96edc680 100755 --- a/tests/mv/backup-dir +++ b/tests/mv/backup-dir @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version mkdir A B || framework_failure touch X Y || framework_failure diff --git a/tests/mv/backup-is-src b/tests/mv/backup-is-src index 45ca17cbb..fe5c68049 100755 --- a/tests/mv/backup-is-src +++ b/tests/mv/backup-is-src @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version cleanup_() { rm -rf "$other_partition_tmpdir"; } . "$abs_srcdir/other-fs-tmpdir" diff --git a/tests/mv/dir-file b/tests/mv/dir-file index 4a0b37a4a..ebe2a673f 100755 --- a/tests/mv/dir-file +++ b/tests/mv/dir-file @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version mkdir -p dir/file || framework_failure > file || framework_failure diff --git a/tests/mv/dir2dir b/tests/mv/dir2dir index 8df625db5..de7770b5d 100755 --- a/tests/mv/dir2dir +++ b/tests/mv/dir2dir @@ -17,12 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version mkdir -p a/t b/t || framework_failure touch a/t/f || framework_failure diff --git a/tests/mv/force b/tests/mv/force index bebb04a26..708efcbf4 100755 --- a/tests/mv/force +++ b/tests/mv/force @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version ff=mvforce ff2=mvforce2 diff --git a/tests/mv/hard-3 b/tests/mv/hard-3 index bf6675fe9..61d71c1fa 100755 --- a/tests/mv/hard-3 +++ b/tests/mv/hard-3 @@ -30,12 +30,8 @@ # directory, because it requires use of the --preserve=link option that # mv enables by default. -if test "$VERBOSE" = yes; then - set -x - cp --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && cp --version skip_if_root_ mkdir -p x dst/x || framework_failure diff --git a/tests/mv/hard-4 b/tests/mv/hard-4 index d3a513af8..b22969eb4 100755 --- a/tests/mv/hard-4 +++ b/tests/mv/hard-4 @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version touch a || framework_failure ln a b || framework_failure diff --git a/tests/mv/hard-link-1 b/tests/mv/hard-link-1 index b3d5ce6d6..3d7c6abf0 100755 --- a/tests/mv/hard-link-1 +++ b/tests/mv/hard-link-1 @@ -17,12 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version cleanup_() { rm -rf "$other_partition_tmpdir"; } . "$abs_srcdir/other-fs-tmpdir" diff --git a/tests/mv/hard-verbose b/tests/mv/hard-verbose index 4c81752c6..8c0dfe0fa 100755 --- a/tests/mv/hard-verbose +++ b/tests/mv/hard-verbose @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version touch x || framework_failure ln x y || framework_failure diff --git a/tests/mv/i-3 b/tests/mv/i-3 index 7247d9432..fededda97 100755 --- a/tests/mv/i-3 +++ b/tests/mv/i-3 @@ -17,12 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version require_controlling_input_terminal_ skip_if_root_ trap '' TTIN # Ignore SIGTTIN diff --git a/tests/mv/i-4 b/tests/mv/i-4 index dfd7d8a1b..d5d746561 100755 --- a/tests/mv/i-4 +++ b/tests/mv/i-4 @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version for i in a b; do echo $i > $i || framework_failure diff --git a/tests/mv/i-5 b/tests/mv/i-5 index e1d8a5235..e73d4b209 100755 --- a/tests/mv/i-5 +++ b/tests/mv/i-5 @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version mkdir a || framework_failure touch b || framework_failure diff --git a/tests/mv/i-link-no b/tests/mv/i-link-no index e206d2ccc..2d7630109 100755 --- a/tests/mv/i-link-no +++ b/tests/mv/i-link-no @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version mkdir a b || framework_failure echo foo > a/foo || framework_failure diff --git a/tests/mv/into-self b/tests/mv/into-self index ea999d84b..2c28a2f71 100755 --- a/tests/mv/into-self +++ b/tests/mv/into-self @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version dir=toself-dir file=toself-file diff --git a/tests/mv/into-self-2 b/tests/mv/into-self-2 index 720bc9839..c5d1bd5c4 100755 --- a/tests/mv/into-self-2 +++ b/tests/mv/into-self-2 @@ -18,12 +18,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version cleanup_() { rm -rf "$other_partition_tmpdir"; } . "$abs_srcdir/other-fs-tmpdir" diff --git a/tests/mv/into-self-3 b/tests/mv/into-self-3 index d11365a99..8a506626c 100755 --- a/tests/mv/into-self-3 +++ b/tests/mv/into-self-3 @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version dir1=is3-dir1 dir2=is3-dir2 diff --git a/tests/mv/into-self-4 b/tests/mv/into-self-4 index 6182c8909..18a32dc59 100755 --- a/tests/mv/into-self-4 +++ b/tests/mv/into-self-4 @@ -17,12 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version touch file || framework_failure ln -s file s || framework_failure diff --git a/tests/mv/leak-fd b/tests/mv/leak-fd index 424f72517..3155397e7 100755 --- a/tests/mv/leak-fd +++ b/tests/mv/leak-fd @@ -18,12 +18,8 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # limit so don't run it by default. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version skip_if_root_ cleanup_() { rm -rf "$other_partition_tmpdir"; } . "$abs_srcdir/other-fs-tmpdir" diff --git a/tests/mv/mv-n b/tests/mv/mv-n index 5886341c0..32739dd9f 100755 --- a/tests/mv/mv-n +++ b/tests/mv/mv-n @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version # test miscellaneous combinations of -f -i -n parameters diff --git a/tests/mv/mv-special-1 b/tests/mv/mv-special-1 index 35bdc84c6..fe10acda7 100755 --- a/tests/mv/mv-special-1 +++ b/tests/mv/mv-special-1 @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version cleanup_() { rm -rf "$other_partition_tmpdir"; } . "$abs_srcdir/other-fs-tmpdir" diff --git a/tests/mv/no-target-dir b/tests/mv/no-target-dir index 080a290db..f1d886ba5 100755 --- a/tests/mv/no-target-dir +++ b/tests/mv/no-target-dir @@ -17,12 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version mkdir -p d/sub empty src d2/sub e2 || framework_failure touch f || framework_failure diff --git a/tests/mv/part-fail b/tests/mv/part-fail index 41240c073..c167076af 100755 --- a/tests/mv/part-fail +++ b/tests/mv/part-fail @@ -19,12 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version skip_if_root_ cleanup_() { t=$other_partition_tmpdir; chmod -R 700 "$t"; rm -rf "$t"; } . "$abs_srcdir/other-fs-tmpdir" diff --git a/tests/mv/part-hardlink b/tests/mv/part-hardlink index 5b372d421..b97b0a0b5 100755 --- a/tests/mv/part-hardlink +++ b/tests/mv/part-hardlink @@ -19,12 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version cleanup_() { rm -rf "$other_partition_tmpdir"; } . "$abs_srcdir/other-fs-tmpdir" diff --git a/tests/mv/part-rename b/tests/mv/part-rename index ff32aa9b4..3f18045b4 100755 --- a/tests/mv/part-rename +++ b/tests/mv/part-rename @@ -18,12 +18,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version cleanup_() { rm -rf "$other_partition_tmpdir"; } . "$abs_srcdir/other-fs-tmpdir" diff --git a/tests/mv/partition-perm b/tests/mv/partition-perm index 27007bdbc..01b1697d4 100755 --- a/tests/mv/partition-perm +++ b/tests/mv/partition-perm @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version cleanup_() { rm -rf "$other_partition_tmpdir"; } . "$abs_srcdir/other-fs-tmpdir" diff --git a/tests/mv/perm-1 b/tests/mv/perm-1 index 84b5828fd..fda23ed2d 100755 --- a/tests/mv/perm-1 +++ b/tests/mv/perm-1 @@ -17,12 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version skip_if_root_ mkdir -p no-write/dir || framework_failure diff --git a/tests/mv/sticky-to-xpart b/tests/mv/sticky-to-xpart index fbb6ab29b..513c32565 100755 --- a/tests/mv/sticky-to-xpart +++ b/tests/mv/sticky-to-xpart @@ -19,12 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version require_root_ cleanup_() { rm -rf "$other_partition_tmpdir"; } diff --git a/tests/mv/to-symlink b/tests/mv/to-symlink index d9d77a83f..5530eee4f 100755 --- a/tests/mv/to-symlink +++ b/tests/mv/to-symlink @@ -17,12 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version cleanup_() { rm -rf "$other_partition_tmpdir"; } . "$abs_srcdir/other-fs-tmpdir" diff --git a/tests/mv/trailing-slash b/tests/mv/trailing-slash index c23fbdb73..b0b362c8f 100755 --- a/tests/mv/trailing-slash +++ b/tests/mv/trailing-slash @@ -19,12 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - mv --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mv --version mkdir foo || framework_failure |