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

Re: [PATCH] tests: turn on network daemon tests by default

From
Jeff King <peff@peff.net>
Date
Feb 12, 2014, 21:47 UTC
Message-ID
<20140212214753.GA6799@sigill.intra.peff.net>
In-Reply-To
<xmqqzjlxnqvw.fsf@gitster.dls.corp.google.com>
On Tue, Feb 11, 2014 at 03:58:27PM -0800, Junio C Hamano wrote:
Show 14 quoted lines
> Sure. One immediate complaint is that I would probably need to do
> something like this in the build automation:
> 
> 	if testing a branch without this patch
>         then
> 		: do nothing
> 	else
> 		GIT_TEST_GIT_DAEMON=false
> 	fi
> 
> Arguably, it is the fault of the current/original code that treated
> *any* non-empty value that is set in the environment variable as
> "true"---if it paid attention to GIT_TEST_GIT_DAEMON=NoThanks, we
> wouldn't have to have a workaround like this.

Yes, I didn't really think about build config that works reliably between both versions (though personally, I think you should be building with GIT_TEST_GIT_DAEMON=true :) ).

Show 17 quoted lines
> I wonder if GIT_TEST_X=$(test_tristate "$GIT_TEST_X") pattern can be
> made a bit more friendly, though.  For example, can we behave
> differently depending on the reason why $GIT_TEST_X is empty?
> 
>  - People who have *not* been opting in to the expensive tests have
>    not done anything special; GIT_TEST_X environment variable did
>    not exist for them (i.e. unset), and we used to skip when
>    "$GIT_TEST_X" is an empty string.
> 
>  - We want to encourage people who do not care to run these tests.
>    If people do not do anything, their $GIT_TEST_X will continue to
>    be an empty string without GIT_TEST_X variable in the
>    environment.
> 
> If we let people who *do* want to opt out of the expensive tests by
> explicitly setting $GIT_TEST_X to an empty string in the new scheme,
> wouldn't the transition go a lot smoother?

Hmm. So you are suggesting that the old code treated "undefined" and "empty" the same (as "false"). But that in the new code, we would treat them _differently_, taking undefined to mean "auto" and empty to mean "false". I suppose that works, but it is rather unfortunate that the end state we are left with (for all time) makes such a confusing and subtle distinction.

I think this should work OK with the existing Makefile conventions. That is, we do not ever set GIT_TEST_HTTPD in the Makefile ourselves, but rely on it being either unset or set to whatever the user likes (this is opposed to something like CFLAGS, where the distinction is long gone).

So I'm not excited about it, but I do not think there is any other loophole through which we can maintain compatibility. If that's important, I think we have to do it.

> The caller may have to pass the name of the variable:
> 
> 	GIT_TEST_DAEMON=$(test_tristate GIT_TEST_DAEMON)

I don't think that's a big deal. I actually was tempted to just make this:

  test_normalize_tristate GIT_TEST_DAEMON

in the first place, since you would always want to look at the normalized value from there on out.

Show 5 quoted lines
> and then the callee may become
> 
> 	test_tristate () {
> 		variable=$1
>                 if eval "test x\"\${$variable+isset}\" = xisset"

Hmm, today I learned about "{foo:+bar}" versus "${foo+bar}". I'm not sure how that bit of shell trivia escaped me for so many years.

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 16 of 44 in “Fix the shallow deepen bug with no-done”
  1. 0/6 Fix the shallow deepen bug with no-doneNguyễn Thái Ngọc Duy, Feb 6, 2014
  2. 1/6 test: rename http fetch and push test filesNguyễn Thái Ngọc Duy, Feb 6, 2014
  3. Jeff KingFeb 6, 2014
  4. 2/6 t5538: fix default http portNguyễn Thái Ngọc Duy, Feb 6, 2014
  5. Jeff KingFeb 6, 2014
  6. Jeff KingFeb 7, 2014
  7. Duy NguyenFeb 8, 2014
  8. Jeff KingFeb 10, 2014
  9. Junio C HamanoFeb 10, 2014
  10. Jeff KingFeb 10, 2014
  11. Jeff KingFeb 10, 2014
  12. tests: turn on network daemon tests by defaultJeff King, Feb 10, 2014
  13. Junio C HamanoFeb 11, 2014
  14. Jeff KingFeb 11, 2014
  15. Junio C HamanoFeb 11, 2014
  16. Jeff KingFeb 12, 2014
  17. Junio C HamanoFeb 12, 2014
  18. Junio C HamanoFeb 13, 2014
  19. Jeff KingFeb 14, 2014
  20. Junio C HamanoFeb 14, 2014
  21. Junio C HamanoFeb 12, 2014
  22. Jeff KingFeb 12, 2014
  23. Duy NguyenFeb 13, 2014
  24. t5537: move http tests out to t5539Nguyễn Thái Ngọc Duy, Feb 13, 2014
  25. Junio C HamanoFeb 13, 2014
  26. 3/6 pack-protocol.txt: clarify 'obj-id' in the last ACK after 'done'Nguyễn Thái Ngọc Duy, Feb 6, 2014
  27. Junio C HamanoFeb 6, 2014
  28. 4/6 protocol-capabilities.txt: refer multi_ack_detailed back to pack-protocol.txtNguyễn Thái Ngọc Duy, Feb 6, 2014
  29. 5/6 protocol-capabilities.txt: document no-doneNguyễn Thái Ngọc Duy, Feb 6, 2014
  30. Junio C HamanoFeb 6, 2014
  31. Jeff KingFeb 6, 2014
  32. 6/6 fetch-pack: fix deepen shallow over smart http with no-done capNguyễn Thái Ngọc Duy, Feb 6, 2014
  33. Junio C HamanoFeb 6, 2014
  34. Duy NguyenFeb 7, 2014
  35. Eric SunshineFeb 6, 2014
  36. Jeff KingFeb 6, 2014
  37. Junio C HamanoFeb 7, 2014
  38. Duy NguyenFeb 7, 2014
  39. Junio C HamanoFeb 10, 2014
  40. Junio C HamanoFeb 6, 2014
  41. Jeff KingFeb 6, 2014
  42. Duy NguyenFeb 7, 2014
  43. Jonathan NiederFeb 7, 2014
  44. Junio C HamanoFeb 7, 2014

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.