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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Felipe Contreras <felipe.contreras@xxxxxxxxx> writes:

> On Sat, Apr 7, 2012 at 12:34 AM, Jeff King <peff@xxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]