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

Re: [RFC/PATCH] tests: add initial bash completion tests

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Apr 6, 2012, 22:05 UTC
Message-ID
<CAMP44s0VWWuM6eeij_nys9OAqu6Jr87Wv4K56mbbqhuMbVXKaQ@mail.gmail.com>
In-Reply-To
<20120406213448.GA5436@sigill.intra.peff.net>
On Sat, Apr 7, 2012 at 12:34 AM, Jeff King <peff@peff.net> wrote:
Show 16 quoted lines
> On Sat, Apr 07, 2012 at 12:21:35AM +0300, Felipe Contreras wrote:
>
>> On Fri, Apr 6, 2012 at 11:19 PM, Jeff King <peff@peff.net> wrote:
>> > On Fri, Apr 06, 2012 at 10:28:39PM +0300, Felipe Contreras wrote:
>>
>> > I think you need to start with something like:
>> >
>> >  #!/bin/sh
>>
>> That is irrelevant, even if it's '#!/bin/foobar', it wouldn't make any
>> difference since the actual command would be something like
>> '$(SHELL_PATH) t9902-completion.sh'.
>
> True; I thought "prove" would run them directly, but even it uses
> $(SHELL_PATH) to run the tests. However, doesn't that mean your test
> will fail completely when $(SHELL_PATH) isn't bash?
Yes.
> So yes, the #! isn't relevant to "make test" (though marking it as
> #!/bin/sh does serve as documentation for what you expect,

No, it's the opposite; #!/bin/sh would imply that you can run this with any POSIX shell; you can't. For example, if /bin/sh points to dash (which is the case in debian AFAIK), the test would fail in the middle of it. #!/bin/bash would be more proper; it would properly document that you need bash to run this. Sure, maybe bash is not in /bin (I have never seen that), but that would not affect 'make tests', only the people that want to run this directly, which I suspect are very, *very* few, and they would immediately see a clear error: './blah: /bin/bash: bad interpreter: No such file or directory', and then they could easily try 'bash ./blah'.

Show 5 quoted lines
> But my point still stands that you cannot assume that you are running
> bash, and you need to either find bash, or gracefully exit the test
> script if it is not available. Anything else will cause "make test" to
> fail on some systems (and indeed, applying and running your test, it
> breaks "make test" on my debian box with dash as /bin/sh).

So? 'make test' fails on my Arch Linux box which doesn't have /usr/bin/python, which is presumably why there is NO_PYTHON. Instead of doing some nasty hacks such as 'bash <<\END_OF_BASH_SCRIPT', it would be much easier to have a NO_BASH option. And in fact, when zsh completion tests are available, NO_ZSH (probably on by default).

But you clearly prefer the status quo, so I'm not going to bother.
-- 
Felipe Contreras
Previous: Jeff KingNext: Junio C Hamano
Message 10 of 18 in “tests: add initial bash completion tests”
  1. tests: add initial bash completion testsFelipe Contreras, Apr 6, 2012
  2. Jeff KingApr 6, 2012
  3. Junio C HamanoApr 6, 2012
  4. Felipe ContrerasApr 6, 2012
  5. Jeff KingApr 6, 2012
  6. Felipe ContrerasApr 6, 2012
  7. Junio C HamanoApr 6, 2012
  8. Felipe ContrerasApr 6, 2012
  9. Jeff KingApr 6, 2012
  10. Felipe ContrerasApr 6, 2012
  11. Junio C HamanoApr 6, 2012
  12. Felipe ContrerasApr 6, 2012
  13. Jeff KingApr 6, 2012
  14. Felipe ContrerasApr 6, 2012
  15. Junio C HamanoApr 6, 2012
  16. Junio C HamanoApr 6, 2012
  17. Felipe ContrerasApr 7, 2012
  18. Jeff KingApr 6, 2012

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.