summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2023-01-27 10:59:13 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2023-01-27 11:03:38 -0800
commit20005ca733e111a61212ee8a6890a54583c55562 (patch)
tree97fff68c621a25523b4c61f0ae61bede6e239898 /tests
parentd5868df0d0a6bd09387ece41b62b873fd7c201f9 (diff)
downloadcoreutils-20005ca733e111a61212ee8a6890a54583c55562.tar.gz
mv: new option --no-copy
Wishlist item from Mike Frysinger (Bug#61050). * src/copy.c (copy_internal): Do not fall back on copying if x->no_copy. * src/copy.h (struct cp_options): New member no_copy. * src/mv.c (NO_COPY_OPTION): New constant. (long_options, usage, main): Support --no-copy. * tests/mv/no-copy.sh: New test. * tests/local.mk (all_tests): Add it.
Diffstat (limited to 'tests')
-rw-r--r--tests/local.mk1
-rwxr-xr-xtests/mv/no-copy.sh33
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/local.mk b/tests/local.mk
index 86908ef4f..f6e3746b6 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -686,6 +686,7 @@ all_tests = \
tests/mv/leak-fd.sh \
tests/mv/mv-n.sh \
tests/mv/mv-special-1.sh \
+ tests/mv/no-copy.sh \
tests/mv/no-target-dir.sh \
tests/mv/part-fail.sh \
tests/mv/part-hardlink.sh \
diff --git a/tests/mv/no-copy.sh b/tests/mv/no-copy.sh
new file mode 100755
index 000000000..fba475c03
--- /dev/null
+++ b/tests/mv/no-copy.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+# Test mv --no-copy.
+
+# Copyright (C) 2023 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 <https://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"
+
+mkdir dir || framework_failure_
+> dir/a || framework_failure_
+> file || framework_failure_
+
+mv --no-copy dir "$other_partition_tmpdir" && fail=1
+mv --no-copy file "$other_partition_tmpdir" && fail=1
+mv dir "$other_partition_tmpdir" || fail=1
+mv file "$other_partition_tmpdir" || fail=1
+
+Exit $fail