From nobody Tue Nov 19 09:29:34 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XszjB6R12z5dpkZ; Tue, 19 Nov 2024 09:29:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XszjB4z2zz4bs1; Tue, 19 Nov 2024 09:29:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732008574; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=o+HBIfeRq2oIAo3FYT/Q+SeupJtqp64n8DxEH9sfy38=; b=rLPYMy0epoGr1+RBQdA2eo98+m6sy/D0DxL29xziHOcHIuSZiu2ki6Gx3S6SrZYnQMradx CJIpHySQaN8VZ9ZZzuQjPPpVCMTKlTOOxNSOXWM7AsqUZauz+tHC0sR/XHezoK4nbpniOS P+5HDs9d35lt0PSh1c/lWamo8svRhkt35WkPGnodQpdd0qpU3xybVSlePZb/LcOqMktOBj QiWR9PFS0eX+9WUonwKWNoT20M6/uCtO/7MI5eq53HVSjsoZMdJU4QgKwJO024V6/fk2nI Ait2oUZV7Ak0J2GMVGX5xOk2rpvlZoCiE48l89sOGvebLDqFIlbinlS+sutxSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732008574; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=o+HBIfeRq2oIAo3FYT/Q+SeupJtqp64n8DxEH9sfy38=; b=A9tTAiimRqGzDGcyW57ItuBJ5NkOaVYoANSJOC+j/YfGf6fPUS9abZlMt5xJ0pZf5AcLRi io1R0hKP0pwq583aPjm+glEu5FGqFD7ouByNe7HneDI08+m7ObcdVROCgOmnqRQl7q7BAC e8MMi9IrTamPMUGAwylUkODffsBxcL28AIGdMISS1B3v1MR+tDvfqPuygwGB6gSVSqve2B d74ff7mEaBBpwTeGpANGphFxJ7owyGMnwtgqBS4lgthwtFe62Qj8rPDalc3UApBHl1pJN1 QEyDEMunZFIFmF6cQeoFF5V6nD8Ca0ADpflDBn3coclN5bs6aiVE83QcOeYobQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732008574; a=rsa-sha256; cv=none; b=H91vnLleHh0U+PRnk+H9Bki5xU1KxeIjewyxvgVgdwSCgAFNzOC5IEM8ekDIHQ5gl2ttM1 FtyOgBD27sk0f/reUOSmf/eO6RsuU5Wqnqg9nMZWx4f6xa9dCIwsnhdJjjY0YGEvh0dDG/ 8tyCdL2RBQC6tYs5Lj15dUlQdBX9qlDzia3a8cuQhnGKucf6fLg+EYa3wJ6PbOduiYqZPw T9KZDLSbNiL2Zi6DTLyLX7cUkCTn1omgnwvQBLhhbd8jxa3FZvLiNRFv6pP1Jpb4c9i/HK hfa7yPUeHORKr4w4Arz0YWrE+HDE0ncZeQNICjFBZV5gAUtA0eO8P3SAMrH7wA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XszjB4SQXz1J3k; Tue, 19 Nov 2024 09:29:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4AJ9TYbU070526; Tue, 19 Nov 2024 09:29:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AJ9TYZo070523; Tue, 19 Nov 2024 09:29:34 GMT (envelope-from git) Date: Tue, 19 Nov 2024 09:29:34 GMT Message-Id: <202411190929.4AJ9TYZo070523@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: d4fb5984ab0b - main - mv: Add test cases for command-line options. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d4fb5984ab0b96cc784c907e622deda910d020f2 Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=d4fb5984ab0b96cc784c907e622deda910d020f2 commit d4fb5984ab0b96cc784c907e622deda910d020f2 Author: Dag-Erling Smørgrav AuthorDate: 2024-11-19 09:29:15 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2024-11-19 09:29:15 +0000 mv: Add test cases for command-line options. Sponsored by: Klara, Inc. Reviewed by: asomers Differential Revision: https://reviews.freebsd.org/D47582 --- bin/mv/tests/mv_test.sh | 117 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) diff --git a/bin/mv/tests/mv_test.sh b/bin/mv/tests/mv_test.sh index aae4bc3f9297..4412d5e88c5e 100644 --- a/bin/mv/tests/mv_test.sh +++ b/bin/mv/tests/mv_test.sh @@ -371,6 +371,118 @@ fifo_from_dir_into_dir_cleanup() { 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 ${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_init_test_cases() { 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 }