diff options
author | Stefano Lattarini <stefano.lattarini@gmail.com> | 2012-08-13 13:16:49 +0200 |
---|---|---|
committer | Stefano Lattarini <stefano.lattarini@gmail.com> | 2012-08-13 13:16:49 +0200 |
commit | daeca29aa2500bcbba1fd7bfe285a6e6d0500ef3 (patch) | |
tree | f50fc25ba9b64ab2abf975c042c223ddb77a8243 /t/python-missing.sh | |
parent | cbc0fc858b4acbc7116fa52c955e2d73f65ffabd (diff) | |
download | automake-daeca29aa2500bcbba1fd7bfe285a6e6d0500ef3.tar.gz |
tests: rework tests on AM_PATH_PYTHON
* t/python8.sh, t/python9.sh: Merge into ...
* t/python-am-path-iftrue.sh: ... this new test, with minor adjustments.
* t/python4.sh, t/python5.sh, t/python6.sh, t/python7.sh: Merge into ...
* t/python-missing.sh: ... this new test.
* t/python5b.sh: Rename ...
* t/python-too-old.sh: ... like this, and adjust/extend.
* t/list-of-tests.mk: Adjust.
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Diffstat (limited to 't/python-missing.sh')
-rw-r--r-- | t/python-missing.sh | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/t/python-missing.sh b/t/python-missing.sh new file mode 100644 index 000000000..c88a4f972 --- /dev/null +++ b/t/python-missing.sh @@ -0,0 +1,80 @@ +#! /bin/sh +# Copyright (C) 2003-2012 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# Test detection of missing Python. +# See also related test t/python-am-path-missing-2.sh (which requires +# an actual python program). + +am_create_testdir=empty +# An actual python is *not* required in this test. +. ./defs || exit 1 + +PYTHON=; unset PYTHON + +cat > configure.ac <<END +AC_INIT([$me], [1.0]) +m4_include([mypy.m4]) +AC_OUTPUT +END + +echo AM_PATH_PYTHON > mypy.m4 + +$ACLOCAL +$AUTOCONF + +# Simulate no Python. +./configure PYTHON=: 2>stderr && { cat stderr >&2; exit 1; } +cat stderr >&2 +grep 'no suitable Python interpreter found' stderr + +# Again, but from the environment this time. +env PYTHON=: ./configure 2>stderr && { cat stderr >&2; exit 1; } +cat stderr >&2 +grep 'no suitable Python interpreter found' stderr + +# Now try using a custom ACTION-IF-NOT-FOUND. + +echo 'AM_PATH_PYTHON(,, [echo "$PYTHON" > py])' > mypy.m4 +$AUTOCONF --force +./configure PYTHON=: +test x"$(cat py)" = x: + +# Now try requiring a version. + +rm -rf autom4te*.cache # Will have to re-run aclocal. + +# Hopefully the Python team will never release such a version :-) +echo 'AM_PATH_PYTHON([9999.9], [])' > mypy.m4 +$ACLOCAL +$AUTOCONF +./configure >stdout 2>stderr && { + cat stdout + cat stderr >&2 + exit 1 +} +cat stdout +cat stderr >&2 +$EGREP 'checking for a Python interpreter with version >= 9999\.9\.\.\. no(ne)? *$' stdout +grep 'no suitable Python interpreter found' stderr + +# Now try requiring a version and using a custom ACTION-IF-NOT-FOUND. + +echo 'AM_PATH_PYTHON([9999.9], [], [echo "$PYTHON" > py])' > mypy.m4 +$AUTOCONF --force +./configure +test x"$(cat py)" = x: + +: |