Re: [PATCH] NO_PERL support
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- Apr 3, 2009, 17:54 UTC
- Message-ID
- <200904031954.57584.j6t@kdbg.org>
- In-Reply-To
- <20090403132029.GC21153@coredump.intra.peff.net>
On Freitag, 3. April 2009, Jeff King wrote:
Show 16 quoted lines
> On Fri, Apr 03, 2009 at 12:03:50AM -0700, Robin H. Johnson wrote: > > +if test -n "$NO_PERL" > > +then > > + test_expect_success 'skipping git-svn tests, NO_PERL defined' : > > + test_done > > + exit > > +fi > > This probably got copied from an older example, but I think the > recommended way to skip tests these days is to use 'say' instead of > test_expect_success (since we have statistics on passing/failing tests > now). > > Also, it may make sense to integrate this with Johannes Sixt's > test_have_prereq work (which is still in next), but I haven't looked too > closely at that.
If you base the patch on 'master', you can add this line to test-lib.sh
test -z "$NO_PERL" && test_set_prereq PERL
[But actually, if I read you patch correctly, NO_PERL will be set in t/Makefile only if one runs 'make test' from the main directory. You should invent some method to detect missing perl (or that NO_PERL was set) if 'make' is run directly from t/.]
Now you write the above as
if ! test_have_prereq PERL then say 'perl not available - skipping git-svn tests' test_done exit fi
Furthermore, you can skip single tests like this:
> > -test_expect_success \ > > +[ -z "$NO_PERL" ] && test_expect_success \
test_expect_success PERL \
-- Hannes