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

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

From
Jeff King <peff@peff.net>
Date
Apr 6, 2012, 21:34 UTC
Message-ID
<20120406213448.GA5436@sigill.intra.peff.net>
In-Reply-To
<CAMP44s0n+dyp-QNOPtiKtGX1VNOsM8GJOLLCksqwPArR+FS8ng@mail.gmail.com>
On Sat, Apr 07, 2012 at 12:21:35AM +0300, Felipe Contreras wrote:
Show 10 quoted lines
> 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?

So yes, the #! isn't relevant to "make test" (though marking it as #!/bin/sh does serve as documentation for what you expect, and does let people with a sane /bin/sh more easily run the test directly).

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

>Plus /bin/sh does not always point to bash, even when bash is available
>(see debian).

Yes, that was my point, and why the example code I showed executed bash explicitly instead of relying on $(SHELL_PATH) to be set to it.

-Peff
Previous: Felipe ContrerasNext: Felipe Contreras
Message 9 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.