git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: Jeff King <peff@peff.net>, git@vger.kernel.org
Subject: Re: [RFC/PATCH] tests: add initial bash completion tests
Date: Fri, 06 Apr 2012 15:46:48 -0700	[thread overview]
Message-ID: <7vk41szdev.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <CAMP44s0VWWuM6eeij_nys9OAqu6Jr87Wv4K56mbbqhuMbVXKaQ@mail.gmail.com> (Felipe Contreras's message of "Sat, 7 Apr 2012 01:05:51 +0300")

Felipe Contreras <felipe.contreras@gmail.com> writes:

> On Sat, Apr 7, 2012 at 12:34 AM, Jeff King <peff@peff.net> wrote:
>
>> 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.

If you "git grep NO_PYTHON", you would notice that t/test-lib.sh does have
a provision to set PYTHON prerequisite, so fixing it presumably is just
the matter of marking appropriate tests with the prerequisite, no?  Which
ones are broken for you?  Complaining about it in a thread that does not
directly related to that "on a box without python some tests are broken"
issue is a very good way to leave it unfixed.

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

"The box does not have bash" and "The builder does not wish to let the
scripts run with bash" are two separate things.  SHELL_PATH is often set
to /bin/dash even on a box that has /bin/bash because it is much faster to
run scripted Porcelains with, but the end user of the resulting build may
still want to use bash in her interactive session.

For this "the rest of the script is all meant to test stuff written for
bash" test, I think the right approach is to explicitly detect the
presense of bash (i.e. "Can the end user run bash for her interactive
session?  Otherwise we cannot test and there is no point testing"), and
feed these tests explicitly to bash.  Perhaps by putting your bash
specific test in t/t9902/bash-completion-test.bash and calling it from the
t9902-completionl.sh script that is meant to be run with $SHELL_PATH, like
this:

== t/t9902-completion.sh ==
#!/bin/sh

. ./test-lib.sh

if bash is available ;# do *not* check if we are running under bash!!
then
	bash "$TEST_DIRECTORY/t9902/bash-comletion-test.bash"
fi

if zsh is available ;# do *not* check if we are running under zsh!!
then
	zsh "$TEST_DIRECTORY/t9902/zsh-comletion-test.zsh"
fi

test_done

  reply	other threads:[~2012-04-06 22:46 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-06 19:28 [RFC/PATCH] tests: add initial bash completion tests Felipe Contreras
2012-04-06 20:19 ` Jeff King
2012-04-06 20:24   ` Junio C Hamano
2012-04-06 21:28     ` Felipe Contreras
2012-04-06 21:42       ` Jeff King
2012-04-06 22:22         ` Felipe Contreras
2012-04-06 21:42       ` Junio C Hamano
2012-04-06 21:21   ` Felipe Contreras
2012-04-06 21:34     ` Jeff King
2012-04-06 22:05       ` Felipe Contreras
2012-04-06 22:46         ` Junio C Hamano [this message]
2012-04-06 23:30           ` Felipe Contreras
2012-04-06 23:45         ` Jeff King
2012-04-06 23:12   ` Felipe Contreras
2012-04-06 23:22     ` Junio C Hamano
2012-04-06 23:33       ` Junio C Hamano
2012-04-07  0:02         ` Felipe Contreras
2012-04-06 23:52     ` Jeff King

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

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

  git send-email \
    --in-reply-to=7vk41szdev.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /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.
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 NNTP newsgroup(s).