From nobody Wed Dec 13 21:31:22 2023 X-Original-To: dev-commits-src-main@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 4Sr7vt3NWZz54Ltm; Wed, 13 Dec 2023 21:31:22 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Sr7vt2xQYz3Lfb; Wed, 13 Dec 2023 21:31:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1702503082; 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=37zzbA4kg+jPd7HGz0bX5XNd2CUixnV7gWoJG+GsIG4=; b=qKmG4Vci5NCkXXmSWcTKVw/nccwJKh8Kj+ihjtjHXKnRxORv4+HF+7nCuWmOChKh4zkC/l 4CZ8Z+xQWYcN6SYXQ8x9JEQUQ57HGJxA2FkzUtalh1q0+xqiIOXuzkZsRqnxdmbl1hD+jj N8o6fjR6N6O+n4UjYjFxvh3j/X0TTd5LeVuTO7MLveKnx5J563rizy8oHaUEvyIR0P8LOv KJSiU6iNKVVPpU4m1e+NoAiiaKUWkIbuU4Ed/WtaNbvkK1K5sogn4Srt+B1KK6j9CtXGl+ oWlk+wSK304ai6YbZm1/y4sgFQsUIyAl4v5sWLpdB9TKU16Taut1rkjnvwA5Nw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1702503082; a=rsa-sha256; cv=none; b=ouef4qsOgxDOi5PkmPZDDjJ7XBHIDugj/S1cEBuBwluWsR612vOJZo8QNmKzePHPEWycVu YvI1G3/o82YZ+k16PF1SfcYMxKLav+kexvAd8job3Z9IvLbR7khd3EbmU8vO/i2DrvfiuE YQSP4Q2iio7G4XGDwi64OPMW7X4PkeXcdGaCAWOMpSa7wQ5f21lgpMfcbVqUivFKN+wJDF w1FWhVyjrwA9hI2u5TBCUWVyfUnc8jayU7F1u5T36X56Ymr6Z1mBK3W6++yF7VwzsvEACJ i9gBLstylqaM1UKtvoCxX25lhXWCU+D4fbcmujK+HEGcSqkEaqpuMrb7j2jnPw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1702503082; 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=37zzbA4kg+jPd7HGz0bX5XNd2CUixnV7gWoJG+GsIG4=; b=MgrC++1NdXca33bwfSUAhVID3AAAtOJ0vzePmzpGivs6L5K5Lz+xPNEOcayjuzZKMpMeLV 9dh6lv5yly3UHTcutU7jvgGgaBIwEKb0hfNoojzOHfbeNqz3Pey6NGhZ974omSyTche08E WerMbTv4Q7WUgG0B8DmEU36ZLVjXxP204FDAjhT4zNvTjh+UVlgBb8phbEP3OXmljix09z +s4quHz/saY/w9p63FQroxgJZxZpKohMnjNHRBxLIylIe0fBO8JsbUsioZWpYeAqebtaqp I5P7OdfMASp1wuNiH0DMsr5V63U0NUQp+jEwGnPnkDIxLm02YGqX/pdKtoJ/0Q== 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 4Sr7vt207Cz1FHX; Wed, 13 Dec 2023 21:31:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BDLVMdM033025; Wed, 13 Dec 2023 21:31:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BDLVM98033022; Wed, 13 Dec 2023 21:31:22 GMT (envelope-from git) Date: Wed, 13 Dec 2023 21:31:22 GMT Message-Id: <202312132131.3BDLVM98033022@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: 1fead66b6482 - main - cp: Add tests for hard link case. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: 1fead66b64822f3f8106ad09bef0b9656836fa1a Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=1fead66b64822f3f8106ad09bef0b9656836fa1a commit 1fead66b64822f3f8106ad09bef0b9656836fa1a Author: Dag-Erling Smørgrav AuthorDate: 2023-12-13 21:31:05 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-12-13 21:31:16 +0000 cp: Add tests for hard link case. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D43052 --- bin/cp/tests/cp_test.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/bin/cp/tests/cp_test.sh b/bin/cp/tests/cp_test.sh index f995d709cc3c..52f33c93d31a 100755 --- a/bin/cp/tests/cp_test.sh +++ b/bin/cp/tests/cp_test.sh @@ -71,6 +71,35 @@ chrdev_body() check_size trunc 0 } +atf_test_case hardlink +hardlink_body() +{ + echo "foo" >foo + atf_check cp -l foo bar + atf_check -o inline:"foo\n" cat bar + atf_check_equal "$(stat -f%d,%i foo)" "$(stat -f%d,%i bar)" +} + +atf_test_case hardlink_exists +hardlink_exists_body() +{ + echo "foo" >foo + echo "bar" >bar + atf_check -s not-exit:0 -e match:exists cp -l foo bar + atf_check -o inline:"bar\n" cat bar + atf_check_not_equal "$(stat -f%d,%i foo)" "$(stat -f%d,%i bar)" +} + +atf_test_case hardlink_exists_force +hardlink_exists_force_body() +{ + echo "foo" >foo + echo "bar" >bar + atf_check cp -fl foo bar + atf_check -o inline:"foo\n" cat bar + atf_check_equal "$(stat -f%d,%i foo)" "$(stat -f%d,%i bar)" +} + atf_test_case matching_srctgt matching_srctgt_body() { @@ -298,6 +327,9 @@ atf_init_test_cases() atf_add_test_case basic atf_add_test_case basic_symlink atf_add_test_case chrdev + atf_add_test_case hardlink + atf_add_test_case hardlink_exists + atf_add_test_case hardlink_exists_force atf_add_test_case matching_srctgt atf_add_test_case matching_srctgt_contained atf_add_test_case matching_srctgt_link