Re: [PATCH] tests: test: add test cases for -nt and -ot
From:
Collin Funk
Subject:
Re: [PATCH] tests: test: add test cases for -nt and -ot
Date:
Wed, 12 Nov 2025 10:55:47 -0800
User-agent:
Gnus/5.13 (Gnus v5.13)
Pádraig Brady <P@draigBrady.com> writes:
> Right. Non existent files are considered infinitely old.
>
> I see I recently generated this test-file.sh based on a coverage report,
> however I missed the fact that the -nt and -ot options were also not covered,
> which I checked just now. I also notice that the -ef option is not covered
> either, so we should add a case for that also.
Yep, I figured -ef was best to leave for another patch. I'll write that
one in a bit.
> As for the test implementation above, I don't think we can rely on
> "newfile" being newer, as it's dependent on file system time resolution.
> I think we'd have to explicitly set the dates as is done in
> tests/date/reference.sh for example.
Right, we can just create files with different timestamps...
I was thinking of adding a sleep since I recall Autoconf's test suite
trying to figure out what resolution the file system supports and then
using that. But Autoconf probably has to assume the system has an
inadequate 'touch' command.
I pushed the attatched patch instead. Thanks for the review.
Collin