Re: [PATCH v2 1/2] tests: move code to run completion tests under bash into a helper library

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


On Mon, Apr 16, 2012 at 06:49:24PM -0500, Jonathan Nieder wrote:
> SZEDER Gábor wrote:
> 
> > --- a/t/t9902-completion.sh
> > +++ b/t/t9902-completion.sh
> > @@ -3,21 +3,9 @@
> >  # Copyright (c) 2012 Felipe Contreras
> >  #
> >  
> > -if test -n "$BASH" && test -z "$POSIXLY_CORRECT"; then
> > -	# we are in full-on bash mode
> > -	true
> > -elif type bash >/dev/null 2>&1; then
> > -	# execute in full-on bash mode
> > -	unset POSIXLY_CORRECT
> > -	exec bash "$0" "$@"
> > -else
> > -	echo '1..0 #SKIP skipping bash completion tests; bash not available'
> > -	exit 0
> > -fi
> > -
> >  test_description='test bash completion'
> >  
> > -. ./test-lib.sh
> > +. ./lib-completion.sh
> 
> If I understand correctly, this sources lib-completion immediately
> instead of following the usual pattern of
> 
> 	. ./test-lib.sh
> 	. "$TEST_DIRECTORY/lib-completion.sh"

There are a couple of other test libs that source test-lib.sh
themselves, similarly to the new t/lib-completion.sh.

> to get the self-execing over with ASAP.

Exactly, like the original t/t9902-completion.sh.

> "$0" always refers to the
> original shell script and not the file being sourced so this should be
> safe.  Looks good.

Yeah, I tested the tests ;) with dash as /bin/sh; works for me.

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


[Newbies FAQ]     [Linux Kernel Development]     [Free Online Dating]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Free Online Dating]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]     [Linux Resources]

Add to Google