* 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.lattar...@gmail.com> --- t/list-of-tests.mk | 10 ++-- t/{python9.sh => python-am-path-iftrue.sh} | 29 ++++++++--- t/python-missing.sh | 80 ++++++++++++++++++++++++++++++ t/{python5b.sh => python-too-old.sh} | 45 ++++++++++------- t/python4.sh | 43 ---------------- t/python5.sh | 45 ----------------- t/python6.sh | 38 -------------- t/python7.sh | 38 -------------- t/python8.sh | 37 -------------- 9 files changed, 131 insertions(+), 234 deletions(-) rename t/{python9.sh => python-am-path-iftrue.sh} (70%) mode change 100755 => 100644 create mode 100644 t/python-missing.sh rename t/{python5b.sh => python-too-old.sh} (67%) delete mode 100755 t/python4.sh delete mode 100755 t/python5.sh delete mode 100755 t/python6.sh delete mode 100755 t/python7.sh delete mode 100755 t/python8.sh diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk index c54954e..f72a6fa 100644 --- a/t/list-of-tests.mk +++ b/t/list-of-tests.mk @@ -887,16 +887,12 @@ t/py-compile-usage.sh \ t/python.sh \ t/python2.sh \ t/python3.sh \ -t/python4.sh \ -t/python5.sh \ -t/python5b.sh \ -t/python6.sh \ -t/python7.sh \ -t/python8.sh \ -t/python9.sh \ t/python10.sh \ t/python11.sh \ t/python12.sh \ +t/python-am-path-iftrue.sh \ +t/python-missing.sh \ +t/python-too-old.sh \ t/python-dist.sh \ t/python-vars.sh \ t/python-virtualenv.sh \ diff --git a/t/python9.sh b/t/python-am-path-iftrue.sh old mode 100755 new mode 100644 similarity index 70% rename from t/python9.sh rename to t/python-am-path-iftrue.sh index cba1d24..3c5201f --- a/t/python9.sh +++ b/t/python-am-path-iftrue.sh @@ -15,23 +15,38 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # Test ACTION-IF-TRUE in AM_PATH_PYTHON. -# Similar to 'python8.sh', but requiring a version. +am_create_testdir=empty required=python . ./defs || exit 1 -cat >>configure.ac <<'EOF' -# $PYTHON is supposed to be properly set in ACTION-IF-TRUE. -AM_PATH_PYTHON([0.0], [$PYTHON -c 'print("%u:%u" % (1-1, 2**0))' > py.out]) +cat > configure.ac <<END +AC_INIT([$me], [1.0]) +m4_include([mypy.m4]) AC_OUTPUT -EOF +END -: > Makefile.am +# $PYTHON is supposed to be properly set in ACTION-IF-TRUE. +cat > mypy.m4 << 'END' +AM_PATH_PYTHON(, [$PYTHON -V >py-version 2>&1]) +END $ACLOCAL $AUTOCONF -$AUTOMAKE --add-missing +./configure +grep '^Python [0-9]\.[0-9][0-9]*\.[0-9]' py-version + +# The same, but requiring a version. + +rm -rf autom4te*.cache +# $PYTHON is supposed to be properly set in ACTION-IF-TRUE. +cat > mypy.m4 << 'END' +AM_PATH_PYTHON([0.0], [$PYTHON -c 'print("%u:%u" % (1-1, 2**0))' > py.out]) +END + +$ACLOCAL +$AUTOCONF ./configure test x"$(cat py.out)" = x0:1 diff --git a/t/python-missing.sh b/t/python-missing.sh new file mode 100644 index 0000000..c88a4f9 --- /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: + +: diff --git a/t/python5b.sh b/t/python-too-old.sh similarity index 67% rename from t/python5b.sh rename to t/python-too-old.sh index 1cc7ee5..e4185fc 100755 --- a/t/python5b.sh +++ b/t/python-too-old.sh @@ -14,18 +14,39 @@ # 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. -# Same as 'python5.sh', but with the user forcing the python to use. +# Test detection of too old Python, also forcing the python to use. +# See also related test 't/python-am-path-missing.sh'. +am_create_testdir=empty required=python . ./defs || exit 1 -cat >>configure.ac << 'END' +py_too_old () +{ + ./configure ${1+"PYTHON=$1"} >stdout 2>stderr && { + cat stdout + cat stderr >&2 + exit 1 + } + cat stdout + cat stderr >&2 + grep "whether $1 version is >= 9999\\.9\\.\\.\\. no *$" stdout + grep '[Pp]ython interpreter is too old' stderr +} + +PYTHON=; unset PYTHON + +cat > configure.ac <<END +AC_INIT([$me], [1.0]) # Hopefully the Python team will never release such a version. AM_PATH_PYTHON([9999.9]) -AC_OUTPUT END +$ACLOCAL +$AUTOCONF + +py_too_old python + mkdir bin cat > bin/my-python << 'END' #! /bin/sh @@ -34,20 +55,6 @@ END chmod a+x bin/my-python PATH=$(pwd)/bin$PATH_SEPARATOR$PATH -: > Makefile.am - -$ACLOCAL -$AUTOCONF -$AUTOMAKE --add-missing - -./configure PYTHON=my-python >stdout 2>stderr && { - cat stdout - cat stderr >&2 - exit 1 -} -cat stdout -cat stderr >&2 -grep 'whether my-python version is >= 9999\.9\.\.\. no *$' stdout -grep '[Pp]ython interpreter is too old' stderr +py_too_old my-python : diff --git a/t/python4.sh b/t/python4.sh deleted file mode 100755 index d084861..0000000 --- a/t/python4.sh +++ /dev/null @@ -1,43 +0,0 @@ -#! /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. - -# Python is not required for this test. -. ./defs || exit 1 - -cat >>configure.ac <<EOF -AM_PATH_PYTHON -AC_OUTPUT -EOF - -: > Makefile.am - -$ACLOCAL -$AUTOCONF -$AUTOMAKE --add-missing - -# 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 - -: diff --git a/t/python5.sh b/t/python5.sh deleted file mode 100755 index 95b9842..0000000 --- a/t/python5.sh +++ /dev/null @@ -1,45 +0,0 @@ -#! /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. -# Same as python4.sh, but requiring a version. - -# Python is not required for this test. -. ./defs || exit 1 - -cat >>configure.ac <<EOF -# Hopefully the Python team will never release such a version. -AM_PATH_PYTHON([9999.9]) -AC_OUTPUT -EOF - -: > Makefile.am - -$ACLOCAL -$AUTOCONF -$AUTOMAKE --add-missing - -./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 - -: diff --git a/t/python6.sh b/t/python6.sh deleted file mode 100755 index dddbae0..0000000 --- a/t/python6.sh +++ /dev/null @@ -1,38 +0,0 @@ -#! /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. -# Same as 'python4.sh', but using a custom ACTION-IF-NOT-FOUND. - -# Python is not required for this test. -. ./defs || exit 1 - -cat >>configure.ac <<\EOF -AM_PATH_PYTHON(,, [echo "$PYTHON" > py]) -AC_OUTPUT -EOF - -: > Makefile.am - -$ACLOCAL -$AUTOCONF -$AUTOMAKE --add-missing - -# Simulate no Python. -./configure PYTHON=: -test x"$(cat py)" = x: - -: diff --git a/t/python7.sh b/t/python7.sh deleted file mode 100755 index f172b16..0000000 --- a/t/python7.sh +++ /dev/null @@ -1,38 +0,0 @@ -#! /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. -# Same as 'python6.sh', but requiring a version. - -# Python is not required for this test. -. ./defs || exit 1 - -cat >>configure.ac <<\EOF -# Hopefully the Python team will never release such a version. -AM_PATH_PYTHON([9999.9], [], [echo "$PYTHON" > py]) -AC_OUTPUT -EOF - -: > Makefile.am - -$ACLOCAL -$AUTOCONF -$AUTOMAKE --add-missing - -./configure -test x"$(cat py)" = x: - -: diff --git a/t/python8.sh b/t/python8.sh deleted file mode 100755 index dd1174a..0000000 --- a/t/python8.sh +++ /dev/null @@ -1,37 +0,0 @@ -#! /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 ACTION-IF-TRUE in AM_PATH_PYTHON. - -required=python -. ./defs || exit 1 - -cat >>configure.ac <<'EOF' -# $PYTHON is supposed to be properly set in ACTION-IF-TRUE. -AM_PATH_PYTHON(, [$PYTHON -V >py-version 2>&1]) -AC_OUTPUT -EOF - -: > Makefile.am - -$ACLOCAL -$AUTOCONF -$AUTOMAKE --add-missing - -./configure -grep '^Python [0-9]\.[0-9][0-9]*\.[0-9]' py-version - -: -- 1.7.12.rc0.129.g61b472e