Git development
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org, Miguel Rincon Barahona <mrincon@gitlab.com>,
	Kev Kloss <kkloss@gitlab.com>, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] t7900: fix host-dependent behaviour when testing git-maintenance(1)
Date: Mon, 25 Nov 2024 06:52:47 -0500	[thread overview]
Message-ID: <20241125115247.GA1070119@coredump.intra.peff.net> (raw)
In-Reply-To: <eb504a75147d8609be66e131d239a69d192d693d.1732511129.git.ps@pks.im>

On Mon, Nov 25, 2024 at 06:33:41AM +0100, Patrick Steinhardt wrote:

> 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.

>  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

      reply	other threads:[~2024-11-25 11:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-19 10:48 [PATCH] builtin/gc: provide hint when maintenance hits a stale schedule lock Patrick Steinhardt
2024-11-19 17:17 ` Justin Tobler
2024-11-22 15:30 ` Jeff King
2024-11-25  5:33   ` [PATCH] t7900: fix host-dependent behaviour when testing git-maintenance(1) Patrick Steinhardt
2024-11-25 11:52     ` Jeff King [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241125115247.GA1070119@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=kkloss@gitlab.com \
    --cc=mrincon@gitlab.com \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox