git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 4/5] tests: do not require Git to be built when testing an installed Git

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Nov 14, 2018, 13:41 UTC
Message-ID
<nycvar.QRO.7.76.6.1811141441030.39@tvgsbejvaqbjf.bet>
In-Reply-To
<20181114125206.GA32308@sigill.intra.peff.net>
Hi Peff,
On Wed, 14 Nov 2018, Jeff King wrote:
Show 44 quoted lines
> On Mon, Nov 12, 2018 at 05:48:37AM -0800, Johannes Schindelin via GitGitGadget wrote:
> 
> > diff --git a/t/test-lib.sh b/t/test-lib.sh
> > index 832ede5099..1ea20dc2dc 100644
> > --- a/t/test-lib.sh
> > +++ b/t/test-lib.sh
> > @@ -51,7 +51,7 @@ export LSAN_OPTIONS
> >  
> >  ################################################################
> >  # It appears that people try to run tests without building...
> > -"$GIT_BUILD_DIR/git" >/dev/null
> > +test -n "$GIT_TEST_INSTALLED" || "$GIT_BUILD_DIR/git" >/dev/null ||
> >  if test $? != 1
> >  then
> >  	echo >&2 'error: you do not seem to have built git yet.'
> 
> The original runs the command independently and then checks $?. Your
> replacement chains the ||. I think it works, because the only case that
> is different is if running git returns 0 (in which case we currently
> complain, but the new code would quietly accept this).
> 
> That should never happen, but if it does we'd probably want to complain.
> And it's pretty subtle all around.  Maybe this would be a bit clearer:
> 
>   if test -n "$GIT_TEST_INSTALLED"
>   then
> 	: assume installed git is OK
>   else
> 	"$GIT_BUILD_DIR/git" >/dev/null
> 	if test $? != 1
> 	then
> 		... die ...
> 	fi
>   fi
> 
> Though arguably we should be checking that there is a git in our path in
> the first instance. So maybe:
> 
>   if test -n "$GIT_TEST_INSTALLED"
> 	"$GIT_TEST_INSTALLED/git" >/dev/null
>   else
> 	"$GIT_BUILD_DIR/git" >/dev/null
>   fi
>   if test $? != 1 ...

You're right. I did it using `"${GIT_TEST_INSTALLED:-$GIT_BUILD_DIR}/git"` and I also adjust the error message now.

Will be fixed in the next iteration, Dscho

> 
> -Peff
> 
Previous: Jeff KingNext: Johannes Schindelin via GitGitGadget
Message 17 of 27 in “tests: various improvements to the GIT_TEST_INSTALLED feature”
  1. 0/5 tests: various improvements to the GIT_TEST_INSTALLED featureJohannes Schindelin via GitGitGadget, Nov 12, 2018
  2. 1/5 tests: fix GIT_TEST_INSTALLED's PATH to include t/helper/Johannes Schindelin via GitGitGadget, Nov 12, 2018
  3. Junio C HamanoNov 14, 2018
  4. 3/5 t/lib-gettext: test installed git-sh-i18n if GIT_TEST_INSTALLED is setJohannes Schindelin via GitGitGadget, Nov 12, 2018
  5. Junio C HamanoNov 14, 2018
  6. 2/5 tests: respect GIT_TEST_INSTALLED when initializing repositoriesJohannes Schindelin via GitGitGadget, Nov 12, 2018
  7. Junio C HamanoNov 14, 2018
  8. Johannes SchindelinNov 14, 2018
  9. Junio C HamanoNov 14, 2018
  10. Jeff KingNov 14, 2018
  11. Johannes SchindelinNov 15, 2018
  12. Jeff KingNov 15, 2018
  13. 4/5 tests: do not require Git to be built when testing an installed GitJohannes Schindelin via GitGitGadget, Nov 12, 2018
  14. Junio C HamanoNov 14, 2018
  15. Johannes SchindelinNov 14, 2018
  16. Jeff KingNov 14, 2018
  17. Johannes SchindelinNov 14, 2018
  18. 5/5 tests: explicitly use `git.exe` on WindowsJohannes Schindelin via GitGitGadget, Nov 12, 2018
  19. Junio C HamanoNov 14, 2018
  20. Johannes SchindelinNov 14, 2018
  21. Junio C HamanoNov 14, 2018
  22. 0/5 tests: various improvements to the GIT_TEST_INSTALLED featureJohannes Schindelin via GitGitGadget, Nov 14, 2018
  23. 1/5 tests: fix GIT_TEST_INSTALLED's PATH to include t/helper/Johannes Schindelin via GitGitGadget, Nov 14, 2018
  24. 2/5 tests: respect GIT_TEST_INSTALLED when initializing repositoriesJohannes Schindelin via GitGitGadget, Nov 14, 2018
  25. 3/5 t/lib-gettext: test installed git-sh-i18n if GIT_TEST_INSTALLED is setJohannes Schindelin via GitGitGadget, Nov 14, 2018
  26. 4/5 tests: do not require Git to be built when testing an installed GitJohannes Schindelin via GitGitGadget, Nov 14, 2018
  27. 5/5 tests: explicitly use `git.exe` on WindowsJohannes Schindelin via GitGitGadget, Nov 14, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.