git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eric Sunshine <ericsunshine@charter.net>
To: git@vger.kernel.org
Cc: Eric Sunshine <sunshine@sunshineco.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: [PATCH] test-lib: fix non-functioning GIT_TEST_MAINT_SCHEDULER fallback
Date: Fri, 29 Mar 2024 18:27:03 -0400	[thread overview]
Message-ID: <20240329222703.9343-1-ericsunshine@charter.net> (raw)
In-Reply-To: <xmqqmsqhsvwk.fsf@gitster.g>

From: Eric Sunshine <sunshine@sunshineco.com>

When environment variable GIT_TEST_MAINT_SCHEDULER is set, `git
maintenance` invokes the command specified as the variable's value
rather than invoking the actual underlying platform-specific scheduler
management command. By setting GIT_TEST_MAINT_SCHEDULER to some suitable
value, test authors can therefore validate behavior of "destructive"
`git maintenance` commands without having to worry about clobbering the
user's own local scheduler configuration.

In order to protect an absent-minded test author from forgetting to set
GIT_TEST_MAINT_SCHEDULER in the local test script (and thus clobbering
his or her own scheduler configuration), t/test-lib.sh assigns an
"immediately error-out" value to GIT_TEST_MAINT_SCHEDULER by default
which should ensure that the problem will be caught and reported before
any damage can be done to the configuration of the person running the
tests.

Unfortunately, however, t/test-lib.sh neglects to export
GIT_TEST_MAINT_SCHEDULER, which renders the default "error-out"
assignment worthles. Fix this by exporting the variable as originally
intended.

Reported-by: Junio C Hamano <gitster@pobox.com>
Signed-of-by: Eric Sunshine <sunshine@sunshineco.com>
---

This is a replacement for Junio's [1]. That attempt made it easier for a
test author to shoot him or herself in the foot. This replacement patch
instead fixes the foot-shooting guard.

[1]: https://lore.kernel.org/git/xmqqmsqhsvwk.fsf@gitster.g/

 t/test-lib.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index c8af8dab79..79d3e0e7d9 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1962,6 +1962,7 @@ test_lazy_prereq DEFAULT_REPO_FORMAT '
 # Tests that verify the scheduler integration must set this locally
 # to avoid errors.
 GIT_TEST_MAINT_SCHEDULER="none:exit 1"
+export GIT_TEST_MAINT_SCHEDULER
 
 # Does this platform support `git fsmonitor--daemon`
 #
-- 
2.44.0



  parent reply	other threads:[~2024-03-29 22:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-29  0:51 [PATCH] do not set GIT_TEST_MAINT_SCHEDULER where it does not matter Junio C Hamano
2024-03-29  2:43 ` Eric Sunshine
2024-03-29  5:38   ` Junio C Hamano
2024-03-29 22:27 ` Eric Sunshine [this message]
2024-03-31  6:51   ` [PATCH] test-lib: fix non-functioning GIT_TEST_MAINT_SCHEDULER fallback Eric Sunshine

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20240329222703.9343-1-ericsunshine@charter.net \
    --to=ericsunshine@charter.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sunshine@sunshineco.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).