Re: [PATCH] t7900: fix host-dependent behaviour when testing git-maintenance(1)
- From
Jeff King <peff@peff.net>
- Date
- Nov 25, 2024, 11:52 UTC
- Message-ID
- <20241125115247.GA1070119@coredump.intra.peff.net>
- In-Reply-To
- <eb504a75147d8609be66e131d239a69d192d693d.1732511129.git.ps@pks.im>
On Mon, Nov 25, 2024 at 06:33:41AM +0100, Patrick Steinhardt wrote:
Show 10 quoted lines
> We have recently added a new test to t7900 that exercises whether > git-maintenance(1) fails as expected when the "schedule.lock" file > exists. The test depends on whether or not the host has the required > executables present to schedule maintenance tasks in the first place, > like systemd or launchctl -- if not, the test fails with an unrelated > error before even checking for the lock file. This fails for example in > our CI systems, where macOS images do not have launchctl available. > > Fix this issue by creating a stub systemctl(1) binary and using the > systemd scheduler.
Thanks, this explanation makes sense and clears up the CI issues I saw.
Show 14 quoted lines
> test_expect_success 'maintenance aborts with existing lock file' ' > - test_when_finished "rm -rf repo" && > + test_when_finished "rm -rf repo script" && > + mkdir script && > + write_script script/systemctl <<-\EOF && > + true > + EOF > + > git init repo && > : >repo/.git/objects/schedule.lock && > - test_must_fail git -C repo maintenance start 2>err && > + test_must_fail env PATH="$PWD/script:$PATH" git -C repo maintenance start --scheduler=systemd 2>err && > test_grep "Another scheduled git-maintenance(1) process seems to be running" err > '
As always, I am never sure whether to use $PWD or $(pwd) for the benefit of Windows. But digging up this message:
https://lore.kernel.org/git/2b69d098-92ef-77b0-367a-516e9edbe257@kdbg.org/
I think $PWD is right here.
-Peff