Page MenuHomeFreeBSD

D47582.diff
No OneTemporary

D47582.diff

diff --git a/bin/mv/tests/mv_test.sh b/bin/mv/tests/mv_test.sh
--- a/bin/mv/tests/mv_test.sh
+++ b/bin/mv/tests/mv_test.sh
@@ -371,6 +371,118 @@
mv_cleanup
}
+atf_test_case mv_f cleanup
+mv_f_head() {
+ atf_set "descr" "Force replacement"
+ atf_set "require.user" "root"
+}
+mv_f_body() {
+ mv_setup
+ for FS in "" "fs/" ; do
+ mv_makefile fa
+ atf_check mv fa ${FS}fb
+ mv_checkfile fa ${FS}fb
+ mv_checkabsent fa
+ mv_makefile fa
+ :> ${FS}fb
+ atf_check mv -i -n -f fa ${FS}fb
+ mv_checkfile fa ${FS}fb
+ mv_checkabsent fa
+ done
+}
+mv_f_cleanup() {
+ mv_cleanup
+}
+
+atf_test_case mv_h cleanup
+mv_h_head() {
+ atf_set "descr" "Replace symbolic link"
+ atf_set "require.user" "root"
+}
+mv_h_body() {
+ mv_setup
+ for FS in "" "fs/" ; do
+ atf_check mkdir ${FS}da
+ atf_check ln -s da ${FS}db
+ # First test without -h, file goes into symlink target
+ mv_makefile fa
+ atf_check mv fa ${FS}db
+ mv_checkfile fa ${FS}da/fa
+ # Second test with -h, file replaces symlink
+ mv_makefile fa
+ atf_check mv -h fa ${FS}db
+ mv_checkfile fa ${FS}db
+ done
+}
+mv_h_cleanup() {
+ mv_cleanup
+}
+
+atf_test_case mv_i cleanup
+mv_i_head() {
+ atf_set "descr" "Confirm replacement"
+ atf_set "require.user" "root"
+}
+mv_i_body() {
+ mv_setup
+ echo n >n
+ echo y >y
+ for FS in "" "fs/" ; do
+ mv_makefile fa
+ mv_makefile ${FS}fb
+ # First test, answer no, file is not replaced
+ atf_check -e match:"^overwrite ${FS}fb\\?" \
+ mv -i fa ${FS}fb <n
+ mv_checkfile fa fa
+ mv_checkfile fb ${FS}fb
+ # Second test, answer yes, file is replaced
+ atf_check -e match:"^overwrite ${FS}fb\\?" \
+ mv -i fa ${FS}fb <y
+ mv_checkabsent fa
+ mv_checkfile fa ${FS}fb
+ done
+}
+mv_i_cleanup() {
+ mv_cleanup
+}
+
+atf_test_case mv_n cleanup
+mv_n_head() {
+ atf_set "descr" "Decline replacement"
+ atf_set "require.user" "root"
+}
+mv_n_body() {
+ mv_setup
+ for FS in "" "fs/" ; do
+ mv_makefile fa
+ mv_makefile ${FS}fb
+ atf_check mv -n fa ${FS}fb
+ mv_checkfile fa fa
+ mv_checkfile fb ${FS}fb
+ done
+}
+mv_n_cleanup() {
+ mv_cleanup
+}
+
+atf_test_case mv_v cleanup
+mv_v_head() {
+ atf_set "descr" "Verbose mode"
+ atf_set "require.user" "root"
+}
+mv_v_body() {
+ mv_setup
+ for FS in "" "fs/" ; do
+ mv_makefile fa
+ atf_check mkdir ${FS}da
+ atf_check -o inline:"fa -> ${FS}da/fa\n" \
+ mv -v fa ${FS}da
+ done
+}
+mv_v_cleanup() {
+ mv_cleanup
+}
+
atf_init_test_cases() {
atf_add_test_case rename_file
atf_add_test_case file_into_dir
@@ -388,4 +500,9 @@
atf_add_test_case fifo_into_dir
atf_add_test_case fifo_from_dir
atf_add_test_case fifo_from_dir_into_dir
+ atf_add_test_case mv_f
+ atf_add_test_case mv_h
+ atf_add_test_case mv_i
+ atf_add_test_case mv_n
+ atf_add_test_case mv_v
}

File Metadata

Mime Type
text/plain
Expires
Sat, Jan 31, 1:38 AM (15 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28103425
Default Alt Text
D47582.diff (2 KB)

Event Timeline