Pádraig Brady <[email protected]> writes: > On 13/11/2025 03:58, Collin Funk wrote: >> +ln file1 hardlink1 || fail=1 >> +ln file2 hardlink2 || fail=1 > > I wouldn't fail there, rather framework_failure_ > Though you might support running on certain network file systems or > something, so: > > if ln file1 hardlink1 && ln file2 hardlink2; then > run this part of the test > fi
Thanks for the review. I pushed the attached patch. It uses framework_failure_ when creating the symbolic links and checks if the hard links can be created. Collin
>From 57b3ccc9b061810ee5f8a3bdfecf5ad6713217de Mon Sep 17 00:00:00 2001 Message-ID: <57b3ccc9b061810ee5f8a3bdfecf5ad6713217de.1763060576.git.collin.fu...@gmail.com> From: Collin Funk <[email protected]> Date: Wed, 12 Nov 2025 19:58:52 -0800 Subject: [PATCH v2] tests: test: add test cases for -ef * tests/test/test-file.sh: Check that -ef works as expected on files, symbolic links, and hard links. --- tests/test/test-file.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/test/test-file.sh b/tests/test/test-file.sh index d5fb44967..026ca9778 100755 --- a/tests/test/test-file.sh +++ b/tests/test/test-file.sh @@ -61,4 +61,34 @@ returns_ 1 env test file1 -nt file2 || fail=1 env test file1 -ot file2 || fail=1 returns_ 1 env test file2 -ot file1 || fail=1 +# Test "-ef" on files that do not resolve. +returns_ 1 env test missing1 -ef missing2 || fail=1 +returns_ 1 env test missing2 -ef missing1 || fail=1 +returns_ 1 env test file1 -ef missing1 || fail=1 +returns_ 1 env test missing1 -ef file1 || fail=1 + +# Test "-ef" on normal files. +env test file1 -ef file1 || fail=1 +returns_ 1 env test file1 -ef file2 || fail=1 + +# Test "-ef" on symbolic links. +ln -s file1 symlink1 || framework_failure_ +ln -s file2 symlink2 || framework_failure_ +env test file1 -ef symlink1 || fail=1 +env test symlink1 -ef file1 || fail=1 +returns_ 1 env test file1 -ef symlink2 || fail=1 +returns_ 1 env test symlink2 -ef file1 || fail=1 +returns_ 1 env test symlink1 -ef symlink2 || fail=1 +returns_ 1 env test symlink2 -ef symlink1 || fail=1 + +# Test "-ef" on hard links. +if ln file1 hardlink1 && ln file2 hardlink2; then + env test file1 -ef hardlink1 || fail=1 + env test hardlink1 -ef file1 || fail=1 + returns_ 1 env test file1 -ef hardlink2 || fail=1 + returns_ 1 env test hardlink2 -ef file1 || fail=1 + returns_ 1 env test hardlink1 -ef hardlink2 || fail=1 + returns_ 1 env test hardlink2 -ef hardlink1 || fail=1 +fi + Exit $fail -- 2.51.1
