summaryrefslogtreecommitdiff
path: root/tests/mv
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2016-01-20 10:55:18 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2016-01-20 10:55:18 +0000
commit70e9163c9c18e995515598085cb824e554eb7ae7 (patch)
treea42dc8b2a6c031354bf31472de888bfc8a060132 /tests/mv
parentcbf5993c43f49281173f185863577d86bfac6eae (diff)
downloadcoreutils-tarball-master.tar.gz
Diffstat (limited to 'tests/mv')
-rw-r--r--tests/mv/Makefile.am50
-rw-r--r--tests/mv/Makefile.in761
-rwxr-xr-xtests/mv/acl105
-rwxr-xr-xtests/mv/acl.sh67
-rwxr-xr-xtests/mv/atomic69
-rwxr-xr-xtests/mv/atomic.sh46
-rwxr-xr-xtests/mv/atomic2.sh45
-rwxr-xr-xtests/mv/backup-dir57
-rwxr-xr-xtests/mv/backup-dir.sh34
-rwxr-xr-xtests/mv/backup-is-src66
-rwxr-xr-xtests/mv/backup-is-src.sh46
-rwxr-xr-xtests/mv/childproof.sh (renamed from tests/mv/childproof)79
-rwxr-xr-xtests/mv/diag70
-rwxr-xr-xtests/mv/diag.sh48
-rwxr-xr-xtests/mv/dir-file47
-rwxr-xr-xtests/mv/dir-file.sh30
-rwxr-xr-xtests/mv/dir2dir66
-rwxr-xr-xtests/mv/dir2dir.sh42
-rwxr-xr-xtests/mv/dup-source90
-rwxr-xr-xtests/mv/dup-source.sh91
-rwxr-xr-xtests/mv/force58
-rwxr-xr-xtests/mv/force.sh43
-rwxr-xr-xtests/mv/hard-2.sh (renamed from tests/mv/hard-2)66
-rwxr-xr-xtests/mv/hard-3.sh (renamed from tests/mv/hard-3)58
-rwxr-xr-xtests/mv/hard-459
-rwxr-xr-xtests/mv/hard-4.sh41
-rwxr-xr-xtests/mv/hard-link-168
-rwxr-xr-xtests/mv/hard-link-1.sh41
-rwxr-xr-xtests/mv/hard-verbose56
-rwxr-xr-xtests/mv/hardlink-case.sh37
-rwxr-xr-xtests/mv/i-1.pl (renamed from tests/mv/i-1)34
-rwxr-xr-xtests/mv/i-277
-rwxr-xr-xtests/mv/i-2.sh52
-rwxr-xr-xtests/mv/i-3.sh72
-rwxr-xr-xtests/mv/i-472
-rwxr-xr-xtests/mv/i-4.sh47
-rwxr-xr-xtests/mv/i-551
-rwxr-xr-xtests/mv/i-5.sh29
-rwxr-xr-xtests/mv/i-link-no70
-rwxr-xr-xtests/mv/i-link-no.sh43
-rwxr-xr-xtests/mv/into-self-276
-rwxr-xr-xtests/mv/into-self-2.sh52
-rwxr-xr-xtests/mv/into-self-357
-rwxr-xr-xtests/mv/into-self-3.sh41
-rwxr-xr-xtests/mv/into-self-454
-rwxr-xr-xtests/mv/into-self-4.sh34
-rwxr-xr-xtests/mv/into-self.sh (renamed from tests/mv/into-self)42
-rwxr-xr-xtests/mv/leak-fd81
-rwxr-xr-xtests/mv/leak-fd.sh55
-rwxr-xr-xtests/mv/mv-n.sh57
-rwxr-xr-xtests/mv/mv-special-197
-rwxr-xr-xtests/mv/mv-special-1.sh72
-rwxr-xr-xtests/mv/no-target-dir70
-rwxr-xr-xtests/mv/no-target-dir.sh51
-rwxr-xr-xtests/mv/part-fail79
-rwxr-xr-xtests/mv/part-fail.sh55
-rwxr-xr-xtests/mv/part-hardlink67
-rwxr-xr-xtests/mv/part-hardlink.sh43
-rwxr-xr-xtests/mv/part-rename55
-rwxr-xr-xtests/mv/part-rename.sh57
-rwxr-xr-xtests/mv/part-symlink229
-rwxr-xr-xtests/mv/part-symlink.sh262
-rwxr-xr-xtests/mv/partition-perm55
-rwxr-xr-xtests/mv/partition-perm.sh37
-rwxr-xr-xtests/mv/perm-157
-rwxr-xr-xtests/mv/perm-1.sh35
-rwxr-xr-xtests/mv/reply-no58
-rwxr-xr-xtests/mv/sticky-to-xpart.sh68
-rwxr-xr-xtests/mv/symlink-onto-hardlink-to-self.sh63
-rwxr-xr-xtests/mv/symlink-onto-hardlink.sh41
-rwxr-xr-xtests/mv/to-symlink63
-rwxr-xr-xtests/mv/to-symlink.sh43
-rwxr-xr-xtests/mv/trailing-slash.sh (renamed from tests/mv/trailing-slash)58
-rwxr-xr-xtests/mv/update71
-rwxr-xr-xtests/mv/update.sh54
-rw-r--r--tests/mv/vfat66
76 files changed, 2097 insertions, 3341 deletions
diff --git a/tests/mv/Makefile.am b/tests/mv/Makefile.am
deleted file mode 100644
index 71c9119..0000000
--- a/tests/mv/Makefile.am
+++ /dev/null
@@ -1,50 +0,0 @@
-# Make coreutils tests for "mv". -*-Makefile-*-
-
-# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
-# Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-TESTS = \
- hard-verbose \
- backup-dir \
- dir2dir \
- no-target-dir \
- atomic \
- acl \
- reply-no \
- leak-fd \
- part-hardlink \
- hard-4 \
- hard-3 \
- hard-2 \
- perm-1 \
- i-link-no \
- part-fail \
- dup-source childproof i-4 i-5 update i-2 mv-special-1 \
- into-self into-self-2 into-self-3 into-self-4 \
- backup-is-src \
- i-1 hard-link-1 force partition-perm to-symlink dir-file diag \
- part-symlink part-rename trailing-slash
-
-EXTRA_DIST = $(TESTS) vfat
-TESTS_ENVIRONMENT = \
- PERL="$(PERL)" \
- EGREP="$(EGREP)" \
- CU_TEST_NAME=`basename $(abs_srcdir)`,$$tst \
- PATH="$(VG_PATH_PREFIX)`pwd`/../../src$(PATH_SEPARATOR)$$PATH" \
- CONFIG_HEADER=$(CONFIG_HEADER) \
- PROG=mv
diff --git a/tests/mv/Makefile.in b/tests/mv/Makefile.in
deleted file mode 100644
index b86230a..0000000
--- a/tests/mv/Makefile.in
+++ /dev/null
@@ -1,761 +0,0 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-# Make coreutils tests for "mv". -*-Makefile-*-
-
-# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
-# Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-subdir = tests/mv
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/absolute-header.m4 \
- $(top_srcdir)/m4/acl.m4 $(top_srcdir)/m4/alloca.m4 \
- $(top_srcdir)/m4/allocsa.m4 $(top_srcdir)/m4/argmatch.m4 \
- $(top_srcdir)/m4/arpa_inet_h.m4 $(top_srcdir)/m4/assert.m4 \
- $(top_srcdir)/m4/atexit.m4 $(top_srcdir)/m4/autobuild.m4 \
- $(top_srcdir)/m4/backupfile.m4 $(top_srcdir)/m4/base64.m4 \
- $(top_srcdir)/m4/bison.m4 $(top_srcdir)/m4/boottime.m4 \
- $(top_srcdir)/m4/c-strtod.m4 $(top_srcdir)/m4/calloc.m4 \
- $(top_srcdir)/m4/canon-host.m4 \
- $(top_srcdir)/m4/canonicalize.m4 \
- $(top_srcdir)/m4/chdir-long.m4 $(top_srcdir)/m4/check-decl.m4 \
- $(top_srcdir)/m4/chown.m4 $(top_srcdir)/m4/clock_time.m4 \
- $(top_srcdir)/m4/cloexec.m4 $(top_srcdir)/m4/close-stream.m4 \
- $(top_srcdir)/m4/closeout.m4 $(top_srcdir)/m4/codeset.m4 \
- $(top_srcdir)/m4/config-h.m4 $(top_srcdir)/m4/cycle-check.m4 \
- $(top_srcdir)/m4/d-ino.m4 $(top_srcdir)/m4/d-type.m4 \
- $(top_srcdir)/m4/dirfd.m4 $(top_srcdir)/m4/dirname.m4 \
- $(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/double-slash-root.m4 \
- $(top_srcdir)/m4/dup2.m4 $(top_srcdir)/m4/eealloc.m4 \
- $(top_srcdir)/m4/eoverflow.m4 $(top_srcdir)/m4/error.m4 \
- $(top_srcdir)/m4/euidaccess-stat.m4 \
- $(top_srcdir)/m4/euidaccess.m4 $(top_srcdir)/m4/exclude.m4 \
- $(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \
- $(top_srcdir)/m4/fchdir.m4 $(top_srcdir)/m4/fcntl-safer.m4 \
- $(top_srcdir)/m4/fcntl_h.m4 $(top_srcdir)/m4/fd-reopen.m4 \
- $(top_srcdir)/m4/file-type.m4 $(top_srcdir)/m4/fileblocks.m4 \
- $(top_srcdir)/m4/filemode.m4 $(top_srcdir)/m4/filenamecat.m4 \
- $(top_srcdir)/m4/flexmember.m4 $(top_srcdir)/m4/fnmatch.m4 \
- $(top_srcdir)/m4/fpending.m4 $(top_srcdir)/m4/fprintftime.m4 \
- $(top_srcdir)/m4/free.m4 $(top_srcdir)/m4/fstypename.m4 \
- $(top_srcdir)/m4/fsusage.m4 $(top_srcdir)/m4/ftruncate.m4 \
- $(top_srcdir)/m4/fts.m4 $(top_srcdir)/m4/getaddrinfo.m4 \
- $(top_srcdir)/m4/getcwd-abort-bug.m4 \
- $(top_srcdir)/m4/getcwd-path-max.m4 $(top_srcdir)/m4/getcwd.m4 \
- $(top_srcdir)/m4/getdate.m4 $(top_srcdir)/m4/getdelim.m4 \
- $(top_srcdir)/m4/getgroups.m4 $(top_srcdir)/m4/gethostname.m4 \
- $(top_srcdir)/m4/gethrxtime.m4 $(top_srcdir)/m4/getline.m4 \
- $(top_srcdir)/m4/getloadavg.m4 $(top_srcdir)/m4/getndelim2.m4 \
- $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/getpagesize.m4 \
- $(top_srcdir)/m4/getpass.m4 $(top_srcdir)/m4/gettext.m4 \
- $(top_srcdir)/m4/gettime.m4 $(top_srcdir)/m4/gettimeofday.m4 \
- $(top_srcdir)/m4/getugroups.m4 \
- $(top_srcdir)/m4/getusershell.m4 $(top_srcdir)/m4/glibc21.m4 \
- $(top_srcdir)/m4/gnulib-common.m4 \
- $(top_srcdir)/m4/gnulib-comp.m4 \
- $(top_srcdir)/m4/group-member.m4 \
- $(top_srcdir)/m4/hard-locale.m4 $(top_srcdir)/m4/hash.m4 \
- $(top_srcdir)/m4/host-os.m4 $(top_srcdir)/m4/human.m4 \
- $(top_srcdir)/m4/i-ring.m4 $(top_srcdir)/m4/iconv.m4 \
- $(top_srcdir)/m4/idcache.m4 $(top_srcdir)/m4/inet_ntop.m4 \
- $(top_srcdir)/m4/inline.m4 $(top_srcdir)/m4/intmax_t.m4 \
- $(top_srcdir)/m4/inttostr.m4 $(top_srcdir)/m4/inttypes-pri.m4 \
- $(top_srcdir)/m4/inttypes.m4 $(top_srcdir)/m4/inttypes_h.m4 \
- $(top_srcdir)/m4/isapipe.m4 $(top_srcdir)/m4/jm-macros.m4 \
- $(top_srcdir)/m4/jm-winsz1.m4 $(top_srcdir)/m4/jm-winsz2.m4 \
- $(top_srcdir)/m4/lchmod.m4 $(top_srcdir)/m4/lchown.m4 \
- $(top_srcdir)/m4/lib-check.m4 $(top_srcdir)/m4/lib-ignore.m4 \
- $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
- $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/link-follow.m4 \
- $(top_srcdir)/m4/localcharset.m4 \
- $(top_srcdir)/m4/long-options.m4 \
- $(top_srcdir)/m4/longdouble.m4 $(top_srcdir)/m4/longlong.m4 \
- $(top_srcdir)/m4/ls-mntd-fs.m4 $(top_srcdir)/m4/lstat.m4 \
- $(top_srcdir)/m4/mbchar.m4 $(top_srcdir)/m4/mbiter.m4 \
- $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbscasecmp.m4 \
- $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/mbswidth.m4 \
- $(top_srcdir)/m4/md5.m4 $(top_srcdir)/m4/memcasecmp.m4 \
- $(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/memcmp.m4 \
- $(top_srcdir)/m4/memcoll.m4 $(top_srcdir)/m4/memcpy.m4 \
- $(top_srcdir)/m4/memmove.m4 $(top_srcdir)/m4/mempcpy.m4 \
- $(top_srcdir)/m4/memrchr.m4 $(top_srcdir)/m4/memset.m4 \
- $(top_srcdir)/m4/memxfrm.m4 $(top_srcdir)/m4/mkancesdirs.m4 \
- $(top_srcdir)/m4/mkdir-p.m4 $(top_srcdir)/m4/mkdir-slash.m4 \
- $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/mktime.m4 \
- $(top_srcdir)/m4/modechange.m4 $(top_srcdir)/m4/mountlist.m4 \
- $(top_srcdir)/m4/mpsort.m4 $(top_srcdir)/m4/nanosleep.m4 \
- $(top_srcdir)/m4/netinet_in_h.m4 $(top_srcdir)/m4/nls.m4 \
- $(top_srcdir)/m4/openat.m4 $(top_srcdir)/m4/pathmax.m4 \
- $(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/physmem.m4 \
- $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/posixtm.m4 \
- $(top_srcdir)/m4/posixver.m4 $(top_srcdir)/m4/prereq.m4 \
- $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/putenv.m4 \
- $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \
- $(top_srcdir)/m4/randint.m4 $(top_srcdir)/m4/randperm.m4 \
- $(top_srcdir)/m4/randread.m4 $(top_srcdir)/m4/readlink.m4 \
- $(top_srcdir)/m4/readtokens.m4 $(top_srcdir)/m4/readutmp.m4 \
- $(top_srcdir)/m4/regex.m4 \
- $(top_srcdir)/m4/rename-dest-slash.m4 \
- $(top_srcdir)/m4/rename.m4 $(top_srcdir)/m4/rmdir-errno.m4 \
- $(top_srcdir)/m4/rmdir.m4 $(top_srcdir)/m4/root-dev-ino.m4 \
- $(top_srcdir)/m4/rpmatch.m4 $(top_srcdir)/m4/safe-read.m4 \
- $(top_srcdir)/m4/safe-write.m4 $(top_srcdir)/m4/same.m4 \
- $(top_srcdir)/m4/save-cwd.m4 $(top_srcdir)/m4/savedir.m4 \
- $(top_srcdir)/m4/savewd.m4 $(top_srcdir)/m4/setenv.m4 \
- $(top_srcdir)/m4/settime.m4 $(top_srcdir)/m4/sha1.m4 \
- $(top_srcdir)/m4/sha256.m4 $(top_srcdir)/m4/sha512.m4 \
- $(top_srcdir)/m4/sig2str.m4 $(top_srcdir)/m4/snprintf.m4 \
- $(top_srcdir)/m4/socklen.m4 $(top_srcdir)/m4/sockpfaf.m4 \
- $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/st_dm_mode.m4 \
- $(top_srcdir)/m4/stat-prog.m4 $(top_srcdir)/m4/stat-time.m4 \
- $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.m4 \
- $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \
- $(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stdio_h.m4 \
- $(top_srcdir)/m4/stdlib-safer.m4 $(top_srcdir)/m4/stdlib_h.m4 \
- $(top_srcdir)/m4/stpcpy.m4 $(top_srcdir)/m4/strcspn.m4 \
- $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strftime.m4 \
- $(top_srcdir)/m4/string_h.m4 $(top_srcdir)/m4/strndup.m4 \
- $(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/strnumcmp.m4 \
- $(top_srcdir)/m4/strpbrk.m4 $(top_srcdir)/m4/strtod.m4 \
- $(top_srcdir)/m4/strtoimax.m4 $(top_srcdir)/m4/strtol.m4 \
- $(top_srcdir)/m4/strtoll.m4 $(top_srcdir)/m4/strtoul.m4 \
- $(top_srcdir)/m4/strtoull.m4 $(top_srcdir)/m4/strtoumax.m4 \
- $(top_srcdir)/m4/strverscmp.m4 \
- $(top_srcdir)/m4/sys_socket_h.m4 \
- $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \
- $(top_srcdir)/m4/tempname.m4 $(top_srcdir)/m4/time_h.m4 \
- $(top_srcdir)/m4/time_r.m4 $(top_srcdir)/m4/timespec.m4 \
- $(top_srcdir)/m4/tm_gmtoff.m4 $(top_srcdir)/m4/tzset.m4 \
- $(top_srcdir)/m4/unicodeio.m4 $(top_srcdir)/m4/unistd-safer.m4 \
- $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlink-busy.m4 \
- $(top_srcdir)/m4/unlinkdir.m4 $(top_srcdir)/m4/unlocked-io.m4 \
- $(top_srcdir)/m4/uptime.m4 $(top_srcdir)/m4/userspec.m4 \
- $(top_srcdir)/m4/utimbuf.m4 $(top_srcdir)/m4/utime.m4 \
- $(top_srcdir)/m4/utimecmp.m4 $(top_srcdir)/m4/utimens.m4 \
- $(top_srcdir)/m4/utimes-null.m4 $(top_srcdir)/m4/utimes.m4 \
- $(top_srcdir)/m4/vasnprintf.m4 $(top_srcdir)/m4/vasprintf.m4 \
- $(top_srcdir)/m4/wchar.m4 $(top_srcdir)/m4/wchar_t.m4 \
- $(top_srcdir)/m4/wctype.m4 $(top_srcdir)/m4/wcwidth.m4 \
- $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xalloc.m4 \
- $(top_srcdir)/m4/xfts.m4 $(top_srcdir)/m4/xgetcwd.m4 \
- $(top_srcdir)/m4/xnanosleep.m4 $(top_srcdir)/m4/xstrndup.m4 \
- $(top_srcdir)/m4/xstrtod.m4 $(top_srcdir)/m4/xstrtol.m4 \
- $(top_srcdir)/m4/yesno.m4 $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/lib/config.h
-CONFIG_CLEAN_FILES =
-SOURCES =
-DIST_SOURCES =
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ABSOLUTE_DIRENT_H = @ABSOLUTE_DIRENT_H@
-ABSOLUTE_FCNTL_H = @ABSOLUTE_FCNTL_H@
-ABSOLUTE_INTTYPES_H = @ABSOLUTE_INTTYPES_H@
-ABSOLUTE_NETINET_IN_H = @ABSOLUTE_NETINET_IN_H@
-ABSOLUTE_STDINT_H = @ABSOLUTE_STDINT_H@
-ABSOLUTE_STDIO_H = @ABSOLUTE_STDIO_H@
-ABSOLUTE_STDLIB_H = @ABSOLUTE_STDLIB_H@
-ABSOLUTE_STRING_H = @ABSOLUTE_STRING_H@
-ABSOLUTE_SYS_SOCKET_H = @ABSOLUTE_SYS_SOCKET_H@
-ABSOLUTE_SYS_STAT_H = @ABSOLUTE_SYS_STAT_H@
-ABSOLUTE_SYS_TIME_H = @ABSOLUTE_SYS_TIME_H@
-ABSOLUTE_TIME_H = @ABSOLUTE_TIME_H@
-ABSOLUTE_UNISTD_H = @ABSOLUTE_UNISTD_H@
-ABSOLUTE_WCHAR_H = @ABSOLUTE_WCHAR_H@
-ABSOLUTE_WCTYPE_H = @ABSOLUTE_WCTYPE_H@
-ACLOCAL = @ACLOCAL@
-ALLOCA = @ALLOCA@
-ALLOCA_H = @ALLOCA_H@
-AMTAR = @AMTAR@
-ARPA_INET_H = @ARPA_INET_H@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@
-BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
-BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
-BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
-BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFAULT_POSIX2_VERSION = @DEFAULT_POSIX2_VERSION@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DF_PROG = @DF_PROG@
-DIRENT_H = @DIRENT_H@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EOVERFLOW = @EOVERFLOW@
-EXEEXT = @EXEEXT@
-FCNTL_H = @FCNTL_H@
-FNMATCH_H = @FNMATCH_H@
-GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
-GETOPT_H = @GETOPT_H@
-GLIBC21 = @GLIBC21@
-GMSGFMT = @GMSGFMT@
-GMSGFMT_015 = @GMSGFMT_015@
-GNULIB_CHOWN = @GNULIB_CHOWN@
-GNULIB_DUP2 = @GNULIB_DUP2@
-GNULIB_FCHDIR = @GNULIB_FCHDIR@
-GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
-GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@
-GNULIB_GETCWD = @GNULIB_GETCWD@
-GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
-GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
-GNULIB_IMAXABS = @GNULIB_IMAXABS@
-GNULIB_IMAXDIV = @GNULIB_IMAXDIV@
-GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@
-GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@
-GNULIB_MBSCHR = @GNULIB_MBSCHR@
-GNULIB_MBSCSPN = @GNULIB_MBSCSPN@
-GNULIB_MBSLEN = @GNULIB_MBSLEN@
-GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@
-GNULIB_MBSPBRK = @GNULIB_MBSPBRK@
-GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@
-GNULIB_MBSRCHR = @GNULIB_MBSRCHR@
-GNULIB_MBSSEP = @GNULIB_MBSSEP@
-GNULIB_MBSSPN = @GNULIB_MBSSPN@
-GNULIB_MBSSTR = @GNULIB_MBSSTR@
-GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@
-GNULIB_MEMMEM = @GNULIB_MEMMEM@
-GNULIB_MEMPCPY = @GNULIB_MEMPCPY@
-GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
-GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
-GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
-GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
-GNULIB_READLINK = @GNULIB_READLINK@
-GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
-GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
-GNULIB_STPCPY = @GNULIB_STPCPY@
-GNULIB_STPNCPY = @GNULIB_STPNCPY@
-GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
-GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
-GNULIB_STRDUP = @GNULIB_STRDUP@
-GNULIB_STRNDUP = @GNULIB_STRNDUP@
-GNULIB_STRNLEN = @GNULIB_STRNLEN@
-GNULIB_STRPBRK = @GNULIB_STRPBRK@
-GNULIB_STRSEP = @GNULIB_STRSEP@
-GNULIB_STRTOIMAX = @GNULIB_STRTOIMAX@
-GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
-GNULIB_STRTOUMAX = @GNULIB_STRTOUMAX@
-GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
-GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
-GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@
-GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@
-GNU_PACKAGE = @GNU_PACKAGE@
-GREP = @GREP@
-HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
-HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@
-HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@
-HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@
-HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
-HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
-HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
-HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
-HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
-HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
-HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@
-HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
-HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@
-HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
-HAVE_DUP2 = @HAVE_DUP2@
-HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
-HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
-HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
-HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
-HAVE_MEMPCPY = @HAVE_MEMPCPY@
-HAVE_MKDTEMP = @HAVE_MKDTEMP@
-HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
-HAVE_READLINK = @HAVE_READLINK@
-HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
-HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
-HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
-HAVE_STDINT_H = @HAVE_STDINT_H@
-HAVE_STPCPY = @HAVE_STPCPY@
-HAVE_STPNCPY = @HAVE_STPNCPY@
-HAVE_STRCASECMP = @HAVE_STRCASECMP@
-HAVE_STRCASESTR = @HAVE_STRCASESTR@
-HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
-HAVE_STRNDUP = @HAVE_STRNDUP@
-HAVE_STRPBRK = @HAVE_STRPBRK@
-HAVE_STRSEP = @HAVE_STRSEP@
-HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
-HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
-HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
-HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
-HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
-HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
-HAVE_UNISTD_H = @HAVE_UNISTD_H@
-HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
-HAVE_WCTYPE_H = @HAVE_WCTYPE_H@
-HAVE_WINSOCK2_H = @HAVE_WINSOCK2_H@
-HAVE_WINT_T = @HAVE_WINT_T@
-HAVE_WS2TCPIP_H = @HAVE_WS2TCPIP_H@
-HAVE__BOOL = @HAVE__BOOL@
-HELP2MAN = @HELP2MAN@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-INTLLIBS = @INTLLIBS@
-INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
-INTTYPES_H = @INTTYPES_H@
-KMEM_GROUP = @KMEM_GROUP@
-LDFLAGS = @LDFLAGS@
-LIBCOREUTILS_LIBDEPS = @LIBCOREUTILS_LIBDEPS@
-LIBCOREUTILS_LTLIBDEPS = @LIBCOREUTILS_LTLIBDEPS@
-LIBICONV = @LIBICONV@
-LIBINTL = @LIBINTL@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIB_ACL = @LIB_ACL@
-LIB_ACL_TRIVIAL = @LIB_ACL_TRIVIAL@
-LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
-LIB_CRYPT = @LIB_CRYPT@
-LIB_EACCESS = @LIB_EACCESS@
-LIB_FDATASYNC = @LIB_FDATASYNC@
-LIB_GETHRXTIME = @LIB_GETHRXTIME@
-LIB_NANOSLEEP = @LIB_NANOSLEEP@
-LN_S = @LN_S@
-LTLIBICONV = @LTLIBICONV@
-LTLIBINTL = @LTLIBINTL@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MAN = @MAN@
-MKDIR_P = @MKDIR_P@
-MSGFMT = @MSGFMT@
-MSGFMT_015 = @MSGFMT_015@
-MSGMERGE = @MSGMERGE@
-NEED_SETGID = @NEED_SETGID@
-NETINET_IN_H = @NETINET_IN_H@
-OBJEXT = @OBJEXT@
-OPTIONAL_BIN_PROGS = @OPTIONAL_BIN_PROGS@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PERL = @PERL@
-POSUB = @POSUB@
-POW_LIB = @POW_LIB@
-PRIPTR_PREFIX = @PRIPTR_PREFIX@
-PRI_MACROS_BROKEN = @PRI_MACROS_BROKEN@
-PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
-RANLIB = @RANLIB@
-REPLACE_CHOWN = @REPLACE_CHOWN@
-REPLACE_FCHDIR = @REPLACE_FCHDIR@
-REPLACE_FPRINTF = @REPLACE_FPRINTF@
-REPLACE_GETCWD = @REPLACE_GETCWD@
-REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
-REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@
-REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
-REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@
-REPLACE_PRINTF = @REPLACE_PRINTF@
-REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
-REPLACE_SPRINTF = @REPLACE_SPRINTF@
-REPLACE_STRPTIME = @REPLACE_STRPTIME@
-REPLACE_TIMEGM = @REPLACE_TIMEGM@
-REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
-REPLACE_VPRINTF = @REPLACE_VPRINTF@
-REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
-REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
-SEQ_LIBM = @SEQ_LIBM@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@
-SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
-STDBOOL_H = @STDBOOL_H@
-STDINT_H = @STDINT_H@
-STRIP = @STRIP@
-SYS_SOCKET_H = @SYS_SOCKET_H@
-SYS_STAT_H = @SYS_STAT_H@
-SYS_TIME_H = @SYS_TIME_H@
-SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
-TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@
-U = @U@
-USE_NLS = @USE_NLS@
-VERSION = @VERSION@
-WCHAR_H = @WCHAR_H@
-WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@
-WCTYPE_H = @WCTYPE_H@
-WINT_T_SUFFIX = @WINT_T_SUFFIX@
-XGETTEXT = @XGETTEXT@
-XGETTEXT_015 = @XGETTEXT_015@
-YACC = @YACC@
-YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-gl_LIBOBJS = @gl_LIBOBJS@
-gl_LTLIBOBJS = @gl_LTLIBOBJS@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-TESTS = \
- hard-verbose \
- backup-dir \
- dir2dir \
- no-target-dir \
- atomic \
- acl \
- reply-no \
- leak-fd \
- part-hardlink \
- hard-4 \
- hard-3 \
- hard-2 \
- perm-1 \
- i-link-no \
- part-fail \
- dup-source childproof i-4 i-5 update i-2 mv-special-1 \
- into-self into-self-2 into-self-3 into-self-4 \
- backup-is-src \
- i-1 hard-link-1 force partition-perm to-symlink dir-file diag \
- part-symlink part-rename trailing-slash
-
-EXTRA_DIST = $(TESTS) vfat
-TESTS_ENVIRONMENT = \
- PERL="$(PERL)" \
- EGREP="$(EGREP)" \
- CU_TEST_NAME=`basename $(abs_srcdir)`,$$tst \
- PATH="$(VG_PATH_PREFIX)`pwd`/../../src$(PATH_SEPARATOR)$$PATH" \
- CONFIG_HEADER=$(CONFIG_HEADER) \
- PROG=mv
-
-all: all-am
-
-.SUFFIXES:
-$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/mv/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu tests/mv/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-tags: TAGS
-TAGS:
-
-ctags: CTAGS
-CTAGS:
-
-
-check-TESTS: $(TESTS)
- @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \
- srcdir=$(srcdir); export srcdir; \
- list=' $(TESTS) '; \
- if test -n "$$list"; then \
- for tst in $$list; do \
- if test -f ./$$tst; then dir=./; \
- elif test -f $$tst; then dir=; \
- else dir="$(srcdir)/"; fi; \
- if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
- all=`expr $$all + 1`; \
- case " $(XFAIL_TESTS) " in \
- *$$ws$$tst$$ws*) \
- xpass=`expr $$xpass + 1`; \
- failed=`expr $$failed + 1`; \
- echo "XPASS: $$tst"; \
- ;; \
- *) \
- echo "PASS: $$tst"; \
- ;; \
- esac; \
- elif test $$? -ne 77; then \
- all=`expr $$all + 1`; \
- case " $(XFAIL_TESTS) " in \
- *$$ws$$tst$$ws*) \
- xfail=`expr $$xfail + 1`; \
- echo "XFAIL: $$tst"; \
- ;; \
- *) \
- failed=`expr $$failed + 1`; \
- echo "FAIL: $$tst"; \
- ;; \
- esac; \
- else \
- skip=`expr $$skip + 1`; \
- echo "SKIP: $$tst"; \
- fi; \
- done; \
- if test "$$failed" -eq 0; then \
- if test "$$xfail" -eq 0; then \
- banner="All $$all tests passed"; \
- else \
- banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
- fi; \
- else \
- if test "$$xpass" -eq 0; then \
- banner="$$failed of $$all tests failed"; \
- else \
- banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
- fi; \
- fi; \
- dashes="$$banner"; \
- skipped=""; \
- if test "$$skip" -ne 0; then \
- skipped="($$skip tests were not run)"; \
- test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
- dashes="$$skipped"; \
- fi; \
- report=""; \
- if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
- report="Please report to $(PACKAGE_BUGREPORT)"; \
- test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
- dashes="$$report"; \
- fi; \
- dashes=`echo "$$dashes" | sed s/./=/g`; \
- echo "$$dashes"; \
- echo "$$banner"; \
- test -z "$$skipped" || echo "$$skipped"; \
- test -z "$$report" || echo "$$report"; \
- echo "$$dashes"; \
- test "$$failed" -eq 0; \
- else :; fi
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
- fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
- else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
- || exit 1; \
- fi; \
- done
-check-am: all-am
- $(MAKE) $(AM_MAKEFLAGS) check-TESTS
-check: check-am
-all-am: Makefile
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic mostlyclean-am
-
-distclean: distclean-am
- -rm -f Makefile
-distclean-am: clean-am distclean-generic
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-info: install-info-am
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-ps: install-ps-am
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-generic
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: install-am install-strip
-
-.PHONY: all all-am check check-TESTS check-am clean clean-generic \
- distclean distclean-generic distdir dvi dvi-am html html-am \
- info info-am install install-am install-data install-data-am \
- install-dvi install-dvi-am install-exec install-exec-am \
- install-html install-html-am install-info install-info-am \
- install-man install-pdf install-pdf-am install-ps \
- install-ps-am install-strip installcheck installcheck-am \
- installdirs maintainer-clean maintainer-clean-generic \
- mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
- uninstall-am
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/tests/mv/acl b/tests/mv/acl
deleted file mode 100755
index 9128686..0000000
--- a/tests/mv/acl
+++ /dev/null
@@ -1,105 +0,0 @@
-#!/bin/sh
-# move files/directories across file system boundaries
-# and make sure acls are preserved
-
-# Copyright (C) 2005, 2006 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-. $srcdir/../acl
-. $srcdir/../other-fs-tmpdir
-# Make sure we get English translations.
-. $srcdir/../lang-default
-
-# Skip this test if cp was built without ACL support:
-grep '^#define USE_ACL 0' $CONFIG_HEADER > /dev/null && \
- {
- echo 1>&2 "$0: insufficient ACL support, so skipping this test"
- (exit 77); exit 77
- }
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
- getfacl --version
- setfacl --version
-fi
-
-if test -z "$other_partition_tmpdir"; then
- (exit 77); exit 77
-fi
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-t0="$t0 $other_partition_tmpdir"
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-touch file || framework_failure=1
-t1=$other_partition_tmpdir/t1
-touch $t1 || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- (exit 1); exit 1
-fi
-
-skip=no
-# Ensure that setfacl and getfacl work on this file system.
-setfacl -m user:bin:rw file 2> /dev/null || skip=.
-# And on the destination file system.
-setfacl -m user:bin:rw $t1 || skip=$other_partition_tmpdir
-acl1=`getfacl file` || skip=yes
-
-test $skip != no &&
- {
- echo "$0: '$skip' is not on a suitable file system for this test" 1>&2
- echo "$0: skipping this test" 1>&2
- (exit 77); exit 77
- }
-
-# move the access acl of a file
-mv file $other_partition_tmpdir || fail=1
-acl2=`cd $other_partition_tmpdir && getfacl file` || framework_failure=1
-test "$acl1" = "$acl2" || fail=1
-
-# move the access acl of a directory
-mkdir dir || framework_failure=1
-setfacl -m user:bin:rw dir || framework_failure=1
-acl1=`getfacl dir` || framework_failure=1
-mv dir $other_partition_tmpdir || fail=1
-acl2=`cd $other_partition_tmpdir && getfacl dir` || framework_failure=1
-test "$acl1" = "$acl2" || fail=1
-
-# move the default acl of a directory
-mkdir dir2 || framework_failure=1
-setfacl -d -m user:bin:rw dir2 || framework_failure=1
-acl1=`getfacl dir2` || framework_failure=1
-mv dir2 $other_partition_tmpdir || fail=1
-acl2=`cd $other_partition_tmpdir && getfacl dir2` || framework_failure=1
-test "$acl1" = "$acl2" || fail=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- (exit 1); exit 1
-fi
-
-exit $fail
diff --git a/tests/mv/acl.sh b/tests/mv/acl.sh
new file mode 100755
index 0000000..9ed6332
--- /dev/null
+++ b/tests/mv/acl.sh
@@ -0,0 +1,67 @@
+#!/bin/sh
+# move files/directories across file system boundaries
+# and make sure acls are preserved
+
+# Copyright (C) 2005-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+
+require_acl_
+
+# Skip this test if cp was built without ACL support:
+grep '^#define USE_ACL 1' $CONFIG_HEADER > /dev/null ||
+ skip_ "insufficient ACL support"
+
+cleanup_() { rm -rf "$other_partition_tmpdir"; }
+. "$abs_srcdir/tests/other-fs-tmpdir"
+
+touch file || framework_failure_
+t1=$other_partition_tmpdir/t1
+touch $t1 || framework_failure_
+
+skip_partition=none
+# Ensure that setfacl and getfacl work on this file system.
+setfacl -m user:bin:rw- file 2> /dev/null || skip_partition=.
+# And on the destination file system.
+setfacl -m user:bin:rw- $t1 || skip_partition=$other_partition_tmpdir
+acl1=$(getfacl file) || skip_partition=.
+
+test $skip_partition != none &&
+ skip_ "'$skip_partition' is not on a suitable file system for this test"
+
+# move the access acl of a file
+mv file "$other_partition_tmpdir" || fail=1
+acl2=$(cd "$other_partition_tmpdir" && getfacl file) || framework_failure_
+test "$acl1" = "$acl2" || fail=1
+
+# move the access acl of a directory
+mkdir dir || framework_failure_
+setfacl -m user:bin:rw- dir || framework_failure_
+acl1=$(getfacl dir) || framework_failure_
+mv dir "$other_partition_tmpdir" || fail=1
+acl2=$(cd "$other_partition_tmpdir" && getfacl dir) || framework_failure_
+test "$acl1" = "$acl2" || fail=1
+
+# move the default acl of a directory
+mkdir dir2 || framework_failure_
+setfacl -d -m user:bin:rw- dir2 || framework_failure_
+acl1=$(getfacl dir2) || framework_failure_
+mv dir2 "$other_partition_tmpdir" || fail=1
+acl2=$(cd "$other_partition_tmpdir" && getfacl dir2) || framework_failure_
+test "$acl1" = "$acl2" || fail=1
+
+Exit $fail
diff --git a/tests/mv/atomic b/tests/mv/atomic
deleted file mode 100755
index 1fa0736..0000000
--- a/tests/mv/atomic
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/bin/sh
-# ensure that mv doesn't first unlink its destination in one particular case
-
-# Copyright (C) 2006, 2006 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-# Before the fix, mv would unnecessarily unlink the destination symlink:
-# $ rm -rf s[12]; ln -s / s1; ln -s /tmp s2; strace -qe unlink /bin/mv -T s1 s2
-# unlink("s2") = 0
-#
-# With the fix, it doesn't call unlink:
-# $ rm -rf s[12]; ln -s / s1; ln -s /tmp s2; strace -qe unlink ./mv -T s1 s2
-# $
-
-ln -s t1 s1 || framework_failure=1
-ln -s t2 s2 || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-# Skip this test on systems without strace.
-strace -V < /dev/null > ver 2>&1 || skip=1
-if test "$skip" = 1; then
- echo "$0: no strace program, so skipping this test" 1>&2
- (exit 77); exit 77
-fi
-
-fail=0
-
-strace -qe unlink mv -T s1 s2 > out 2>&1 || fail=1
-$EGREP 'unlink.*"s1"' out && fail=1
-
-# Ensure that the source, s1, is gone.
-ls -dl s1 > /dev/null 2>&1 && fail=1
-
-# Ensure that the destination, s2, contains the link from s1.
-test "`readlink s2`" = t1 || fail=1
-
-(exit $fail); exit $fail
diff --git a/tests/mv/atomic.sh b/tests/mv/atomic.sh
new file mode 100755
index 0000000..42cbc79
--- /dev/null
+++ b/tests/mv/atomic.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+# ensure that mv doesn't first unlink its destination in one particular case
+
+# Copyright (C) 2006-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+require_strace_ unlink
+
+# Before the fix, mv would unnecessarily unlink the destination symlink:
+# $ rm -rf s[12]; ln -s / s1; ln -s /tmp s2
+# $ strace -qe unlink /bin/mv -T s1 s2
+# unlink("s2") = 0
+#
+# With the fix, it doesn't call unlink:
+# $ rm -rf s[12]; ln -s / s1; ln -s /tmp s2
+# $ strace -qe unlink ./mv -T s1 s2
+# $
+
+ln -s t1 s1 || framework_failure_
+ln -s t2 s2 || framework_failure_
+
+
+strace -qe unlink mv -T s1 s2 > out 2>&1 || fail=1
+$EGREP 'unlink.*"s1"' out && fail=1
+
+# Ensure that the source, s1, is gone.
+ls -dl s1 > /dev/null 2>&1 && fail=1
+
+# Ensure that the destination, s2, contains the link from s1.
+test "$(readlink s2)" = t1 || fail=1
+
+Exit $fail
diff --git a/tests/mv/atomic2.sh b/tests/mv/atomic2.sh
new file mode 100755
index 0000000..bb774d8
--- /dev/null
+++ b/tests/mv/atomic2.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+# ensure that mv doesn't first unlink a multi-hard-linked destination
+
+# Copyright (C) 2008-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+require_strace_ unlink
+
+# Before the fix, mv would unnecessarily unlink the destination symlink:
+# $ rm -f a b b2; touch a b; ln b b2; strace -e unlink /p/bin/mv a b
+# unlink("b") = 0
+#
+# With the fix, it doesn't call unlink:
+# $ rm -f a b b2; touch a b; ln b b2; strace -e unlink ./mv a b
+# $
+
+touch a b || framework_failure_
+ln b b2 || framework_failure_
+
+
+strace -qe unlink mv a b > out 2>&1 || fail=1
+$EGREP 'unlink.*"b"' out && fail=1
+
+# Ensure that the source, "a", is gone.
+ls -dl a > /dev/null 2>&1 && fail=1
+
+# Ensure that the destination, "b", has link count 1.
+n_links=$(stat --printf=%h b) || fail=1
+test "$n_links" = 1 || fail=1
+
+Exit $fail
diff --git a/tests/mv/backup-dir b/tests/mv/backup-dir
deleted file mode 100755
index 72ffce1..0000000
--- a/tests/mv/backup-dir
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/bin/sh
-# Ensure "mv --verbose --backup" works the same for dirs and non-dirs.
-
-# Copyright (C) 2006 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
-
-. $srcdir/../envvar-check
-. $srcdir/../lang-default
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-mkdir A B || framework_failure=1
-touch X Y || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
-
-# Before coreutils-6.2, the " (backup: `B.~1~')" suffix was not printed.
-mv --verbose --backup=numbered -T A B > out || fail=1
-cat <<\EOF > exp || fail=1
-`A' -> `B' (backup: `B.~1~')
-EOF
-
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
-
-(exit $fail); exit $fail
diff --git a/tests/mv/backup-dir.sh b/tests/mv/backup-dir.sh
new file mode 100755
index 0000000..8f23123
--- /dev/null
+++ b/tests/mv/backup-dir.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+# Ensure "mv --verbose --backup" works the same for dirs and non-dirs.
+
+# Copyright (C) 2006-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+
+mkdir A B || framework_failure_
+touch X Y || framework_failure_
+
+
+# Before coreutils-6.2, the " (backup: 'B.~1~')" suffix was not printed.
+mv --verbose --backup=numbered -T A B > out || fail=1
+cat <<\EOF > exp || fail=1
+'A' -> 'B' (backup: 'B.~1~')
+EOF
+
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/mv/backup-is-src b/tests/mv/backup-is-src
deleted file mode 100755
index 8d5c69d..0000000
--- a/tests/mv/backup-is-src
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/bin/sh
-# Force mv to use the copying code.
-
-# Copyright (C) 1998, 1999, 2000, 2004 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
-
-. $srcdir/../other-fs-tmpdir
-. $srcdir/../envvar-check
-
-if test -z "$other_partition_tmpdir"; then
- exit 77
-fi
-
-a="$other_partition_tmpdir/a"
-a2="$other_partition_tmpdir/a~"
-
-framework_failure=0
-rm -f $a $a2 || framework_failure=1
-echo a > $a || framework_failure=1
-echo a2 > $a2 || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
-
-# Make sure we get English translations.
-. $srcdir/../lang-default
-
-# This mv command should exit nonzero.
-mv --b=simple $a2 $a > out 2>&1 && fail=1
-
-sed \
- -e "s,mv:,XXX:," \
- -e "s,$a,YYY," \
- -e "s,$a2,ZZZ," \
- out > out2
-
-cat > exp <<\EOF
-XXX: backing up `YYY' would destroy source; `ZZZ' not moved
-EOF
-
-cmp out2 exp || fail=1
-
-rm -fr out out2 exp $a $a2 $other_partition_tmpdir
-
-exit $fail
diff --git a/tests/mv/backup-is-src.sh b/tests/mv/backup-is-src.sh
new file mode 100755
index 0000000..83411e6
--- /dev/null
+++ b/tests/mv/backup-is-src.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+# Force mv to use the copying code.
+
+# Copyright (C) 1998-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+cleanup_() { rm -rf "$other_partition_tmpdir"; }
+. "$abs_srcdir/tests/other-fs-tmpdir"
+
+a="$other_partition_tmpdir/a"
+a2="$other_partition_tmpdir/a~"
+
+rm -f "$a" "$a2" || framework_failure_
+echo a > "$a" || framework_failure_
+echo a2 > "$a2" || framework_failure_
+
+# This mv command should exit nonzero.
+mv --b=simple "$a2" "$a" > out 2>&1 && fail=1
+
+sed \
+ -e "s,mv:,XXX:," \
+ -e "s,$a,YYY," \
+ -e "s,$a2,ZZZ," \
+ out > out2
+
+cat > exp <<\EOF
+XXX: backing up 'YYY' would destroy source; 'ZZZ' not moved
+EOF
+
+compare exp out2 || fail=1
+
+Exit $fail
diff --git a/tests/mv/childproof b/tests/mv/childproof.sh
index 41cdfce..373078d 100755
--- a/tests/mv/childproof
+++ b/tests/mv/childproof.sh
@@ -1,12 +1,13 @@
#!/bin/sh
-# Ensure that cp/mv don't clobber a just-copied file.
-# With fileutils-4.1 and earlier, this test would fail.
+# Ensure that cp/mv/ln don't clobber a just-copied/moved/linked file.
+# With fileutils-4.1 and earlier, this test would fail for cp and mv.
+# With coreutils-6.9 and earlier, this test would fail for ln.
-# Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2001-2016 Free Software Foundation, Inc.
-# This program is free software; you can redistribute it and/or modify
+# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
@@ -15,44 +16,23 @@
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- cp --version
- mv --version
-fi
-
-. $srcdir/../envvar-check
-. $srcdir/../lang-default
-PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
-
-pwd=`pwd`
-tmp=childproof.$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir a b c || framework_failure=1
-echo a > a/f || framework_failure=1
-echo b > b/f || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework' 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
-
-cp a/f b/f c 2> /dev/null && fail=1
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ cp mv ln
+
+skip_if_root_
+
+mkdir a b c || framework_failure_
+echo a > a/f || framework_failure_
+echo b > b/f || framework_failure_
+
+
+returns_ 1 cp a/f b/f c 2> /dev/null || fail=1
test -f a/f || fail=1
test -f b/f || fail=1
test -f c/f || fail=1
-test "`cat c/f`" = a || fail=1
+test "$(cat c/f)" = a || fail=1
rm -f c/f
# With --backup=numbered, it should succeed
@@ -63,11 +43,11 @@ test -f c/f || fail=1
test -f c/f.~1~ || fail=1
rm -f c/f*
-mv a/f b/f c 2> /dev/null && fail=1
+returns_ 1 mv a/f b/f c 2> /dev/null || fail=1
test -f a/f && fail=1
test -f b/f || fail=1
test -f c/f || fail=1
-test "`cat c/f`" = a || fail=1
+test "$(cat c/f)" = a || fail=1
# Make sure mv still works when moving hard links.
# This is where the same_file test is necessary, and why
@@ -82,11 +62,22 @@ test -f c/f || fail=1
test -f c/g || fail=1
touch a/f b/f b/g
-mv a/f b/f b/g c 2> /dev/null && fail=1
+returns_ 1 mv a/f b/f b/g c 2> /dev/null || fail=1
test -f a/f && fail=1 # a/f should have been moved
test -f b/f || fail=1 # b/f should remain
test -f b/g && fail=1 # b/g should have been moved
test -f c/f || fail=1
test -f c/g || fail=1
-(exit $fail); exit $fail
+# Test ln -f.
+
+rm -f a/f b/f c/f
+echo a > a/f || fail=1
+echo b > b/f || fail=1
+returns_ 1 ln -f a/f b/f c 2> /dev/null || fail=1
+# a/f and c/f must be linked
+test $(stat --format %i a/f) = $(stat --format %i c/f) || fail=1
+# b/f and c/f must not be linked
+test $(stat --format %i b/f) = $(stat --format %i c/f) && fail=1
+
+Exit $fail
diff --git a/tests/mv/diag b/tests/mv/diag
deleted file mode 100755
index 63eb3c6..0000000
--- a/tests/mv/diag
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/bin/sh
-# make sure we get proper diagnostics: e.g., with --target-dir=d but no args
-
-# Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
-
-# Make sure we get English translations.
-. $srcdir/../lang-default
-
-pwd=`pwd`
-tmp=diag-$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap 'exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-touch f1 || framework_failure=1
-touch f2 || framework_failure=1
-touch d || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
-
-# These mv commands should all exit nonzero.
-
-# Too few args. This first one did fail, but with an incorrect diagnostic
-# until fileutils-4.0u.
-mv --target=. >> out 2>&1 && fail=1
-mv no-file >> out 2>&1 && fail=1
-
-# Target is not a directory.
-mv f1 f2 f1 >> out 2>&1 && fail=1
-mv --target=f2 f1 >> out 2>&1 && fail=1
-
-cat > exp <<\EOF
-mv: missing file operand
-Try `mv --help' for more information.
-mv: missing destination file operand after `no-file'
-Try `mv --help' for more information.
-mv: target `f1' is not a directory
-mv: target `f2' is not a directory
-EOF
-
-cmp out exp || fail=1
-
-(exit $fail)
-exit $fail
diff --git a/tests/mv/diag.sh b/tests/mv/diag.sh
new file mode 100755
index 0000000..ae5ae81
--- /dev/null
+++ b/tests/mv/diag.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+# make sure we get proper diagnostics: e.g., with --target-dir=d but no args
+
+# Copyright (C) 2000-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+
+touch f1 || framework_failure_
+touch f2 || framework_failure_
+touch d || framework_failure_
+
+# These mv commands should all exit nonzero.
+
+# Too few args. This first one did fail, but with an incorrect diagnostic
+# until fileutils-4.0u.
+mv --target=. >> out 2>&1 && fail=1
+mv no-file >> out 2>&1 && fail=1
+
+# Target is not a directory.
+mv f1 f2 f1 >> out 2>&1 && fail=1
+mv --target=f2 f1 >> out 2>&1 && fail=1
+
+cat > exp <<\EOF
+mv: missing file operand
+Try 'mv --help' for more information.
+mv: missing destination file operand after 'no-file'
+Try 'mv --help' for more information.
+mv: target 'f1' is not a directory
+mv: target 'f2' is not a directory
+EOF
+
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/mv/dir-file b/tests/mv/dir-file
deleted file mode 100755
index 9c540b2..0000000
--- a/tests/mv/dir-file
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/sh
-# mv must fail when src and dest are mismatched directory/non-directory.
-
-# Copyright (C) 2000, 2006 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
-
-tmp=mv-mismatch-$$
-pwd=`pwd`
-trap 'cd "$pwd" && rm -rf $tmp' 0 1 2 3 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp
-mkdir -p dir/file || framework_failure=1
-> file || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
-
-fail=0
-
-# These should both fail, but until fileutils-4.0q only the second one did.
-mv dir file > /dev/null 2>&1 && fail=1
-mv file dir > /dev/null 2>&1 && fail=1
-
-exit $fail
diff --git a/tests/mv/dir-file.sh b/tests/mv/dir-file.sh
new file mode 100755
index 0000000..1857bb8
--- /dev/null
+++ b/tests/mv/dir-file.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+# mv must fail when src and dest are mismatched directory/non-directory.
+
+# Copyright (C) 2000-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+
+mkdir -p dir/file || framework_failure_
+> file || framework_failure_
+
+
+# These should both fail, but until fileutils-4.0q only the second one did.
+returns_ 1 mv dir file > /dev/null 2>&1 || fail=1
+returns_ 1 mv file dir > /dev/null 2>&1 || fail=1
+
+Exit $fail
diff --git a/tests/mv/dir2dir b/tests/mv/dir2dir
deleted file mode 100755
index 11ae26e..0000000
--- a/tests/mv/dir2dir
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/bin/sh
-# Ensure that mv prints the right diagnostic for a dir->dir move
-# where the destination directory is not empty.
-
-# Copyright (C) 2006 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
-
-. $srcdir/../envvar-check
-. $srcdir/../lang-default
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-mkdir -p a/t b/t || framework_failure=1
-touch a/t/f || framework_failure=1
-
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
-
-# Expect this to fail with the expected diagnostic.
-# For an interrim (pre-6.0) release, it would give an erroneous
-# diagnostic about moving one directory to a subdirectory of itself.
-mv b/t a 2> out && fail=1
-
-# Accept any of these: EEXIST, ENOTEMPTY, EBUSY.
-sed 's/: File exists/: Directory not empty/'<out>o1;mv o1 out
-sed 's/: Device or resource busy/: Directory not empty/'<out>o1;mv o1 out
-
-cat <<\EOF > exp || fail=1
-mv: cannot move `b/t' to `a/t': Directory not empty
-EOF
-
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
-
-(exit $fail); exit $fail
diff --git a/tests/mv/dir2dir.sh b/tests/mv/dir2dir.sh
new file mode 100755
index 0000000..4c34647
--- /dev/null
+++ b/tests/mv/dir2dir.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+# Ensure that mv prints the right diagnostic for a dir->dir move
+# where the destination directory is not empty.
+
+# Copyright (C) 2006-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+
+mkdir -p a/t b/t || framework_failure_
+touch a/t/f || framework_failure_
+
+
+# Expect this to fail with the expected diagnostic.
+# For an interim (pre-6.0) release, it would give an erroneous
+# diagnostic about moving one directory to a subdirectory of itself.
+mv b/t a 2> out && fail=1
+
+# Accept any of these: EEXIST, ENOTEMPTY, EBUSY.
+sed 's/: File exists/: Directory not empty/'<out>o1;mv o1 out
+sed 's/: Device or resource busy/: Directory not empty/'<out>o1;mv o1 out
+
+cat <<\EOF > exp || fail=1
+mv: cannot move 'b/t' to 'a/t': Directory not empty
+EOF
+
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/mv/dup-source b/tests/mv/dup-source
deleted file mode 100755
index 7965c91..0000000
--- a/tests/mv/dup-source
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/bin/sh
-# Ensure that cp merely warns when a non-directory source file is
-# listed on the command line more than once. fileutils-4.1.1
-# made this fail: cp a a d/
-# Ensure that mv fails with a similar command.
-
-# Copyright (C) 2001, 2002, 2004, 2006 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- cp --version
- mv --version
-fi
-
-. $srcdir/../envvar-check
-. $srcdir/../lang-default
-PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
-
-pwd=`pwd`
-tmp=dup-src.$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
-
-for i in cp; do
-
- # cp may not fail in this case.
-
- rm -fr a d; touch a; mkdir d
- $i a a d/ 2> out || fail=1
- rm -fr a d; touch a; mkdir d
- $i ./a a d/ 2>> out || fail=1
-
- # cp succeeds with --backup=numbered.
- rm -fr a d; touch a; mkdir d
- $i --backup=numbered a a d/ 2>> out || fail=1
-
- # But not with plain `--backup'
- rm -fr a d; touch a; mkdir d
- $i --backup a a d/ 2>> out && fail=1
- cat <<EOF > exp
-$i: warning: source file \`a' specified more than once
-$i: warning: source file \`a' specified more than once
-$i: will not overwrite just-created \`d/a' with \`a'
-EOF
- cmp out exp || fail=1
- test $fail = 1 && diff out exp 2> /dev/null
-done
-
-for i in mv; do
- # But mv *does* fail in this case (it has to).
-
- rm -fr a d; touch a; mkdir d
- $i a a d/ 2> out && fail=1
- rm -fr a d; touch a; mkdir d
- $i ./a a d/ 2>> out && fail=1
- cat <<EOF > exp
-$i: cannot stat \`a': No such file or directory
-$i: cannot stat \`a': No such file or directory
-EOF
- cmp out exp || fail=1
- test $fail = 1 && diff out exp 2> /dev/null
-done
-
-(exit $fail); exit $fail
diff --git a/tests/mv/dup-source.sh b/tests/mv/dup-source.sh
new file mode 100755
index 0000000..efa4624
--- /dev/null
+++ b/tests/mv/dup-source.sh
@@ -0,0 +1,91 @@
+#!/bin/sh
+# Ensure that cp merely warns when a non-directory source file is
+# listed on the command line more than once. fileutils-4.1.1
+# made this fail: cp a a d/
+# Ensure that mv fails with a similar command.
+
+# Copyright (C) 2001-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ cp mv
+
+skip_if_root_
+
+reset_files() { rm -fr a b d; touch a; mkdir b d; }
+
+for i in cp; do
+
+ # cp may not fail in this case.
+ reset_files
+ $i a a d/ 2> out || fail=1
+ reset_files
+ $i ./a a d/ 2>> out || fail=1
+
+ # Similarly for directories, but handle
+ # source == dest appropriately.
+ reset_files
+ $i -a ./b b d/ 2>> out || fail=1
+ reset_files
+ returns_ 1 $i -a ./b b b/ 2>> out || fail=1
+
+ # cp succeeds with --backup=numbered.
+ reset_files
+ $i --backup=numbered a a d/ 2>> out || fail=1
+
+ # But not with plain '--backup'
+ reset_files
+ returns_ 1 $i --backup a a d/ 2>> out || fail=1
+
+ cat <<EOF > exp
+$i: warning: source file 'a' specified more than once
+$i: warning: source file 'a' specified more than once
+$i: warning: source directory 'b' specified more than once
+$i: cannot copy a directory, './b', into itself, 'b/b'
+$i: warning: source directory 'b' specified more than once
+$i: will not overwrite just-created 'd/a' with 'a'
+EOF
+ compare exp out || fail=1
+done
+
+for i in mv; do
+ # But mv *does* fail in this case (it has to).
+ reset_files
+ returns_ 1 $i a a d/ 2> out || fail=1
+ returns_ 1 test -e a || fail=1
+ reset_files
+ returns_ 1 $i ./a a d/ 2>> out || fail=1
+ returns_ 1 test -e a || fail=1
+
+ # Similarly for directories, also handling
+ # source == dest appropriately.
+ reset_files
+ returns_ 1 $i ./b b d/ 2>> out || fail=1
+ returns_ 1 test -e b || fail=1
+ reset_files
+ returns_ 1 $i --verbose ./b b b/ 2>> out || fail=1
+ test -d b || fail=1
+
+ cat <<EOF > exp
+$i: cannot stat 'a': No such file or directory
+$i: cannot stat 'a': No such file or directory
+$i: cannot stat 'b': No such file or directory
+$i: cannot move './b' to a subdirectory of itself, 'b/b'
+$i: warning: source directory 'b' specified more than once
+EOF
+ compare exp out || fail=1
+done
+
+Exit $fail
diff --git a/tests/mv/force b/tests/mv/force
deleted file mode 100755
index 3836ec0..0000000
--- a/tests/mv/force
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/sh
-# move a file onto itself
-
-# Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
-
-ff=mvforce
-ff2=mvforce2
-
-framework_failure=0
-rm -f $ff $ff2 || framework_failure=1
-echo force-contents > $ff || framework_failure=1
-ln $ff $ff2 || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
-
-# Make sure we get English translations.
-. $srcdir/../lang-default
-
-# This mv command should exit nonzero.
-mv $ff $ff > out 2>&1 && fail=1
-
-cat > exp <<EOF
-mv: \`$ff' and \`$ff' are the same file
-EOF
-
-cmp out exp || fail=1
-test `cat $ff` = force-contents || fail=1
-
-# This should succeed, even though the source and destination
-# device and inodes are the same.
-mv $ff $ff2 || fail=1
-
-rm -fr out exp $ff $ff2
-
-exit $fail
diff --git a/tests/mv/force.sh b/tests/mv/force.sh
new file mode 100755
index 0000000..faee6ea
--- /dev/null
+++ b/tests/mv/force.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+# move a file onto itself
+
+# Copyright (C) 1999-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+
+ff=mvforce
+ff2=mvforce2
+
+echo force-contents > $ff || framework_failure_
+ln $ff $ff2 || framework_failure_
+
+# mv should fail for the same name, or separate hardlinks as in
+# both cases rename() will do nothing and return success.
+# One could unlink(src) in the hardlink case, but that would
+# introduce races with overlapping mv instances removing both hardlinks.
+
+for dest in $ff $ff2; do
+ # This mv command should exit nonzero.
+ mv $ff $dest > out 2>&1 && fail=1
+
+ printf "mv: '$ff' and '$dest' are the same file\n" > exp
+ compare exp out || fail=1
+
+ test $(cat $ff) = force-contents || fail=1
+done
+
+Exit $fail
diff --git a/tests/mv/hard-2 b/tests/mv/hard-2.sh
index 101f334..3ccd69d 100755
--- a/tests/mv/hard-2
+++ b/tests/mv/hard-2.sh
@@ -2,11 +2,11 @@
# Ensure that moving hard-linked arguments onto existing destinations works.
# Likewise when using cp --preserve=link.
-# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003-2016 Free Software Foundation, Inc.
-# This program is free software; you can redistribute it and/or modify
+# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
@@ -15,39 +15,19 @@
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
- cp --version
-fi
-
-. $srcdir/../envvar-check
-PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir dst || framework_failure=1
-(cd dst && touch a b c) || framework_failure=1
-touch a || framework_failure=1
-ln a b || framework_failure=1
-ln a c || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ cp mv
+
+skip_if_root_
+
+mkdir dst || framework_failure_
+(cd dst && touch a b c) || framework_failure_
+touch a || framework_failure_
+ln a b || framework_failure_
+ln a c || framework_failure_
+
# ======================================
cp --preserve=link a b c dst || fail=1
@@ -63,9 +43,9 @@ test -f b || fail=1
test -f c || fail=1
# The three i-node numbers must be the same.
-ia=`ls -i a|sed 's/ a//'`
-ib=`ls -i b|sed 's/ b//'`
-ic=`ls -i c|sed 's/ c//'`
+ia=$(ls -i a|sed 's/ a//')
+ib=$(ls -i b|sed 's/ b//')
+ic=$(ls -i c|sed 's/ c//')
test $ia = $ib || fail=1
test $ia = $ic || fail=1
@@ -88,10 +68,10 @@ test -f b || fail=1
test -f c || fail=1
# The three i-node numbers must be the same.
-ia=`ls -i a|sed 's/ a//'`
-ib=`ls -i b|sed 's/ b//'`
-ic=`ls -i c|sed 's/ c//'`
+ia=$(ls -i a|sed 's/ a//')
+ib=$(ls -i b|sed 's/ b//')
+ic=$(ls -i c|sed 's/ c//')
test $ia = $ib || fail=1
test $ia = $ic || fail=1
-(exit $fail); exit $fail
+Exit $fail
diff --git a/tests/mv/hard-3 b/tests/mv/hard-3.sh
index ce83728..9aa06a4 100755
--- a/tests/mv/hard-3
+++ b/tests/mv/hard-3.sh
@@ -1,12 +1,12 @@
#!/bin/sh
-# Ensure that using `cp --preserve=link' to copy hard-linked arguments
+# Ensure that using 'cp --preserve=link' to copy hard-linked arguments
# onto existing destinations works, even when one of the link operations fails.
-# Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2003-2016 Free Software Foundation, Inc.
-# This program is free software; you can redistribute it and/or modify
+# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
@@ -15,52 +15,32 @@
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This bug was fixed in coreutils-4.5.9.
# To exercise this bug is non-trivial:
# Set-up requires at least three hard-linked files. In copying them,
# while preserving links, the initial copy must succeed, the attempt
-# to create the second file via `link' must fail, and the final `link'
+# to create the second file via 'link' must fail, and the final 'link'
# (to create the third) must succeed. Before the corresponding fix,
# the first and third destination files would not be linked.
#
-# Note that this is nominally a test of `cp', yet it is in the tests/mv
+# Note that this is nominally a test of 'cp', yet it is in the tests/mv
# 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=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ cp
+skip_if_root_
-. $srcdir/../envvar-check
-PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir -p x dst/x || framework_failure=1
-touch dst/x/b || framework_failure=1
+mkdir -p x dst/x || framework_failure_
+touch dst/x/b || framework_failure_
chmod a-w dst/x
-touch a || framework_failure=1
-ln a x/b || framework_failure=1
-ln a c || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+touch a || framework_failure_
+ln a x/b || framework_failure_
+ln a c || framework_failure_
-fail=0
# ======================================
# This must fail -- because x/b cannot be unlinked.
@@ -78,12 +58,12 @@ test -f x/b || fail=1
test -f c || fail=1
# The i-node numbers of a and c must be the same.
-ia=`ls -i a` || fail=1; set x $ia; ia=$2
-ic=`ls -i c` || fail=1; set x $ic; ic=$2
+ia=$(ls -i a) || fail=1; set x $ia; ia=$2
+ic=$(ls -i c) || fail=1; set x $ic; ic=$2
test "$ia" = "$ic" || fail=1
# The i-node number of x/b must be different.
-ib=`ls -i x/b` || fail=1; set x $ib; ib=$2
+ib=$(ls -i x/b) || fail=1; set x $ib; ib=$2
test "$ia" = "$ib" && fail=1
-(exit $fail); exit $fail
+Exit $fail
diff --git a/tests/mv/hard-4 b/tests/mv/hard-4
deleted file mode 100755
index 118479a..0000000
--- a/tests/mv/hard-4
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/sh
-# ensure that mv removes a in this case: touch a; ln a b; mv a b
-
-# Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
-
-. $srcdir/../envvar-check
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-touch a || framework_failure=1
-ln a b || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
-
-mv a b || fail=1
-
-# In coreutils-5.0 and earlier, a would not be removed.
-test -r a && fail=1
-test -r b || fail=1
-
-# Make sure it works also with --backup.
-ln b a
-mv --backup=simple a b || fail=1
-test -r a && fail=1
-test -r b || fail=1
-test -r b~ || fail=1
-
-(exit $fail); exit $fail
diff --git a/tests/mv/hard-4.sh b/tests/mv/hard-4.sh
new file mode 100755
index 0000000..a0a38aa
--- /dev/null
+++ b/tests/mv/hard-4.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# ensure that mv maintains a in this case: touch a; ln a b; mv a b
+
+# Copyright (C) 2003-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+touch a || framework_failure_
+ln a b || framework_failure_
+
+# Between coreutils-5.0 and coreutils-8.24, 'a' would be removed.
+# Before coreutils-5.0.1 the issue would not have been diagnosed.
+# We don't emulate the rename(a,b) with unlink(a) as that would
+# introduce races with overlapping mv instances removing both links.
+mv a b 2>err && fail=1
+printf "mv: 'a' and 'b' are the same file\n" > exp
+compare exp err || fail=1
+
+test -r a || fail=1
+test -r b || fail=1
+
+# Make sure it works with --backup.
+mv --backup=simple a b || fail=1
+test -r a && fail=1
+test -r b || fail=1
+test -r b~ || fail=1
+
+Exit $fail
diff --git a/tests/mv/hard-link-1 b/tests/mv/hard-link-1
deleted file mode 100755
index 7ce9176..0000000
--- a/tests/mv/hard-link-1
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/bin/sh
-# move a directory containing hard-linked files and
-# make sure the links are preserved
-
-# Copyright (C) 1998, 1999, 2000, 2004, 2006 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
-
-. $srcdir/../other-fs-tmpdir
-# Make sure we get English translations.
-. $srcdir/../lang-default
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test -z "$other_partition_tmpdir"; then
- (exit 77); exit 77
-fi
-
-dir=hlink
-
-framework_failure=0
-mkdir $dir || framework_failure=1
-> $dir/a || framework_failure=1
-ln $dir/a $dir/b || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- (exit 1); exit 1
-fi
-
-mv $dir $other_partition_tmpdir || fail=1
-
-# Display inode numbers, one per line.
-ls -1i $other_partition_tmpdir/$dir > out || fail=1
-
-# Make sure the inode numbers are the same.
-a=`sed -n 's/ a$//p' out`
-b=`sed -n 's/ b$//p' out`
-test "$a" = "$b" || fail=1
-
-rm -fr out $dir $other_partition_tmpdir
-
-exit $fail
diff --git a/tests/mv/hard-link-1.sh b/tests/mv/hard-link-1.sh
new file mode 100755
index 0000000..a2e7fe9
--- /dev/null
+++ b/tests/mv/hard-link-1.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# move a directory containing hard-linked files and
+# make sure the links are preserved
+
+# Copyright (C) 1998-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+cleanup_() { rm -rf "$other_partition_tmpdir"; }
+. "$abs_srcdir/tests/other-fs-tmpdir"
+
+dir=hlink
+
+mkdir $dir || framework_failure_
+> $dir/a || framework_failure_
+ln $dir/a $dir/b || framework_failure_
+
+mv $dir "$other_partition_tmpdir" || fail=1
+
+# Display inode numbers, one per line.
+ls -1i "$other_partition_tmpdir/$dir" > out || fail=1
+
+# Make sure the inode numbers are the same.
+a=$(sed -n 's/ a$//p' out)
+b=$(sed -n 's/ b$//p' out)
+test "$a" = "$b" || fail=1
+
+Exit $fail
diff --git a/tests/mv/hard-verbose b/tests/mv/hard-verbose
deleted file mode 100755
index 9c02ac1..0000000
--- a/tests/mv/hard-verbose
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/bin/sh
-# ensure that mv's --verbose options works even in this unusual case
-
-# Copyright (C) 2006 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
-
-. $srcdir/../envvar-check
-. $srcdir/../lang-default
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-touch x || framework_failure=1
-ln x y || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
-
-mv --verbose x y > out || fail=1
-cat <<\EOF > exp || fail=1
-removed `x'
-EOF
-
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
-
-(exit $fail); exit $fail
diff --git a/tests/mv/hardlink-case.sh b/tests/mv/hardlink-case.sh
new file mode 100755
index 0000000..446471d
--- /dev/null
+++ b/tests/mv/hardlink-case.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+# Ensure multi-hardlinked files are not lost on case insensitive file systems
+
+# Copyright (C) 2014-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+require_root_
+
+cwd=$(pwd)
+cleanup_() { cd /; umount "$cwd/mnt"; }
+
+truncate -s100M hfs.img || framework_failure_
+mkfs -t hfsplus hfs.img || skip_ 'failed to create hfs file system'
+mkdir mnt || framework_failure_
+mount hfs.img mnt || skip_ 'failed to mount hfs file system'
+
+cd mnt
+touch foo
+ln foo whatever
+returns_ 1 mv foo Foo || fail=1
+test -r foo || fail=1
+
+Exit $fail
diff --git a/tests/mv/i-1 b/tests/mv/i-1.pl
index 3ab73c0..35691c0 100755
--- a/tests/mv/i-1
+++ b/tests/mv/i-1.pl
@@ -1,11 +1,11 @@
-#!/bin/sh
-# Make sure a `n' reply to `mv -i...' aborts the move operation.
+#!/usr/bin/perl
+# Make sure a 'n' reply to 'mv -i...' aborts the move operation.
-# Copyright (C) 2001, 2003, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2001-2016 Free Software Foundation, Inc.
-# This program is free software; you can redistribute it and/or modify
+# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
@@ -14,36 +14,23 @@
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
-: ${PERL=perl}
-: ${srcdir=.}
-
-$PERL -e 1 > /dev/null 2>&1 || {
- echo 1>&2 "$0: configure didn't find a usable version of Perl," \
- "so can't run this test"
- exit 77
-}
-
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
-require 5.003;
use strict;
(my $program_name = $0) =~ s|.*/||;
-# Turn off localisation of executable's ouput.
+# Turn off localization of executable's output.
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
my $test_a = 'a';
my @Tests =
(
- # Make sure a `n' reply to `mv -i...' aborts the move operation.
+ # Make sure a 'n' reply to 'mv -i...' aborts the move operation.
[$test_a, '-i',
{IN => {src => "a\n"}}, {IN => {dst => "b\n"}}, '<', {IN => "n\n"},
- {ERR => "mv: overwrite `dst'? "},
+ {ERR => "mv: overwrite 'dst'? "},
{POST => sub { -r 'src' or die "test $test_a failed\n"}},
{EXIT => 0},
],
@@ -52,7 +39,6 @@ my @Tests =
my $save_temps = $ENV{DEBUG};
my $verbose = $ENV{VERBOSE};
-my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
+my $prog = 'mv';
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
exit $fail;
-EOF
diff --git a/tests/mv/i-2 b/tests/mv/i-2
deleted file mode 100755
index 36d1ce4..0000000
--- a/tests/mv/i-2
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/bin/sh
-# Test both cp and mv for their behavior with -if and -fi
-# The standards (POSIX and SuS) dictate annoyingly inconsistent behavior.
-
-# Copyright (C) 2000, 2001, 2006, 2007 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
- cp --version
-fi
-
-. $srcdir/../envvar-check
-
-# Make sure we get English translations.
-. $srcdir/../lang-default
-
-PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
-
-pwd=`pwd`
-tmp=cp-mv-if-$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap 'exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-for i in a b c d e f g h; do
- echo $i > $i || framework_failure=1
-done
-chmod 0 b d f h || framework_failure=1
-echo y > y || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
-
-fail=0
-mv -if a b || fail=1
-mv -fi c d < y >/dev/null 2>&1 || fail=1
-
-# Before 4.0s, this would not prompt.
-cp -if e f < y > out 2>&1 || fail=1
-
-# Make sure out contains the prompt.
-case "`cat out`" in
- "cp: try to overwrite \`f', overriding mode 0000 (---------)?"*) ;;
- *) fail=1 ;;
-esac
-
-test -f e || fail=1
-test -f f || fail=1
-cmp e f || fail=1
-
-cp -fi g h < y > out 2>&1 || fail=1
-test -f g || fail=1
-test -f h || fail=1
-cmp g h || fail=1
-
-exit $fail
diff --git a/tests/mv/i-2.sh b/tests/mv/i-2.sh
new file mode 100755
index 0000000..b6b6ea1
--- /dev/null
+++ b/tests/mv/i-2.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+# Test both cp and mv for their behavior with -if and -fi
+# The standards (POSIX and SuS) dictate annoyingly inconsistent behavior.
+
+# Copyright (C) 2000-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ cp mv
+
+skip_if_root_
+
+for i in a b c d e f g h; do
+ echo $i > $i || framework_failure_
+done
+chmod 0 b d f h || framework_failure_
+echo y > y || framework_failure_
+
+mv -if a b || fail=1
+mv -fi c d < y >/dev/null 2>&1 || fail=1
+
+# Before 4.0s, this would not prompt.
+cp -if e f < y > out 2>&1 || fail=1
+
+# Make sure out contains the prompt.
+case "$(cat out)" in
+ "cp: replace 'f', overriding mode 0000 (---------)?"*) ;;
+ *) fail=1 ;;
+esac
+
+test -f e || fail=1
+test -f f || fail=1
+compare e f || fail=1
+
+cp -fi g h < y > out 2>&1 || fail=1
+test -f g || fail=1
+test -f h || fail=1
+compare g h || fail=1
+
+Exit $fail
diff --git a/tests/mv/i-3.sh b/tests/mv/i-3.sh
new file mode 100755
index 0000000..28d7246
--- /dev/null
+++ b/tests/mv/i-3.sh
@@ -0,0 +1,72 @@
+#!/bin/sh
+# Make sure that 'mv file unwritable-file' prompts the user
+# and that 'mv -f file unwritable-file' doesn't.
+
+# Copyright (C) 2001-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+require_controlling_input_terminal_
+skip_if_root_
+trap '' TTIN # Ignore SIGTTIN
+
+uname -s | grep 'BSD$' && skip_ 'known spurious failure on *BSD'
+
+touch f g h i || framework_failure_
+chmod 0 g i || framework_failure_
+
+
+ls /dev/stdin >/dev/null 2>&1 \
+ || skip_ 'there is no /dev/stdin file'
+
+# work around a dash bug when redirecting
+# from symlinked ttys in the background
+tty=$(readlink -f /dev/stdin)
+
+test -r "$tty" 2>&1 \
+ || skip_ '/dev/stdin is not readable'
+
+# Terminate any background processes
+cleanup_() { kill $pid 2>/dev/null && wait $pid; }
+
+mv f g < $tty > out 2>&1 & pid=$!
+
+# Test for the expected prompt; sleep upon non-match.
+check_overwrite_prompt()
+{
+ local delay="$1"
+ case "$(cat out)" in
+ "mv: replace 'g', overriding mode 0000"*) ;;
+ *) sleep $delay; return 1;;
+ esac
+}
+
+# Wait for up to 12.7 seconds for the expected prompt.
+retry_delay_ check_overwrite_prompt .1 7 || { fail=1; cat out; }
+
+cleanup_
+
+mv -f h i > out 2>&1 || fail=1
+test -f i || fail=1
+test -f h && fail=1
+
+# Make sure there was no prompt.
+case "$(cat out)" in
+ '') ;;
+ *) fail=1 ;;
+esac
+
+Exit $fail
diff --git a/tests/mv/i-4 b/tests/mv/i-4
deleted file mode 100755
index 594c155..0000000
--- a/tests/mv/i-4
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/bin/sh
-# make sure `mv -i a b' does its job with a positive response
-
-# Copyright (C) 2001, 2005, 2006 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
-
-. $srcdir/../envvar-check
-. $srcdir/../lang-default
-
-pwd=`pwd`
-tmp=mv-i4-$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap 'exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-
-for i in a b; do
- echo $i > $i || framework_failure=1
-done
-echo y > y || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
-
-fail=0
-mv -i a b < y >/dev/null 2>&1 || fail=1
-
-# Make sure out contains the prompt.
-case "`cat b`" in
- a) ;;
- *) fail=1 ;;
-esac
-
-# Ensure that mv -i a b works properly with `n' and `y'
-# responses, even when a and b are hard links to the same file.
-# This `n' test would fail (no prompt) for coreutils-5.0.1 through 5.3.0.
-echo n > n
-rm -f a b
-echo a > a
-ln a b
-mv -i a b < n >/dev/null 2>&1 || fail=1
-test -r a || fail=1
-test -r b || fail=1
-mv -i a b < y >/dev/null 2>&1 || fail=1
-test -r a && fail=1
-test -r b || fail=1
-
-exit $fail
diff --git a/tests/mv/i-4.sh b/tests/mv/i-4.sh
new file mode 100755
index 0000000..9de155e
--- /dev/null
+++ b/tests/mv/i-4.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+# make sure 'mv -i a b' does its job with a positive response
+
+# Copyright (C) 2001-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+
+for i in a b; do
+ echo $i > $i || framework_failure_
+done
+echo y > y || framework_failure_
+echo n > n || framework_failure_
+
+mv -i a b < y >/dev/null 2>&1 || fail=1
+
+# Make sure out contains the prompt.
+case "$(cat b)" in
+ a) ;;
+ *) fail=1 ;;
+esac
+
+# Ensure that mv -i a b works properly with 'n' and 'y' responses,
+# when a and b are hard links to the same file.
+rm -f a b
+echo a > a
+ln a b
+mv -i a b < y 2>err && fail=1
+test -r a || fail=1
+test -r b || fail=1
+printf "mv: 'a' and 'b' are the same file\n" > exp
+compare exp err || fail=1
+
+Exit $fail
diff --git a/tests/mv/i-5 b/tests/mv/i-5
deleted file mode 100755
index 2fec7ed..0000000
--- a/tests/mv/i-5
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/sh
-# Make sure `mv -i dir file' prompts before failing.
-
-# Copyright (C) 2006 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
-
-. $srcdir/../envvar-check
-. $srcdir/../lang-default
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-mkdir a || framework_failure=1
-touch b || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
-
-fail=0
-
-# coreutils 6.2 mv would neglect to prompt in this case.
-echo n | mv -i a b 2>/dev/null || fail=1
-
-(exit $fail); exit $fail
diff --git a/tests/mv/i-5.sh b/tests/mv/i-5.sh
new file mode 100755
index 0000000..7897e44
--- /dev/null
+++ b/tests/mv/i-5.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+# Make sure 'mv -i dir file' prompts before failing.
+
+# Copyright (C) 2006-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+
+mkdir a || framework_failure_
+touch b || framework_failure_
+
+
+# coreutils 6.2 mv would neglect to prompt in this case.
+echo n | mv -i a b 2>/dev/null || fail=1
+
+Exit $fail
diff --git a/tests/mv/i-link-no b/tests/mv/i-link-no
deleted file mode 100755
index 2931af6..0000000
--- a/tests/mv/i-link-no
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/bin/sh
-# Show that mv doesn't preserve links to files the user has declined to move.
-
-# Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
-
-. $srcdir/../envvar-check
-. $srcdir/../lang-default
-
-pwd=`pwd`
-tmp=i-link-no.$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir a b || framework_failure=1
-echo foo > a/foo || framework_failure=1
-ln a/foo a/bar || framework_failure=1
-echo FUBAR > b/FUBAR || framework_failure=1
-ln b/FUBAR b/bar || framework_failure=1
-chmod a-w b/bar || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
-
-mv --reply=no a/bar a/foo b > out 2> err || fail=1
-cat <<EOF > exp
-EOF
-
-cat <<EOF > exp_err
-mv: the --reply option is deprecated; use -i or -f instead
-EOF
-
-cmp err exp_err || fail=1
-test $fail = 1 && diff err exp_err 2> /dev/null
-
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
-
-case "`cat b/foo`" in
- foo) ;;
- *) fail=1;;
-esac
-
-(exit $fail); exit $fail
diff --git a/tests/mv/i-link-no.sh b/tests/mv/i-link-no.sh
new file mode 100755
index 0000000..11233a2
--- /dev/null
+++ b/tests/mv/i-link-no.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+# Show that mv doesn't preserve links to files the user has declined to move.
+
+# Copyright (C) 2002-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+
+mkdir a b || framework_failure_
+echo foo > a/foo || framework_failure_
+ln a/foo a/bar || framework_failure_
+echo FUBAR > b/FUBAR || framework_failure_
+ln b/FUBAR b/bar || framework_failure_
+chmod a-w b/bar || framework_failure_
+echo n > no || framework_failure_
+
+
+mv a/bar a/foo b < no > out 2> err || fail=1
+touch exp
+touch exp_err
+
+compare exp out || fail=1
+compare exp_err err || fail=1
+
+case "$(cat b/foo)" in
+ foo) ;;
+ *) fail=1;;
+esac
+
+Exit $fail
diff --git a/tests/mv/into-self-2 b/tests/mv/into-self-2
deleted file mode 100755
index 11fddf2..0000000
--- a/tests/mv/into-self-2
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/bin/sh
-# Force mv to use the copying code.
-# Consider the case where SRC and DEST are on different
-# partitions and DEST is a symlink to SRC.
-
-# Copyright (C) 1998, 1999, 200 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
-
-. $srcdir/../other-fs-tmpdir
-. $srcdir/../envvar-check
-
-if test -z "$other_partition_tmpdir"; then
- exit 77
-fi
-
-file="$other_partition_tmpdir/file"
-symlink=symlink
-
-fail=0
-
-trap 'rm -fr out out2 exp $file $symlink $other_partition_tmpdir; exit $fail' \
- 0 1 2 3 15
-
-framework_failure=0
-rm -f $file $symlink || framework_failure=1
-echo whatever > $file || framework_failure=1
-ln -s $file $symlink || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
-
-# Make sure we get English translations.
-. $srcdir/../lang-default
-
-# This mv command should exit nonzero.
-mv $symlink $file > out 2>&1 && fail=1
-
-# This should succeed.
-mv $file $symlink || fail=1
-
-sed \
- -e "s,mv:,XXX:," \
- -e "s,$file,YYY," \
- -e "s,$symlink,ZZZ," \
- out > out2
-
-cat > exp <<\EOF
-XXX: `ZZZ' and `YYY' are the same file
-EOF
-#'
-
-cmp out2 exp || fail=1
-test $fail = 1 && diff out2 exp 2> /dev/null
-
-exit $fail
diff --git a/tests/mv/into-self-2.sh b/tests/mv/into-self-2.sh
new file mode 100755
index 0000000..af0439e
--- /dev/null
+++ b/tests/mv/into-self-2.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+# Force mv to use the copying code.
+# Consider the case where SRC and DEST are on different
+# partitions and DEST is a symlink to SRC.
+
+# Copyright (C) 1998-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+cleanup_() { rm -rf "$other_partition_tmpdir"; }
+. "$abs_srcdir/tests/other-fs-tmpdir"
+
+file="$other_partition_tmpdir/file"
+symlink=symlink
+
+
+echo whatever > $file || framework_failure_
+ln -s $file $symlink || framework_failure_
+
+# This mv command should exit nonzero.
+mv $symlink $file > out 2>&1 && fail=1
+
+# This should succeed.
+mv $file $symlink || fail=1
+
+sed \
+ -e "s,mv:,XXX:," \
+ -e "s,$file,YYY," \
+ -e "s,$symlink,ZZZ," \
+ out > out2
+
+cat > exp <<\EOF
+XXX: 'ZZZ' and 'YYY' are the same file
+EOF
+#'
+
+compare exp out2 || fail=1
+
+Exit $fail
diff --git a/tests/mv/into-self-3 b/tests/mv/into-self-3
deleted file mode 100755
index 6b08d31..0000000
--- a/tests/mv/into-self-3
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/bin/sh
-# move a directory into itself, with a twist
-
-# Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
-
-dir1=is3-dir1
-dir2=is3-dir2
-
-framework_failure=0
-rm -rf $dir1 $dir2 || framework_failure=1
-mkdir $dir1 $dir2 || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
-
-# Make sure we get English translations.
-. $srcdir/../lang-default
-
-# This mv command should exit nonzero.
-mv $dir1 $dir2 $dir2 > out 2>&1 && fail=1
-
-sed \
- -e "s,mv:,XXX:,g" \
- -e "s,$dir2,ZZZ,g" \
- out > out2
-
-cat > exp <<\EOF
-XXX: cannot move `ZZZ' to a subdirectory of itself, `ZZZ/ZZZ'
-EOF
-
-cmp out2 exp || fail=1
-
-rm -fr out out2 exp $dir1 $dir2
-
-exit $fail
diff --git a/tests/mv/into-self-3.sh b/tests/mv/into-self-3.sh
new file mode 100755
index 0000000..08dc8f7
--- /dev/null
+++ b/tests/mv/into-self-3.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# move a directory into itself, with a twist
+
+# Copyright (C) 1998-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+
+dir1=is3-dir1
+dir2=is3-dir2
+
+mkdir $dir1 $dir2 || framework_failure_
+
+# This mv command should exit nonzero.
+mv $dir1 $dir2 $dir2 > out 2>&1 && fail=1
+
+sed \
+ -e "s,mv:,XXX:,g" \
+ -e "s,$dir2,ZZZ,g" \
+ out > out2
+
+cat > exp <<\EOF
+XXX: cannot move 'ZZZ' to a subdirectory of itself, 'ZZZ/ZZZ'
+EOF
+
+compare exp out2 || fail=1
+
+Exit $fail
diff --git a/tests/mv/into-self-4 b/tests/mv/into-self-4
deleted file mode 100755
index 13357b7..0000000
--- a/tests/mv/into-self-4
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/sh
-# confirm that `mv symlink symlink' doesn't remove symlink
-# Based on an example from David Luyer.
-
-# Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
-
-. $srcdir/../envvar-check
-
-pwd=`pwd`
-tmp=mv-slink2.$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-touch file || framework_failure=1
-ln -s file s || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework' 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
-
-# This must fail.
-mv s s 2> /dev/null && fail=1
-
-# But the symlink, s, must not be removed.
-# Before 4.0.36, `s' would have been removed.
-test -f s || fail=1
-
-(exit $fail); exit $fail
diff --git a/tests/mv/into-self-4.sh b/tests/mv/into-self-4.sh
new file mode 100755
index 0000000..18346d3
--- /dev/null
+++ b/tests/mv/into-self-4.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+# confirm that 'mv symlink symlink' doesn't remove symlink
+# Based on an example from David Luyer.
+
+# Copyright (C) 2001-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+
+touch file || framework_failure_
+ln -s file s || framework_failure_
+
+
+# This must fail.
+returns_ 1 mv s s 2> /dev/null || fail=1
+
+# But the symlink, s, must not be removed.
+# Before 4.0.36, 's' would have been removed.
+test -f s || fail=1
+
+Exit $fail
diff --git a/tests/mv/into-self b/tests/mv/into-self.sh
index 69f0e5d..ae1be17 100755
--- a/tests/mv/into-self
+++ b/tests/mv/into-self.sh
@@ -1,11 +1,11 @@
-#! /bin/sh
+#!/bin/sh
# Demonstrate how mv fails when it tries to move a directory into itself.
-# Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright (C) 1998-2016 Free Software Foundation, Inc.
-# This program is free software; you can redistribute it and/or modify
+# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
@@ -14,33 +14,18 @@
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
dir=toself-dir
file=toself-file
-test_failure=0
+rm -rf $dir $file || framework_failure_
+mkdir -p $dir/a/b || framework_failure_
+touch $file || framework_failure_
-rm -rf $dir $file || test_failure=1
-mkdir -p $dir/a/b || test_failure=1
-touch $file || test_failure=1
-
-if test $test_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
-
-fail=0
-
-# Make sure we get English translations.
-. $srcdir/../lang-default
# This mv command should fail.
mv $dir $file $dir > out 2>&1 && fail=1
@@ -52,10 +37,10 @@ sed \
out > out2
cat > exp <<\EOF
-XXX: cannot move `SRC' to a subdirectory of itself, `DEST'
+XXX: cannot move 'SRC' to a subdirectory of itself, 'DEST'
EOF
-cmp out2 exp || fail=1
+compare exp out2 || fail=1
# Make sure the file is gone.
test -f $file && fail=1
@@ -64,6 +49,5 @@ test -d $dir || fail=1
test -d $dir/$dir && fail=1
# Make sure the file has been moved to the right place.
test -f $dir/$file || fail=1
-rm -rf $dir $file out out2 exp
-exit $fail
+Exit $fail
diff --git a/tests/mv/leak-fd b/tests/mv/leak-fd
deleted file mode 100755
index 1592e0c..0000000
--- a/tests/mv/leak-fd
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/bin/sh
-# Exercise mv's file-descriptor-leak bug, reported against coreutils-5.2.1
-# and fixed (properly) on 2004-10-21.
-
-# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-
-# This test is relatively expensive, and might well evoke a
-# framework-failure on systems with a smaller command-line length
-# limit so don't run it by default.
-. $srcdir/../expensive
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
-
-. $srcdir/../other-fs-tmpdir
-. $srcdir/../envvar-check
-PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-if test -z "$other_partition_tmpdir"; then
- (exit 77); exit 77
-fi
-t0="$t0 $other_partition_tmpdir"
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-b="0 1 2 3 4 5 6 7 8 9
-a b c d e f g h i j k l m n o p q r s t u v w x y z
-_A _B _C _D _E _F _G _H _I _J _K _L _M _N _O _P _Q _R _S _T _U _V _W _X _Y _Z"
-
-for i in `echo $b`; do
- echo $i
- for j in $b; do
- echo $i$j
- done
-done > .dirs
-mkdir `cat .dirs` || framework_failure=1
-sed 's,$,/f,' .dirs | xargs touch
-
-last_file=`tail -n1 .dirs`/f
-test -f $last_file || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
-
-mv * $other_partition_tmpdir || fail=1
-test -f $last_file/f && fail=1
-rm .dirs
-
-ls -A > ../out || fail=1
-test -s ../out && fail=1
-
-(exit $fail); exit $fail
diff --git a/tests/mv/leak-fd.sh b/tests/mv/leak-fd.sh
new file mode 100755
index 0000000..5732dc1
--- /dev/null
+++ b/tests/mv/leak-fd.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+# Exercise mv's file-descriptor-leak bug, reported against coreutils-5.2.1
+# and fixed (properly) on 2004-10-21.
+
+# Copyright (C) 2004-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# limit so don't run it by default.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+skip_if_root_
+cleanup_() { rm -rf "$other_partition_tmpdir"; }
+. "$abs_srcdir/tests/other-fs-tmpdir"
+
+# This test is relatively expensive, and might well evoke a
+# framework-failure on systems with a smaller command-line length
+expensive_
+
+b="0 1 2 3 4 5 6 7 8 9
+a b c d e f g h i j k l m n o p q r s t u v w x y z
+_A _B _C _D _E _F _G _H _I _J _K _L _M _N _O _P _Q _R _S _T _U _V _W _X _Y _Z"
+
+for i in $(echo $b); do
+ echo $i
+ for j in $b; do
+ echo $i$j
+ done
+done > .dirs
+mkdir $(cat .dirs) || framework_failure_
+sed 's,$,/f,' .dirs | xargs touch
+
+last_file=$(tail -n1 .dirs)/f
+test -f $last_file || framework_failure_
+
+
+mv * "$other_partition_tmpdir" || fail=1
+test -f $last_file/f && fail=1
+rm .dirs
+
+out=$(ls -A) || fail=1
+test -z "$out" || fail=1
+
+Exit $fail
diff --git a/tests/mv/mv-n.sh b/tests/mv/mv-n.sh
new file mode 100755
index 0000000..8a468ad
--- /dev/null
+++ b/tests/mv/mv-n.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+# Test whether mv -n works as documented (not overwrite target).
+
+# Copyright (C) 2006-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+
+
+# test miscellaneous combinations of -f -i -n parameters
+touch a b || framework_failure_
+echo "'a' -> 'b'" > out_move
+> out_empty
+
+# ask for overwrite, answer no
+touch a b || framework_failure_
+echo n | mv -vi a b 2>/dev/null > out1 || fail=1
+compare out1 out_empty || fail=1
+
+# ask for overwrite, answer yes
+touch a b || framework_failure_
+echo y | mv -vi a b 2>/dev/null > out2 || fail=1
+compare out2 out_move || fail=1
+
+# -n wins (as the last option)
+touch a b || framework_failure_
+echo y | mv -vin a b 2>/dev/null > out3 || fail=1
+compare out3 out_empty || fail=1
+
+# -n wins (as the last option)
+touch a b || framework_failure_
+echo y | mv -vfn a b 2>/dev/null > out4 || fail=1
+compare out4 out_empty || fail=1
+
+# -n wins (as the last option)
+touch a b || framework_failure_
+echo y | mv -vifn a b 2>/dev/null > out5 || fail=1
+compare out5 out_empty || fail=1
+
+# options --backup and --no-clobber are mutually exclusive
+touch a || framework_failure_
+returns_ 1 mv -bn a b 2>/dev/null || fail=1
+
+Exit $fail
diff --git a/tests/mv/mv-special-1 b/tests/mv/mv-special-1
deleted file mode 100755
index 4d7c697..0000000
--- a/tests/mv/mv-special-1
+++ /dev/null
@@ -1,97 +0,0 @@
-#! /bin/sh
-# Test "mv" with special files.
-
-# Copyright (C) 1998, 1999, 2000, 2002, 2004, 2005, 2006 Free Software
-# Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
-
-pwd=`pwd`
-tmp=mv-spec.$$
-trap 'status=$?; cd "$pwd" && exec 1>&2; rm -rf $tmp $other_partition_tmpdir && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-. $srcdir/../other-fs-tmpdir
-. $srcdir/../envvar-check
-# Make sure we get English translations.
-. $srcdir/../lang-default
-
-if test -z "$other_partition_tmpdir"; then
- (exit 77); exit 77
-fi
-
-null=mv-null
-dir=mv-dir
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-rm -f $null || framework_failure=1
-mknod $null p || framework_failure=1
-test -p $null || framework_failure=1
-mkdir -p $dir/a/b/c $dir/d/e/f || framework_failure=1
-touch $dir/a/b/c/file1 $dir/d/e/f/file2 || framework_failure=1
-
-if test $framework_failure = 1; then
- echo '********************************************'
- echo 'NOTICE: unable to create test prerequisites'
- echo '********************************************'
- # exit 77 here to indicate that we couldn't run the test.
- # At least running on SunOS 4.1.4, using a directory NFS mounted
- # from an OpenBSD system, the above mknod fails.
- (exit 77); exit 77
-fi
-
-fail=0
-mv --verbose $null $dir $other_partition_tmpdir > out || fail=1
-# Make sure the files are gone.
-test -p $null && fail=1
-test -d $dir && fail=1
-# Make sure they were moved.
-test -p $other_partition_tmpdir/$null || fail=1
-test -d $other_partition_tmpdir/$dir/a/b/c || fail=1
-
-# POSIX says rename (A, B) can succeed if A and B are on different file systems,
-# so ignore chatter about when files are removed and copied rather than renamed.
-sed "
- /^removed /d
- s,$other_partition_tmpdir,XXX,
-" out | sort > out2
-
-cat <<EOF | sort > exp
-\`$null' -> \`XXX/$null'
-\`$dir' -> \`XXX/$dir'
-\`$dir/a' -> \`XXX/$dir/a'
-\`$dir/a/b' -> \`XXX/$dir/a/b'
-\`$dir/a/b/c' -> \`XXX/$dir/a/b/c'
-\`$dir/a/b/c/file1' -> \`XXX/$dir/a/b/c/file1'
-\`$dir/d' -> \`XXX/$dir/d'
-\`$dir/d/e' -> \`XXX/$dir/d/e'
-\`$dir/d/e/f' -> \`XXX/$dir/d/e/f'
-\`$dir/d/e/f/file2' -> \`XXX/$dir/d/e/f/file2'
-EOF
-
-cmp out2 exp || fail=1
-
-# cd $other_partition_tmpdir
-# ls -l -A -R $other_partition_tmpdir
-
-(exit $fail); exit $fail
diff --git a/tests/mv/mv-special-1.sh b/tests/mv/mv-special-1.sh
new file mode 100755
index 0000000..a31dd72
--- /dev/null
+++ b/tests/mv/mv-special-1.sh
@@ -0,0 +1,72 @@
+#!/bin/sh
+# Test "mv" with special files.
+
+# Copyright (C) 1998-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+cleanup_() { rm -rf "$other_partition_tmpdir"; }
+. "$abs_srcdir/tests/other-fs-tmpdir"
+
+null=mv-null
+dir=mv-dir
+
+rm -f $null || framework_failure_
+mknod $null p || framework_failure_
+test -p $null || framework_failure_
+mkdir -p $dir/a/b/c $dir/d/e/f || framework_failure_
+touch $dir/a/b/c/file1 $dir/d/e/f/file2 || framework_failure_
+
+# We used to...
+# exit 77 here to indicate that we couldn't run the test.
+# At least running on SunOS 4.1.4, using a directory NFS mounted
+# from an OpenBSD system, the above mknod fails.
+# It's not worth making an exception any more.
+
+mv --verbose $null $dir "$other_partition_tmpdir" > out || fail=1
+# Make sure the files are gone.
+test -p $null && fail=1
+test -d $dir && fail=1
+# Make sure they were moved.
+test -p "$other_partition_tmpdir/$null" || fail=1
+test -d "$other_partition_tmpdir/$dir/a/b/c" || fail=1
+
+# POSIX says rename (A, B) can succeed if A and B are on different file systems,
+# so ignore chatter about when files are removed and copied rather than renamed.
+sed "
+ /^removed /d
+ s,$other_partition_tmpdir,XXX,
+" out | sort > out2
+
+cat <<EOF | sort > exp
+'$null' -> 'XXX/$null'
+'$dir' -> 'XXX/$dir'
+'$dir/a' -> 'XXX/$dir/a'
+'$dir/a/b' -> 'XXX/$dir/a/b'
+'$dir/a/b/c' -> 'XXX/$dir/a/b/c'
+'$dir/a/b/c/file1' -> 'XXX/$dir/a/b/c/file1'
+'$dir/d' -> 'XXX/$dir/d'
+'$dir/d/e' -> 'XXX/$dir/d/e'
+'$dir/d/e/f' -> 'XXX/$dir/d/e/f'
+'$dir/d/e/f/file2' -> 'XXX/$dir/d/e/f/file2'
+EOF
+
+compare exp out2 || fail=1
+
+# cd "$other_partition_tmpdir"
+# ls -l -A -R "$other_partition_tmpdir"
+
+Exit $fail
diff --git a/tests/mv/no-target-dir b/tests/mv/no-target-dir
deleted file mode 100755
index db7fe94..0000000
--- a/tests/mv/no-target-dir
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/bin/sh
-# ensure that --no-target-directory (-T) works when the destination is
-# an empty directory.
-
-# Copyright (C) 2006 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir -p d/sub empty src d2/sub e2 || framework_failure=1
-touch f || framework_failure=1
-
-# Skip this test if there's an underlying kernel bug.
-mkdir a b b/a || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-mv a b || {
- echo "$0: skipping this test: your kernel's rename syscall is buggy" 1>&2
- (exit 77); exit 77
-}
-
-fail=0
-
-# This should succeed, since both src and dest are directories,
-# and the dest dir is empty.
-mv -fT d empty || fail=1
-
-# Ensure that the source, d, is gone.
-ls -d d > /dev/null 2>&1 && fail=1
-
-# Ensure that the dest dir now has a subdirectory.
-test -d empty/sub || fail=1
-
-
-# rename must fail, since the dest is non-empty.
-mv -fT src d2 2> /dev/null && fail=1
-
-# rename must fail, since the src is not a directory.
-mv -fT f e2 2> /dev/null && fail=1
-
-(exit $fail); exit $fail
diff --git a/tests/mv/no-target-dir.sh b/tests/mv/no-target-dir.sh
new file mode 100755
index 0000000..d5ea7f1
--- /dev/null
+++ b/tests/mv/no-target-dir.sh
@@ -0,0 +1,51 @@
+#!/bin/sh
+# ensure that --no-target-directory (-T) works when the destination is
+# an empty directory.
+
+# Copyright (C) 2006-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+
+LS_FAILURE=2
+
+mkdir -p d/sub empty src d2/sub e2 || framework_failure_
+touch f || framework_failure_
+
+# Skip this test if there's an underlying kernel bug.
+mkdir a b b/a || framework_failure_
+
+mv a b ||
+ skip_ "your kernel's rename syscall is buggy"
+
+
+# This should succeed, since both src and dest are directories,
+# and the dest dir is empty.
+mv -fT d empty || fail=1
+
+# Ensure that the source, d, is gone.
+returns_ $LS_FAILURE ls -d d > /dev/null 2>&1 || fail=1
+
+# Ensure that the dest dir now has a subdirectory.
+test -d empty/sub || fail=1
+
+# rename must fail, since the dest is non-empty.
+returns_ 1 mv -fT src d2 2> /dev/null || fail=1
+
+# rename must fail, since the src is not a directory.
+returns_ 1 mv -fT f e2 2> /dev/null || fail=1
+
+Exit $fail
diff --git a/tests/mv/part-fail b/tests/mv/part-fail
deleted file mode 100755
index e4c5dc9..0000000
--- a/tests/mv/part-fail
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/bin/sh
-# Make sure we give a sensible diagnostic when a cross-device `mv'
-# fails, e.g., because the destination cannot be unlinked.
-# This is a bit fragile since it relies on the string used
-# for EPERM: `permission denied'.
-
-# Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
-
-. $srcdir/../other-fs-tmpdir
-. $srcdir/../envvar-check
-. $srcdir/../lang-default
-PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-if test -z "$other_partition_tmpdir"; then
- (exit 77); exit 77
-fi
-t0="$t0 $other_partition_tmpdir"
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-touch k $other_partition_tmpdir/k || framework_failure=1
-chmod u-w $other_partition_tmpdir || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
-
-mv -f k $other_partition_tmpdir 2> out && fail=1
-cat <<EOF > exp
-mv: inter-device move failed: \`k' to \`$other_partition_tmpdir/k'; unable to remove target: Permission denied
-EOF
-
-# On some (less-compliant) systems, we get EPERM in this case.
-# Accept either diagnostic.
-cat <<EOF > exp2
-mv: cannot move \`k' to \`$other_partition_tmpdir/k': Permission denied
-EOF
-
-if cmp out exp >/dev/null 2>&1; then
- :
-else
- if cmp out exp2; then
- :
- else
- fail=1
- fi
-fi
-test $fail = 1 && diff out exp 2> /dev/null
-
-(exit $fail); exit $fail
diff --git a/tests/mv/part-fail.sh b/tests/mv/part-fail.sh
new file mode 100755
index 0000000..6a4bb90
--- /dev/null
+++ b/tests/mv/part-fail.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+# Make sure we give a sensible diagnostic when a cross-device 'mv'
+# fails, e.g., because the destination cannot be unlinked.
+# This is a bit fragile since it relies on the string used
+# for EPERM: 'permission denied'.
+
+# Copyright (C) 2002-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+skip_if_root_
+cleanup_() { t=$other_partition_tmpdir; chmod -R 700 "$t"; rm -rf "$t"; }
+. "$abs_srcdir/tests/other-fs-tmpdir"
+
+touch k "$other_partition_tmpdir/k" || framework_failure_
+chmod u-w "$other_partition_tmpdir" || framework_failure_
+
+
+mv -f k "$other_partition_tmpdir" 2> out && fail=1
+printf \
+"mv: inter-device move failed: '%s' to '%s';"\
+' unable to remove target: Permission denied\n' \
+ k "$other_partition_tmpdir/k" >exp
+
+# On some (less-compliant) systems, we get EPERM in this case.
+# Accept either diagnostic.
+cat <<EOF > exp2
+mv: cannot move 'k' to '$other_partition_tmpdir/k': Permission denied
+EOF
+
+if cmp out exp >/dev/null 2>&1; then
+ :
+else
+ if cmp out exp2; then
+ :
+ else
+ fail=1
+ fi
+fi
+test $fail = 1 && compare exp out
+
+Exit $fail
diff --git a/tests/mv/part-hardlink b/tests/mv/part-hardlink
deleted file mode 100755
index 66cfe0d..0000000
--- a/tests/mv/part-hardlink
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/sh
-# Ensure that hard links are preserved when moving between partitions
-# and when the links are in separate command line arguments.
-# For additional constraints, see the comment in copy.c.
-# Before coreutils-5.2.1, this test would fail.
-
-# Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
-
-. $srcdir/../other-fs-tmpdir
-. $srcdir/../envvar-check
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-if test -z "$other_partition_tmpdir"; then
- (exit 77); exit 77
-fi
-t0="$t0 $other_partition_tmpdir"
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-touch f || framework_failure=1
-ln f g || framework_failure=1
-mkdir a b || framework_failure=1
-touch a/1 || framework_failure=1
-ln a/1 b/1 || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
-
-mv f g $other_partition_tmpdir || fail=1
-mv a b $other_partition_tmpdir || fail=1
-
-cd $other_partition_tmpdir
-set `ls -Ci f g`
-test $1 = $3 || fail=1
-set `ls -Ci a/1 b/1`
-test $1 = $3 || fail=1
-
-(exit $fail); exit $fail
diff --git a/tests/mv/part-hardlink.sh b/tests/mv/part-hardlink.sh
new file mode 100755
index 0000000..1cae529
--- /dev/null
+++ b/tests/mv/part-hardlink.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+# Ensure that hard links are preserved when moving between partitions
+# and when the links are in separate command line arguments.
+# For additional constraints, see the comment in copy.c.
+# Before coreutils-5.2.1, this test would fail.
+
+# Copyright (C) 2004-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+cleanup_() { rm -rf "$other_partition_tmpdir"; }
+. "$abs_srcdir/tests/other-fs-tmpdir"
+
+touch f || framework_failure_
+ln f g || framework_failure_
+mkdir a b || framework_failure_
+touch a/1 || framework_failure_
+ln a/1 b/1 || framework_failure_
+
+
+mv f g "$other_partition_tmpdir" || fail=1
+mv a b "$other_partition_tmpdir" || fail=1
+
+cd "$other_partition_tmpdir"
+set $(ls -Ci f g)
+test $1 = $3 || fail=1
+set $(ls -Ci a/1 b/1)
+test $1 = $3 || fail=1
+
+Exit $fail
diff --git a/tests/mv/part-rename b/tests/mv/part-rename
deleted file mode 100755
index b8c03e0..0000000
--- a/tests/mv/part-rename
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/bin/sh
-# Moving a directory specified with a trailing slash from one partition to
-# another, and giving it a different name at the destination would cause mv
-# to get a failed assertion.
-
-# Copyright (C) 2000, 2002, 2004, 2006 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
-
-. $srcdir/../other-fs-tmpdir
-. $srcdir/../envvar-check
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-if test -z "$other_partition_tmpdir"; then
- (exit 77); exit 77
-fi
-t0="$t0 $other_partition_tmpdir"
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir foo || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
-
-mv foo/ $other_partition_tmpdir/bar || fail=1
-
-(exit $fail); exit $fail
diff --git a/tests/mv/part-rename.sh b/tests/mv/part-rename.sh
new file mode 100755
index 0000000..d03e014
--- /dev/null
+++ b/tests/mv/part-rename.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+# Test various cases for moving directories across file systems
+
+# Copyright (C) 2000-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+cleanup_() { rm -rf "$other_partition_tmpdir"; }
+. "$abs_srcdir/tests/other-fs-tmpdir"
+
+
+# Moving a directory specified with a trailing slash from one partition to
+# another, and giving it a different name at the destination would cause mv
+# to get a failed assertion.
+mkdir foo || framework_failure_
+mv foo/ "$other_partition_tmpdir/bar" || fail=1
+
+
+# Moving a non directory from source shouldn't replace empty dir in dest
+touch bar || framework_failure_
+returns_ 1 mv bar "$other_partition_tmpdir/" || fail=1
+
+
+# Moving a directory from source shouldn't replace non directory in dest
+mkdir bar2
+touch "$other_partition_tmpdir/bar2"
+returns_ 1 mv bar2 "$other_partition_tmpdir/" || fail=1
+
+
+# As per POSIX moving directory from source should replace empty dir in dest
+mkdir bar3
+touch bar3/file
+mkdir "$other_partition_tmpdir/bar3"
+mv bar3 "$other_partition_tmpdir/" || fail=1
+test -e "$other_partition_tmpdir/bar3/file" || fail=1
+
+
+# As per POSIX moving directory from source shouldn't update dir in dest
+mkdir bar3
+touch bar3/file2
+returns_ 1 mv bar3 "$other_partition_tmpdir/" || fail=1
+test -e "$other_partition_tmpdir/bar3/file2" && fail=1
+
+Exit $fail
diff --git a/tests/mv/part-symlink b/tests/mv/part-symlink
deleted file mode 100755
index 5cd198c..0000000
--- a/tests/mv/part-symlink
+++ /dev/null
@@ -1,229 +0,0 @@
-#!/bin/sh
-# make sure cp and mv can handle many combinations of local and
-# other-partition regular/symlink'd files.
-
-# Copyright (C) 2000, 2003, 2004, 2006 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
- cp --version
-fi
-
-pwd=`pwd`
-tmp=part-sl.$$
-trap 'status=$?; cd "$pwd" && exec 1>&2; rm -rf $tmp $other_partition_tmpdir && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-pwd_tmp=$pwd/$tmp
-
-. $srcdir/../other-fs-tmpdir
-. $srcdir/../envvar-check
-# Make sure the programs use C-locale formats/translations.
-. $srcdir/../lang-default
-
-# Unset CDPATH. Otherwise, output from the `cd dir' command
-# can make this test fail.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-if test -z "$other_partition_tmpdir"; then
- (exit 77); exit 77
-fi
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
-
-fail=0
-
-# Four cases:
-# local regular file w/symlink on another partition
-# (loc_reg, rem_sl)
-# (rem_sl, loc_reg)
-# local symlink to regular file on another partition
-# (loc_sl, rem_reg)
-# (rem_reg, loc_sl)
-
-# Exercise those four cases for each of
-# cp and mv, with lots of combinations of options.
-
-actual=actual-$$
-expected=expected-$$
-
-exec 1> $actual
-
-# FIXME: This should be bigger: like more than 8k
-contents=XYZ
-
-loc_reg=loc_reg
-loc_sl=loc_sl
-rem_reg=$other_partition_tmpdir/rem_reg
-rem_sl=$other_partition_tmpdir/rem_sl
-
-for copy in cp mv; do
- for args in \
- 'loc_reg rem_sl' \
- 'rem_sl loc_reg' \
- 'loc_sl rem_reg' \
- 'rem_reg loc_sl' \
- ; do
- for options in '' --rem '--rem -d' '--rem -b' -b -bd -d; do
- case "$options" in *d*|*--rem*) test $copy = mv && continue;; esac
- rm -rf dir || fail=1
- rm -f $other_partition_tmpdir/* || fail=1
- mkdir dir || fail=1
- cd dir || fail=1
- case "$args" in *loc_reg*) reg_abs="`pwd`/$loc_reg" ;; esac
- case "$args" in *rem_reg*) reg_abs=$rem_reg ;; esac
- case "$args" in *loc_sl*) slink=$loc_sl ;; esac
- case "$args" in *rem_sl*) slink=$rem_sl ;; esac
-
- echo $contents > "$reg_abs" || fail=1
- ln -nsf "$reg_abs" $slink || fail=1
- actual_args=`echo $args|sed 's,^,$,;s/ / $/'`
- actual_args=`eval echo $actual_args`
-
- (
- (
- # echo 1>&2 cp $options $args
- $copy $options $actual_args 2>.err
- copy_status=$?
- echo $copy_status $copy $options $args
-
- # Normalize the program name in the error output,
- # remove any site-dependent part of other-partition file name,
- # and put brackets around the output.
- test -s .err && {
- echo '[' | tr -d '\n'
- sed 's/^[^:][^:]*\(..\):/\1:/;s,'$other_partition_tmpdir/,, .err
- echo ']' | tr -d '\n'
- }
- # Strip off all but the file names.
- # Remove any site-dependent part of each file name.
- ls="`ls -gG --ignore=.err . \
- | sed \
- -e '/^total /d' \
- -e s,$other_partition_tmpdir/,, \
- -e "s,$pwd_tmp/,," \
- -e 's/^[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* *//'`"
- ls2="`cd $other_partition_tmpdir && ls -gG --ignore=.err . \
- | sed \
- -e '/^total /d' \
- -e s,$other_partition_tmpdir/,, \
- -e "s,$pwd_tmp/,," \
- -e 's/^[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* *//'`"
- echo "($ls) ($ls2)"
-
- # If the command failed, then it must not have changed the files.
- if test $copy_status != 0; then
- for f in $actual_args; do
- test -f $f ||
- { echo "$copy FAILED but removed $f"; continue; }
- case "`cat $f`" in
- "$contents") ;;
- *) echo "$copy FAILED but modified $f";;
- esac
- done
- fi
-
- if test $copy = cp; then
- # Make sure the original is unchanged and that
- # the destination is a copy.
- for f in $actual_args; do
- if test -f $f; then
- if test $copy_status != 0; then
- test
- fi
- case "`cat $f`" in
- "$contents") ;;
- *) echo $copy FAILED;;
- esac
- else
- echo symlink-loop
- fi
- done
- fi
- ) | tr '\n' ' '
- echo
- ) | sed 's/ *$//'
- cd ..
- done
- echo
- done
-done
-
-test $fail = 1 &&
- { (exit 1); exit; }
-
-cat <<\EOF > $expected
-1 cp loc_reg rem_sl [cp: `loc_reg' and `rem_sl' are the same file ](loc_reg) (rem_sl -> dir/loc_reg)
-0 cp --rem loc_reg rem_sl (loc_reg) (rem_sl)
-0 cp --rem -d loc_reg rem_sl (loc_reg) (rem_sl)
-0 cp --rem -b loc_reg rem_sl (loc_reg) (rem_sl rem_sl~ -> dir/loc_reg)
-0 cp -b loc_reg rem_sl (loc_reg) (rem_sl rem_sl~ -> dir/loc_reg)
-0 cp -bd loc_reg rem_sl (loc_reg) (rem_sl rem_sl~ -> dir/loc_reg)
-1 cp -d loc_reg rem_sl [cp: `loc_reg' and `rem_sl' are the same file ](loc_reg) (rem_sl -> dir/loc_reg)
-
-1 cp rem_sl loc_reg [cp: `rem_sl' and `loc_reg' are the same file ](loc_reg) (rem_sl -> dir/loc_reg)
-1 cp --rem rem_sl loc_reg [cp: `rem_sl' and `loc_reg' are the same file ](loc_reg) (rem_sl -> dir/loc_reg)
-1 cp --rem -d rem_sl loc_reg [cp: `rem_sl' and `loc_reg' are the same file ](loc_reg) (rem_sl -> dir/loc_reg)
-1 cp --rem -b rem_sl loc_reg [cp: `rem_sl' and `loc_reg' are the same file ](loc_reg) (rem_sl -> dir/loc_reg)
-1 cp -b rem_sl loc_reg [cp: `rem_sl' and `loc_reg' are the same file ](loc_reg) (rem_sl -> dir/loc_reg)
-0 cp -bd rem_sl loc_reg (loc_reg -> dir/loc_reg loc_reg~) (rem_sl -> dir/loc_reg) symlink-loop symlink-loop
-1 cp -d rem_sl loc_reg [cp: `rem_sl' and `loc_reg' are the same file ](loc_reg) (rem_sl -> dir/loc_reg)
-
-1 cp loc_sl rem_reg [cp: `loc_sl' and `rem_reg' are the same file ](loc_sl -> rem_reg) (rem_reg)
-1 cp --rem loc_sl rem_reg [cp: `loc_sl' and `rem_reg' are the same file ](loc_sl -> rem_reg) (rem_reg)
-1 cp --rem -d loc_sl rem_reg [cp: `loc_sl' and `rem_reg' are the same file ](loc_sl -> rem_reg) (rem_reg)
-1 cp --rem -b loc_sl rem_reg [cp: `loc_sl' and `rem_reg' are the same file ](loc_sl -> rem_reg) (rem_reg)
-1 cp -b loc_sl rem_reg [cp: `loc_sl' and `rem_reg' are the same file ](loc_sl -> rem_reg) (rem_reg)
-0 cp -bd loc_sl rem_reg (loc_sl -> rem_reg) (rem_reg -> rem_reg rem_reg~) symlink-loop symlink-loop
-1 cp -d loc_sl rem_reg [cp: `loc_sl' and `rem_reg' are the same file ](loc_sl -> rem_reg) (rem_reg)
-
-1 cp rem_reg loc_sl [cp: `rem_reg' and `loc_sl' are the same file ](loc_sl -> rem_reg) (rem_reg)
-0 cp --rem rem_reg loc_sl (loc_sl) (rem_reg)
-0 cp --rem -d rem_reg loc_sl (loc_sl) (rem_reg)
-0 cp --rem -b rem_reg loc_sl (loc_sl loc_sl~ -> rem_reg) (rem_reg)
-0 cp -b rem_reg loc_sl (loc_sl loc_sl~ -> rem_reg) (rem_reg)
-0 cp -bd rem_reg loc_sl (loc_sl loc_sl~ -> rem_reg) (rem_reg)
-1 cp -d rem_reg loc_sl [cp: `rem_reg' and `loc_sl' are the same file ](loc_sl -> rem_reg) (rem_reg)
-
-0 mv loc_reg rem_sl () (rem_sl)
-0 mv -b loc_reg rem_sl () (rem_sl rem_sl~ -> dir/loc_reg)
-
-1 mv rem_sl loc_reg [mv: `rem_sl' and `loc_reg' are the same file ](loc_reg) (rem_sl -> dir/loc_reg)
-0 mv -b rem_sl loc_reg (loc_reg -> dir/loc_reg loc_reg~) ()
-
-1 mv loc_sl rem_reg [mv: `loc_sl' and `rem_reg' are the same file ](loc_sl -> rem_reg) (rem_reg)
-0 mv -b loc_sl rem_reg () (rem_reg -> rem_reg rem_reg~)
-
-0 mv rem_reg loc_sl (loc_sl) ()
-0 mv -b rem_reg loc_sl (loc_sl loc_sl~ -> rem_reg) ()
-
-EOF
-
-# Some folks may don't have diff.
-cmp $expected $actual \
- || { diff -c $expected $actual 1>&2; fail=1; }
-
-(exit $fail); exit $fail
diff --git a/tests/mv/part-symlink.sh b/tests/mv/part-symlink.sh
new file mode 100755
index 0000000..e83bf8e
--- /dev/null
+++ b/tests/mv/part-symlink.sh
@@ -0,0 +1,262 @@
+#!/bin/sh
+# make sure cp and mv can handle many combinations of local and
+# other-partition regular/symlink'd files.
+
+# Copyright (C) 2000-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ cp mv
+
+cleanup_() { rm -rf "$other_partition_tmpdir"; }
+. "$abs_srcdir/tests/other-fs-tmpdir"
+
+# On NFS on Linux 2.6.9 at least we get:
+# mv: preserving permissions for 'rem_sl': Operation not supported
+require_local_dir_
+
+pwd_tmp=$(pwd)
+
+# Unset CDPATH. Otherwise, output from the 'cd dir' command
+# can make this test fail.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# Four cases:
+# local regular file w/symlink on another partition
+# (loc_reg, rem_sl)
+# (rem_sl, loc_reg)
+# local symlink to regular file on another partition
+# (loc_sl, rem_reg)
+# (rem_reg, loc_sl)
+
+# Exercise those four cases for each of
+# cp and mv, with lots of combinations of options.
+
+exec 1> actual
+
+# FIXME: This should be bigger: like more than 8k
+contents=XYZ
+
+loc_reg=loc_reg
+loc_sl=loc_sl
+rem_reg=$other_partition_tmpdir/rem_reg
+rem_sl=$other_partition_tmpdir/rem_sl
+
+for copy in cp mv; do
+ for args in \
+ 'loc_reg rem_sl' \
+ 'rem_sl loc_reg' \
+ 'loc_sl rem_reg' \
+ 'rem_reg loc_sl' \
+ ; do
+ for options in '' --rem '--rem -d' '--rem -b' -b -bd -d; do
+ case "$options" in *d*|*--rem*) test $copy = mv && continue;; esac
+ rm -rf dir || fail=1
+ rm -f "$other_partition_tmpdir"/* || fail=1
+ mkdir dir || fail=1
+ cd dir || fail=1
+ case "$args" in *loc_reg*) reg_abs="$(pwd)/$loc_reg" ;; esac
+ case "$args" in *rem_reg*) reg_abs=$rem_reg ;; esac
+ case "$args" in *loc_sl*) slink=$loc_sl ;; esac
+ case "$args" in *rem_sl*) slink=$rem_sl ;; esac
+
+ echo $contents > "$reg_abs" || fail=1
+ ln -nsf "$reg_abs" $slink || fail=1
+ actual_args=$(echo $args|sed 's,^,$,;s/ / $/')
+ actual_args=$(eval echo $actual_args)
+
+ (
+ (
+ # echo 1>&2 cp $options $args
+ $copy $options $actual_args 2>.err
+ copy_status=$?
+ echo $copy_status $copy $options $args
+
+ # Normalize the program name in the error output,
+ # remove any site-dependent part of other-partition file name,
+ # and put brackets around the output.
+ test -s .err \
+ && {
+ echo ' [' | tr -d '\n'
+ sed 's/^[^:][^:]*\(..\):/\1:/;s,'"$other_partition_tmpdir/,," .err |
+ tr -d '\n'
+ echo ']'
+ }
+ # Strip off all but the file names.
+ # Remove any site-dependent part of each file name.
+ ls=$(ls -gG --ignore=.err . \
+ | sed \
+ -e '/^total /d' \
+ -e "s,$other_partition_tmpdir/,," \
+ -e "s,$pwd_tmp/,," \
+ -e 's/^[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* *//')
+ ls2=$(cd "$other_partition_tmpdir" && ls -gG --ignore=.err . \
+ | sed \
+ -e '/^total /d' \
+ -e "s,$other_partition_tmpdir/,," \
+ -e "s,$pwd_tmp/,," \
+ -e 's/^[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* *//')
+ echo " ("$ls") ("$ls2")"
+
+ # If the command failed, then it must not have changed the files.
+ if test $copy_status != 0; then
+ for f in $actual_args; do
+ test -f $f ||
+ { echo " $copy FAILED but removed $f"; continue; }
+ case "$(cat $f)" in
+ "$contents") ;;
+ *) echo " $copy FAILED but modified $f";;
+ esac
+ done
+ fi
+
+ if test $copy = cp; then
+ # Make sure the original is unchanged and that
+ # the destination is a copy.
+ for f in $actual_args; do
+ if test -f $f; then
+ if test $copy_status != 0; then
+ test
+ fi
+ case "$(cat $f)" in
+ "$contents") ;;
+ *) echo " $copy FAILED";;
+ esac
+ else
+ echo " symlink-loop"
+ fi
+ done
+ fi
+ )
+ ) | sed 's/ *$//'
+ cd ..
+ done
+ echo
+ done
+done
+
+test $fail = 1 &&
+ { (exit 1); exit; }
+
+cat <<\EOF > expected
+1 cp loc_reg rem_sl
+ [cp: 'loc_reg' and 'rem_sl' are the same file]
+ (loc_reg) (rem_sl -> dir/loc_reg)
+0 cp --rem loc_reg rem_sl
+ (loc_reg) (rem_sl)
+0 cp --rem -d loc_reg rem_sl
+ (loc_reg) (rem_sl)
+0 cp --rem -b loc_reg rem_sl
+ (loc_reg) (rem_sl rem_sl~ -> dir/loc_reg)
+0 cp -b loc_reg rem_sl
+ (loc_reg) (rem_sl rem_sl~ -> dir/loc_reg)
+0 cp -bd loc_reg rem_sl
+ (loc_reg) (rem_sl rem_sl~ -> dir/loc_reg)
+1 cp -d loc_reg rem_sl
+ [cp: 'loc_reg' and 'rem_sl' are the same file]
+ (loc_reg) (rem_sl -> dir/loc_reg)
+
+1 cp rem_sl loc_reg
+ [cp: 'rem_sl' and 'loc_reg' are the same file]
+ (loc_reg) (rem_sl -> dir/loc_reg)
+1 cp --rem rem_sl loc_reg
+ [cp: 'rem_sl' and 'loc_reg' are the same file]
+ (loc_reg) (rem_sl -> dir/loc_reg)
+1 cp --rem -d rem_sl loc_reg
+ [cp: 'rem_sl' and 'loc_reg' are the same file]
+ (loc_reg) (rem_sl -> dir/loc_reg)
+1 cp --rem -b rem_sl loc_reg
+ [cp: 'rem_sl' and 'loc_reg' are the same file]
+ (loc_reg) (rem_sl -> dir/loc_reg)
+1 cp -b rem_sl loc_reg
+ [cp: 'rem_sl' and 'loc_reg' are the same file]
+ (loc_reg) (rem_sl -> dir/loc_reg)
+0 cp -bd rem_sl loc_reg
+ (loc_reg -> dir/loc_reg loc_reg~) (rem_sl -> dir/loc_reg)
+ symlink-loop
+ symlink-loop
+1 cp -d rem_sl loc_reg
+ [cp: 'rem_sl' and 'loc_reg' are the same file]
+ (loc_reg) (rem_sl -> dir/loc_reg)
+
+1 cp loc_sl rem_reg
+ [cp: 'loc_sl' and 'rem_reg' are the same file]
+ (loc_sl -> rem_reg) (rem_reg)
+1 cp --rem loc_sl rem_reg
+ [cp: 'loc_sl' and 'rem_reg' are the same file]
+ (loc_sl -> rem_reg) (rem_reg)
+1 cp --rem -d loc_sl rem_reg
+ [cp: 'loc_sl' and 'rem_reg' are the same file]
+ (loc_sl -> rem_reg) (rem_reg)
+1 cp --rem -b loc_sl rem_reg
+ [cp: 'loc_sl' and 'rem_reg' are the same file]
+ (loc_sl -> rem_reg) (rem_reg)
+1 cp -b loc_sl rem_reg
+ [cp: 'loc_sl' and 'rem_reg' are the same file]
+ (loc_sl -> rem_reg) (rem_reg)
+0 cp -bd loc_sl rem_reg
+ (loc_sl -> rem_reg) (rem_reg -> rem_reg rem_reg~)
+ symlink-loop
+ symlink-loop
+1 cp -d loc_sl rem_reg
+ [cp: 'loc_sl' and 'rem_reg' are the same file]
+ (loc_sl -> rem_reg) (rem_reg)
+
+1 cp rem_reg loc_sl
+ [cp: 'rem_reg' and 'loc_sl' are the same file]
+ (loc_sl -> rem_reg) (rem_reg)
+0 cp --rem rem_reg loc_sl
+ (loc_sl) (rem_reg)
+0 cp --rem -d rem_reg loc_sl
+ (loc_sl) (rem_reg)
+0 cp --rem -b rem_reg loc_sl
+ (loc_sl loc_sl~ -> rem_reg) (rem_reg)
+0 cp -b rem_reg loc_sl
+ (loc_sl loc_sl~ -> rem_reg) (rem_reg)
+0 cp -bd rem_reg loc_sl
+ (loc_sl loc_sl~ -> rem_reg) (rem_reg)
+1 cp -d rem_reg loc_sl
+ [cp: 'rem_reg' and 'loc_sl' are the same file]
+ (loc_sl -> rem_reg) (rem_reg)
+
+0 mv loc_reg rem_sl
+ () (rem_sl)
+0 mv -b loc_reg rem_sl
+ () (rem_sl rem_sl~ -> dir/loc_reg)
+
+1 mv rem_sl loc_reg
+ [mv: 'rem_sl' and 'loc_reg' are the same file]
+ (loc_reg) (rem_sl -> dir/loc_reg)
+0 mv -b rem_sl loc_reg
+ (loc_reg -> dir/loc_reg loc_reg~) ()
+
+1 mv loc_sl rem_reg
+ [mv: 'loc_sl' and 'rem_reg' are the same file]
+ (loc_sl -> rem_reg) (rem_reg)
+0 mv -b loc_sl rem_reg
+ () (rem_reg -> rem_reg rem_reg~)
+
+0 mv rem_reg loc_sl
+ (loc_sl) ()
+0 mv -b rem_reg loc_sl
+ (loc_sl loc_sl~ -> rem_reg) ()
+
+EOF
+
+# Redirect to stderr, since stdout is already taken.
+compare expected actual 1>&2 || fail=1
+
+Exit $fail
diff --git a/tests/mv/partition-perm b/tests/mv/partition-perm
deleted file mode 100755
index 969dc74..0000000
--- a/tests/mv/partition-perm
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/bin/sh
-# Make sure permissions are preserved when moving from one partition to another.
-
-# Copyright (C) 1999, 2000, 2001, 2006 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
-
-. $srcdir/../other-fs-tmpdir
-. $srcdir/../envvar-check
-. $srcdir/../lang-default
-
-if test -z "$other_partition_tmpdir"; then
- exit 77
-fi
-
-pwd=`pwd`
-dir=p-perm-$$
-trap 'cd "$pwd" && rm -rf $dir $other_partition_tmpdir' 0 1 2 3 15
-
-mkdir $dir
-
-cd $dir
-: > file
-chmod a=rwx file
-
-umask 077
-mv file $other_partition_tmpdir
-
-fail=0
-test -f file && fail=1
-test -f $other_partition_tmpdir/file || fail=1
-
-# This would have failed with the mv from fileutils-4.0i.
-set _ `ls -l $other_partition_tmpdir/file`; shift; mode=$1
-test "$mode" = "-rwxrwxrwx" || fail=1
-
-exit $fail
diff --git a/tests/mv/partition-perm.sh b/tests/mv/partition-perm.sh
new file mode 100755
index 0000000..e38a312
--- /dev/null
+++ b/tests/mv/partition-perm.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+# Make sure permissions are preserved when moving from one partition to another.
+
+# Copyright (C) 1999-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+cleanup_() { rm -rf "$other_partition_tmpdir"; }
+. "$abs_srcdir/tests/other-fs-tmpdir"
+
+> file || framework_failure_
+chmod a=rwx file || framework_failure_
+
+umask 077
+mv file "$other_partition_tmpdir" || framework_failure_
+
+test -f file && fail=1
+test -f "$other_partition_tmpdir/file" || fail=1
+
+# This would have failed with the mv from fileutils-4.0i.
+mode=$(ls -l "$other_partition_tmpdir/file" | cut -b-10)
+test "$mode" = "-rwxrwxrwx" || fail=1
+
+Exit $fail
diff --git a/tests/mv/perm-1 b/tests/mv/perm-1
deleted file mode 100755
index 1b9ab28..0000000
--- a/tests/mv/perm-1
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/bin/sh
-# ensure that mv gives one diagnostic, not two, when failing
-# due to lack of permissions
-
-# Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
-
-. $srcdir/../envvar-check
-. $srcdir/../lang-default
-PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir -p no-write/dir || framework_failure=1
-chmod u-w no-write || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
-
-mv no-write/dir . > out 2>&1 && fail=1
-cat <<\EOF > exp
-mv: cannot move `no-write/dir' to `./dir': Permission denied
-EOF
-
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
-
-(exit $fail); exit $fail
diff --git a/tests/mv/perm-1.sh b/tests/mv/perm-1.sh
new file mode 100755
index 0000000..6518568
--- /dev/null
+++ b/tests/mv/perm-1.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+# ensure that mv gives one diagnostic, not two, when failing
+# due to lack of permissions
+
+# Copyright (C) 2002-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+skip_if_root_
+
+mkdir -p no-write/dir || framework_failure_
+chmod ug-w no-write || framework_failure_
+
+
+mv no-write/dir . > out 2>&1 && fail=1
+cat <<\EOF > exp
+mv: cannot move 'no-write/dir' to './dir': Permission denied
+EOF
+
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/mv/reply-no b/tests/mv/reply-no
deleted file mode 100755
index ae0a3cd..0000000
--- a/tests/mv/reply-no
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/sh
-# Ensure that `mv --reply=no f1 f2' works.
-
-# Copyright (C) 2005, 2006 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
-
-. $srcdir/../lang-default
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-touch a b || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
-
-mv --interactive --reply=no a b > out 2>&1 || fail=1
-
-# Both files must remain.
-test -f a || fail=1
-test -f b || fail=1
-
-cat <<EOF > exp_err
-mv: the --reply option is deprecated; use -i or -f instead
-EOF
-
-cmp out exp_err || fail=1
-test $fail = 1 && diff out exp_err 2> /dev/null
-
-(exit $fail); exit $fail
diff --git a/tests/mv/sticky-to-xpart.sh b/tests/mv/sticky-to-xpart.sh
new file mode 100755
index 0000000..89e8df4
--- /dev/null
+++ b/tests/mv/sticky-to-xpart.sh
@@ -0,0 +1,68 @@
+#!/bin/sh
+# A cross-partition move of a file in a sticky tmpdir and owned by
+# someone else would evoke an invalid diagnostic:
+# mv: cannot remove 'x': Operation not permitted
+# Affects coreutils-6.0-6.9.
+
+# Copyright (C) 2007-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+require_root_
+
+cleanup_() { rm -rf "$other_partition_tmpdir"; }
+. "$abs_srcdir/tests/other-fs-tmpdir"
+
+# Set up to run a test where non-root user tries to move a root-owned
+# file from a sticky tmpdir to a directory owned by that user on
+# a different partition.
+
+mkdir t || framework_failure_
+chmod a=rwx,o+t t || framework_failure_
+echo > t/root-owned || framework_failure_
+chmod a+r t/root-owned || framework_failure_
+chown "$NON_ROOT_USERNAME" "$other_partition_tmpdir" || framework_failure_
+
+# We have to allow $NON_ROOT_USERNAME access to ".".
+chmod go+x . || framework_failure_
+
+
+# Ensure that $NON_ROOT_USERNAME can access the required version of mv.
+version=$(
+ chroot --skip-chdir --user=$NON_ROOT_USERNAME / env PATH="$PATH" \
+ mv --version |
+ sed -n '1s/.* //p'
+)
+case $version in
+ $PACKAGE_VERSION) ;;
+ *) skip_ "cannot access just-built mv as user $NON_ROOT_USERNAME";;
+esac
+
+chroot --skip-chdir --user=$NON_ROOT_USERNAME / env PATH="$PATH" \
+ mv t/root-owned "$other_partition_tmpdir" 2> out-t && fail=1
+
+# On some systems, we get 'Not owner'. Convert it.
+# On other systems (HPUX), we get 'Permission denied'. Convert it, too.
+onp='Operation not permitted'
+sed "s/Not owner/$onp/;s/Permission denied/$onp/" out-t > out
+
+cat <<\EOF > exp
+mv: cannot remove 't/root-owned': Operation not permitted
+EOF
+
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/mv/symlink-onto-hardlink-to-self.sh b/tests/mv/symlink-onto-hardlink-to-self.sh
new file mode 100755
index 0000000..d43d32d
--- /dev/null
+++ b/tests/mv/symlink-onto-hardlink-to-self.sh
@@ -0,0 +1,63 @@
+#!/bin/sh
+# Demonstrate that when moving a symlink onto a hardlink-to-that-symlink,
+# an error is presented. Depending on your kernel (e.g., Linux, Solaris,
+# but not NetBSD), prior to coreutils-8.16, the mv would successfully perform
+# a no-op. I.e., surprisingly, mv s1 s2 would succeed, yet fail to remove s1.
+
+# Copyright (C) 2012-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+
+# Create a file f, and a symlink s1 to that file.
+touch f || framework_failure_
+ln -s f s2 || framework_failure_
+
+# Attempt to create a hard link to that symlink.
+# On some systems, it's not possible: they create a hard link to the referent.
+ln s2 s1 || framework_failure_
+
+# If s1 is not a symlink, skip this test.
+test -h s1 \
+ || skip_ your kernel or file system cannot create a hard link to a symlink
+
+for opt in '' --backup; do
+
+ if test "$opt" = --backup; then
+ mv $opt s1 s2 > out 2>&1 || fail=1
+ compare /dev/null out || fail=1
+
+ # Ensure that s1 is gone.
+ test -e s1 && fail=1
+
+ # With --backup, ensure that the backup file was created.
+ ref=$(readlink s2~) || fail=1
+ test "$ref" = f || fail=1
+ else
+ echo "mv: 's1' and 's2' are the same file" > exp
+ mv $opt s1 s2 2>err && fail=1
+ compare exp err || fail=1
+
+ # Ensure that s1 is still present.
+ test -e s1 || fail=1
+
+ # Without --backup, ensure there is no backup file.
+ test -e s2~ && fail=1
+ fi
+
+done
+
+Exit $fail
diff --git a/tests/mv/symlink-onto-hardlink.sh b/tests/mv/symlink-onto-hardlink.sh
new file mode 100755
index 0000000..47ea404
--- /dev/null
+++ b/tests/mv/symlink-onto-hardlink.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# Ensure that mv works with a few symlink-onto-hard-link cases.
+
+# Copyright (C) 2012-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+
+touch f || framework_failure_
+ln f h || framework_failure_
+ln -s f s || framework_failure_
+
+# Given two links f and h to some important content, and a symlink s to f,
+# "mv s f" must fail because it might then be hard to find the link, h.
+# "mv s l" may succeed because then, s (now "l") still points to f.
+# Of course, if the symlink were being moved into a different destination
+# directory, things would be very different, and, I suspect, implausible.
+
+echo "mv: 's' and 'f' are the same file" > exp || framework_failure_
+mv s f > out 2> err && fail=1
+compare /dev/null out || fail=1
+compare exp err || fail=1
+
+mv s l > out 2> err || fail=1
+compare /dev/null out || fail=1
+compare /dev/null err || fail=1
+
+Exit $fail
diff --git a/tests/mv/to-symlink b/tests/mv/to-symlink
deleted file mode 100755
index 6473cfb..0000000
--- a/tests/mv/to-symlink
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/bin/sh
-# Make sure that the copying code used in an inter-partition
-# move unlinks a destination symlink before opening it.
-
-# Copyright (C) 1999, 2000 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
-
-. $srcdir/../other-fs-tmpdir
-. $srcdir/../envvar-check
-
-if test -z "$other_partition_tmpdir"; then
- exit 77
-fi
-
-rem_file="$other_partition_tmpdir/file"
-rem_symlink="$other_partition_tmpdir/symlink"
-file=to-sym-$$
-
-fail=0
-
-trap 'rm -fr $file $other_partition_tmpdir; exit $fail' 0 1 2 3 15
-
-framework_failure=0
-rm -f $file || framework_failure=1
-echo local > $file || framework_failure=1
-echo remote > $rem_file || framework_failure=1
-ln -s $rem_file $rem_symlink || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
-
-# This mv command should succeed, unlinking the symlink
-# before copying.
-mv $file $rem_symlink || fail=1
-
-# Make sure $file is gone.
-test -f $file && fail=1
-
-# Make sure $rem_file is unmodified.
-test `cat $rem_file` = remote || fail=1
-
-exit $fail
diff --git a/tests/mv/to-symlink.sh b/tests/mv/to-symlink.sh
new file mode 100755
index 0000000..618abda
--- /dev/null
+++ b/tests/mv/to-symlink.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+# Make sure that the copying code used in an inter-partition
+# move unlinks a destination symlink before opening it.
+
+# Copyright (C) 1999-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
+cleanup_() { rm -rf "$other_partition_tmpdir"; }
+. "$abs_srcdir/tests/other-fs-tmpdir"
+
+rem_file="$other_partition_tmpdir/file"
+rem_symlink="$other_partition_tmpdir/symlink"
+file=to-sym
+
+echo local > $file || framework_failure_
+echo remote > $rem_file || framework_failure_
+ln -s $rem_file $rem_symlink || framework_failure_
+
+# This mv command should succeed, unlinking the symlink
+# before copying.
+mv $file $rem_symlink || fail=1
+
+# Make sure $file is gone.
+test -f $file && fail=1
+
+# Make sure $rem_file is unmodified.
+test $(cat $rem_file) = remote || fail=1
+
+Exit $fail
diff --git a/tests/mv/trailing-slash b/tests/mv/trailing-slash.sh
index b734624..954282d 100755
--- a/tests/mv/trailing-slash
+++ b/tests/mv/trailing-slash.sh
@@ -4,11 +4,11 @@
# Also, ensure that "mv dir non-exist-dir/" works.
# Also, ensure that "cp dir non-exist-dir/" works.
-# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2004-2016 Free Software Foundation, Inc.
-# This program is free software; you can redistribute it and/or modify
+# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
@@ -17,45 +17,21 @@
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
-fi
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ mv
-pwd=`pwd`
-tmp=mv-tslash.$$
-trap 'status=$?; cd "$pwd" && exec 1>&2; rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
+mkdir foo || framework_failure_
-. $srcdir/../envvar-check
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir foo || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework' 1>&2
- exit 1
-fi
-
-fail=0
mv foo/ bar || fail=1
# mv and cp would misbehave for coreutils versions [5.3.0..5.97], 6.0 and 6.1
for cmd in mv 'cp -r'; do
for opt in '' -T -u; do
- rm -rf d e || framework_failure=1
- mkdir d || framework_failure=1
- if test $framework_failure = 1; then
- echo 'failure in testing framework'
- (exit 1); exit 1
- fi
+ rm -rf d e || framework_failure_
+ mkdir d || framework_failure_
$cmd $opt d e/ || fail=1
if test "$cmd" = mv; then
@@ -72,6 +48,18 @@ done
# underlying rename syscall handles the trailing slash.
# It does fail, as desired, on recent Linux and Solaris systems.
#touch a a2
-#mv a a2/ && fail=1
+#returns_ 1 mv a a2/ || fail=1
+
+# Test for a cp-specific diagnostic introduced after coreutils-8.7:
+printf '%s\n' \
+ "cp: cannot create regular file 'no-such/': Not a directory" \
+> expected-err
+touch b
+cp b no-such/ 2> err
+
+# Map "No such file..." diagnostic to the expected "Not a directory"
+sed 's/No such file or directory/Not a directory/' err > k && mv k err
+
+compare expected-err err || fail=1
-(exit $fail); exit $fail
+Exit $fail
diff --git a/tests/mv/update b/tests/mv/update
deleted file mode 100755
index 6bf161e..0000000
--- a/tests/mv/update
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/bin/sh
-# make sure --update works as advertised
-
-# Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-if test "$VERBOSE" = yes; then
- set -x
- cp --version
- mv --version
-fi
-
-. $srcdir/../envvar-check
-. $srcdir/../lang-default
-
-pwd=`pwd`
-tmp=mv-update.$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-echo old > old || framework_failure=1
-touch -d yesterday old || framework_failure=1
-echo new > new || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework' 1>&2
- (exit 1); exit 1
-fi
-
-fail=0
-
-for cp_or_mv in cp mv; do
- # This is a no-op.
- $cp_or_mv --update old new || fail=1
- case "`cat new`" in new) ;; *) fail=1 ;; esac
- case "`cat old`" in old) ;; *) fail=1 ;; esac
-done
-
-# This will actually perform the rename.
-mv --update new old || fail=1
-test -f new && fail=1
-case "`cat old`" in new) ;; *) fail=1 ;; esac
-
-# Restore initial conditions.
-echo old > old || fail=1
-touch -d yesterday old || fail=1
-echo new > new || fail=1
-
-# This will actually perform the copy.
-cp --update new old || fail=1
-case "`cat old`" in new) ;; *) fail=1 ;; esac
-case "`cat new`" in new) ;; *) fail=1 ;; esac
-
-(exit $fail); exit $fail
diff --git a/tests/mv/update.sh b/tests/mv/update.sh
new file mode 100755
index 0000000..945a398
--- /dev/null
+++ b/tests/mv/update.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+# make sure --update works as advertised
+
+# Copyright (C) 2001-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ cp mv
+
+echo old > old || framework_failure_
+touch -d yesterday old || framework_failure_
+echo new > new || framework_failure_
+
+
+for interactive in '' -i; do
+ for cp_or_mv in cp mv; do
+ # This is a no-op, with no prompt.
+ # With coreutils-6.9 and earlier, using --update with -i would
+ # mistakenly elicit a prompt.
+ $cp_or_mv $interactive --update old new < /dev/null > out 2>&1 || fail=1
+ compare /dev/null out || fail=1
+ case "$(cat new)" in new) ;; *) fail=1 ;; esac
+ case "$(cat old)" in old) ;; *) fail=1 ;; esac
+ done
+done
+
+# This will actually perform the rename.
+mv --update new old || fail=1
+test -f new && fail=1
+case "$(cat old)" in new) ;; *) fail=1 ;; esac
+
+# Restore initial conditions.
+echo old > old || fail=1
+touch -d yesterday old || fail=1
+echo new > new || fail=1
+
+# This will actually perform the copy.
+cp --update new old || fail=1
+case "$(cat old)" in new) ;; *) fail=1 ;; esac
+case "$(cat new)" in new) ;; *) fail=1 ;; esac
+
+Exit $fail
diff --git a/tests/mv/vfat b/tests/mv/vfat
deleted file mode 100644
index 20b10e2..0000000
--- a/tests/mv/vfat
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/bin/sh
-# This is just for the record.
-# This test is not run.
-
-# Copyright (C) 2003 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-exit 0
-
-cat <<\EOF
-
-Prior to 5.0.91, ...
-
-The problem:
- On a VFAT file system with coreutils-5.0.90, `mv FOO foo' removes the
- sole copy of the file named by both the source and destination arguments.
-
-Demonstrate the problem, as root:
-
-cd /tmp \
- && dd if=/dev/zero of=1 bs=8192 count=50 \
- && mkdir mnt && mkfs -t vfat 1 \
- && mount -oloop 1 mnt && cd mnt \
- && printf something important > foo \
- && mv foo FOO
-test -f FOO && echo PASS-1 || echo FAIL-1
-ln foo bar
-mv foo FOO
-test -f FOO && echo PASS-2 || echo FAIL-2
-
-And in case you actually do the above, you can do this to clean up:
-
- cd /tmp && umount /tmp/mnt && rm -r 1 mnt
-
-Hey! Can't create hard links on vfat.
-The above `ln' evokes an `operation not permitted' failure.
-
-This demonstrates the same thing with file system type `umsdos'
-No hard links:
-
-cd /tmp \
- && dd if=/dev/zero of=1 bs=8192 count=50 \
- && mkdir mnt && mkfs -t msdos 1 \
- && mount -t umsdos -oloop 1 mnt && cd mnt \
- && printf something important > foo \
- && mv foo FOO
-test -f FOO && echo PASS-1 || echo FAIL-1
-ln foo bar
-mv foo FOO
-test -f FOO && echo PASS-2 || echo FAIL-2
-
-EOF