diff options
| author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2023-12-13 21:31:05 +0000 |
|---|---|---|
| committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2023-12-13 21:31:16 +0000 |
| commit | 1fead66b64822f3f8106ad09bef0b9656836fa1a (patch) | |
| tree | 6f8a600458447ac553b0ecc7f784917a7393a2db /bin/cp | |
| parent | 894f3f48c3ea27a6f0f54850595ff48db9ee4861 (diff) | |
Diffstat (limited to 'bin/cp')
| -rwxr-xr-x | bin/cp/tests/cp_test.sh | 32 |
1 files changed, 32 insertions, 0 deletions
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 |
