tests: skip perl tests if NO_PERL is defined

These scripts all test git programs that are written in
perl, and thus obviously won't work if NO_PERL is defined.
We pass NO_PERL to the scripts from the building Makefile
via the GIT-BUILD-OPTIONS file.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King 2009-04-03 15:33:59 -04:00 committed by Junio C Hamano
parent 499c29394c
commit 1b19ccd236
12 changed files with 48 additions and 2 deletions

View File

@ -1422,6 +1422,7 @@ GIT-BUILD-OPTIONS: .FORCE-GIT-BUILD-OPTIONS
@echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@ @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@
@echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@ @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@
@echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@ @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@
@echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@
### Detect Tck/Tk interpreter path changes ### Detect Tck/Tk interpreter path changes
ifndef NO_TCLTK ifndef NO_TCLTK

View File

@ -8,6 +8,10 @@ then
say 'skipping git svn tests, NO_SVN_TESTS defined' say 'skipping git svn tests, NO_SVN_TESTS defined'
test_done test_done
fi fi
if ! test_have_prereq PERL; then
say 'skipping git svn tests, perl not available'
test_done
fi
GIT_DIR=$PWD/.git GIT_DIR=$PWD/.git
GIT_SVN_DIR=$GIT_DIR/svn/git-svn GIT_SVN_DIR=$GIT_DIR/svn/git-svn

View File

@ -3,6 +3,11 @@
test_description='add -i basic tests' test_description='add -i basic tests'
. ./test-lib.sh . ./test-lib.sh
if ! test_have_prereq PERL; then
say 'skipping git add -i tests, perl not available'
test_done
fi
test_expect_success 'setup (initial)' ' test_expect_success 'setup (initial)' '
echo content >file && echo content >file &&
git add file && git add file &&

View File

@ -38,7 +38,7 @@ test_expect_success \
"echo King of the bongo >file && "echo King of the bongo >file &&
test_must_fail git commit -m foo -a file" test_must_fail git commit -m foo -a file"
test_expect_success \ test_expect_success PERL \
"using paths with --interactive" \ "using paths with --interactive" \
"echo bong-o-bong >file && "echo bong-o-bong >file &&
! (echo 7 | git commit -m foo --interactive file)" ! (echo 7 | git commit -m foo --interactive file)"
@ -119,7 +119,7 @@ test_expect_success \
"echo 'gak' >file && \ "echo 'gak' >file && \
git commit -m 'author' --author 'Rubber Duck <rduck@convoy.org>' -a" git commit -m 'author' --author 'Rubber Duck <rduck@convoy.org>' -a"
test_expect_success \ test_expect_success PERL \
"interactive add" \ "interactive add" \
"echo 7 | git commit --interactive | grep 'What now'" "echo 7 | git commit --interactive | grep 'What now'"

View File

@ -3,6 +3,11 @@
test_description='git send-email' test_description='git send-email'
. ./test-lib.sh . ./test-lib.sh
if ! test_have_prereq PERL; then
say 'skipping git send-email tests, perl not available'
test_done
fi
PROG='git send-email' PROG='git send-email'
test_expect_success \ test_expect_success \
'prepare reference tree' \ 'prepare reference tree' \

View File

@ -6,6 +6,11 @@ test_description='Test export of commits to CVS'
. ./test-lib.sh . ./test-lib.sh
if ! test_have_prereq PERL; then
say 'skipping git cvsexportcommit tests, perl not available'
test_done
fi
cvs >/dev/null 2>&1 cvs >/dev/null 2>&1
if test $? -ne 1 if test $? -ne 1
then then

View File

@ -10,6 +10,10 @@ cvs CLI client via git-cvsserver server'
. ./test-lib.sh . ./test-lib.sh
if ! test_have_prereq PERL; then
say 'skipping git cvsserver tests, perl not available'
test_done
fi
cvs >/dev/null 2>&1 cvs >/dev/null 2>&1
if test $? -ne 1 if test $? -ne 1
then then

View File

@ -52,6 +52,11 @@ then
say 'skipping git-cvsserver tests, cvs not found' say 'skipping git-cvsserver tests, cvs not found'
test_done test_done
fi fi
if ! test_have_prereq PERL
then
say 'skipping git-cvsserver tests, perl not available'
test_done
fi
perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || { perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
say 'skipping git-cvsserver tests, Perl SQLite interface unavailable' say 'skipping git-cvsserver tests, Perl SQLite interface unavailable'
test_done test_done

View File

@ -65,6 +65,11 @@ gitweb_run () {
. ./test-lib.sh . ./test-lib.sh
if ! test_have_prereq PERL; then
say 'skipping gitweb tests, perl not available'
test_done
fi
perl -MEncode -e 'decode_utf8("", Encode::FB_CROAK)' >/dev/null 2>&1 || { perl -MEncode -e 'decode_utf8("", Encode::FB_CROAK)' >/dev/null 2>&1 || {
say 'skipping gitweb tests, perl version is too old' say 'skipping gitweb tests, perl version is too old'
test_done test_done

View File

@ -3,6 +3,11 @@
test_description='git cvsimport basic tests' test_description='git cvsimport basic tests'
. ./test-lib.sh . ./test-lib.sh
if ! test_have_prereq PERL; then
say 'skipping git cvsimport tests, perl not available'
test_done
fi
CVSROOT=$(pwd)/cvsroot CVSROOT=$(pwd)/cvsroot
export CVSROOT export CVSROOT
unset CVS_SERVER unset CVS_SERVER

View File

@ -6,6 +6,11 @@
test_description='perl interface (Git.pm)' test_description='perl interface (Git.pm)'
. ./test-lib.sh . ./test-lib.sh
if ! test_have_prereq PERL; then
say 'skipping perl interface tests, perl not available'
test_done
fi
perl -MTest::More -e 0 2>/dev/null || { perl -MTest::More -e 0 2>/dev/null || {
say "Perl Test::More unavailable, skipping test" say "Perl Test::More unavailable, skipping test"
test_done test_done

View File

@ -698,6 +698,8 @@ case $(uname -s) in
;; ;;
esac esac
test -z "$NO_PERL" && test_set_prereq PERL
# test whether the filesystem supports symbolic links # test whether the filesystem supports symbolic links
ln -s x y 2>/dev/null && test -h y 2>/dev/null && test_set_prereq SYMLINKS ln -s x y 2>/dev/null && test -h y 2>/dev/null && test_set_prereq SYMLINKS
rm -f y rm -f y