automake-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] {maint} python: extend and improve tests, fix minor glitches


From: Stefano Lattarini
Subject: Re: [PATCH] {maint} python: extend and improve tests, fix minor glitches
Date: Sun, 13 Feb 2011 11:49:28 +0100
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

On Friday 11 February 2011, Ralf Wildenhues wrote:
> Hi Stefano,
> 
> * Stefano Lattarini wrote on Wed, Feb 02, 2011 at 12:10:15AM CET:
> > Subject: [PATCH] python: extend and improve tests, fix minor glitches
> > 
> [...]
> > * tests/python-vars.test: New test, checking that AM_PATH_PYTHON
> > correctly set all the output variables advertised in the manual.
> 
> This test fails for me, see below.
>
Yes, I can reproduce this with my system-level installation of python3
on Debian (I had previously checked the test only with custom python
installations -- both 2.x and 3.x -- which all worked as expected).

The attached patch should fix this.

> As a minor nit, the test trace contains hyped output again, I think
>   echo "$var=$val"
> and
>   echo "address@hidden@"
> 
> would have resulted in both smaller trace output and also more
> informative diff.
>
Agreed.  The attached patch addresses this too.

OK to apply?  I will push in 72 hours if there are no further
objections.

Thanks,
   Stefano

> Cheers,
> Ralf
> 
> FAIL: python-vars.test (exit: 2)
> ================================
> 
> /tmp/automake/build/tests:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
> python-vars: running python -V
> Python 2.6.5
> + set -e
> + pwd
> /tmp/automake/build/tests/python-vars.dir
> + set -e
> + PYTHON=python
> + python -c import sys; print(sys.version[:3])
> + PYTHON_VERSION=2.6
> + python -c import sys; print(sys.platform)
> + PYTHON_PLATFORM=linux2
> + PYTHON_EXEC_PREFIX=${exec_prefix}
> + PYTHON_PREFIX=${prefix}
> + pythondir=${prefix}/lib/python2.6/site-packages
> + pyexecdir=${exec_prefix}/lib/python2.6/site-packages
> + pkgpythondir=${pythondir}/python-vars
> + pkgpyexecdir=${pyexecdir}/python-vars
> + pyvars=PYTHON_VERSION PYTHON_PLATFORM PYTHON_PREFIX PYTHON_EXEC_PREFIX
>         pythondir pyexecdir pkgpythondir pkgpyexecdir
> + cat
> + cat
> + cat
> + echo
> + echo
> + echo test-am:
> + eval val=$PYTHON_VERSION
> + val=2.6
> + echo ### PYTHON_VERSION ###
> + echo 2.6
> + echo
> + echo ### PYTHON_VERSION ###
> + echo @PYTHON_VERSION@
> + echo
> + echo        test x'$(PYTHON_VERSION)' = x'2.6'
> + eval val=$PYTHON_PLATFORM
> + val=linux2
> + echo ### PYTHON_PLATFORM ###
> + echo linux2
> + echo
> + echo ### PYTHON_PLATFORM ###
> + echo @PYTHON_PLATFORM@
> + echo
> + echo        test x'$(PYTHON_PLATFORM)' = x'linux2'
> + eval val=$PYTHON_PREFIX
> + val=${prefix}
> + echo ### PYTHON_PREFIX ###
> + echo ${prefix}
> + echo
> + echo ### PYTHON_PREFIX ###
> + echo @PYTHON_PREFIX@
> + echo
> + echo        test x'$(PYTHON_PREFIX)' = x'${prefix}'
> + eval val=$PYTHON_EXEC_PREFIX
> + val=${exec_prefix}
> + echo ### PYTHON_EXEC_PREFIX ###
> + echo ${exec_prefix}
> + echo
> + echo ### PYTHON_EXEC_PREFIX ###
> + echo @PYTHON_EXEC_PREFIX@
> + echo
> + echo        test x'$(PYTHON_EXEC_PREFIX)' = x'${exec_prefix}'
> + eval val=$pythondir
> + val=${prefix}/lib/python2.6/site-packages
> + echo ### pythondir ###
> + echo ${prefix}/lib/python2.6/site-packages
> + echo
> + echo ### pythondir ###
> + echo @pythondir@
> + echo
> + echo        test x'$(pythondir)' = x'${prefix}/lib/python2.6/site-packages'
> + eval val=$pyexecdir
> + val=${exec_prefix}/lib/python2.6/site-packages
> + echo ### pyexecdir ###
> + echo ${exec_prefix}/lib/python2.6/site-packages
> + echo
> + echo ### pyexecdir ###
> + echo @pyexecdir@
> + echo
> + echo        test x'$(pyexecdir)' = 
> x'${exec_prefix}/lib/python2.6/site-packages'
> + eval val=$pkgpythondir
> + val=${pythondir}/python-vars
> + echo ### pkgpythondir ###
> + echo ${pythondir}/python-vars
> + echo
> + echo ### pkgpythondir ###
> + echo @pkgpythondir@
> + echo
> + echo        test x'$(pkgpythondir)' = x'${pythondir}/python-vars'
> + eval val=$pkgpyexecdir
> + val=${pyexecdir}/python-vars
> + echo ### pkgpyexecdir ###
> + echo ${pyexecdir}/python-vars
> + echo
> + echo ### pkgpyexecdir ###
> + echo @pkgpyexecdir@
> + echo
> + echo        test x'$(pkgpyexecdir)' = x'${pyexecdir}/python-vars'
> + cat Makefile.am
> 
> python_PYTHON = my.py
> 
> EXTRA_DIST = vars-exp
> 
> check-local: test-in test-am
> .PHONY: test-in test-am
> 
> test-in:
>       cat $(srcdir)/vars-exp
>       cat $(builddir)/vars-got
>       diff $(srcdir)/vars-exp $(builddir)/vars-got
> test-am:
>       test x'$(PYTHON_VERSION)' = x'2.6'
>       test x'$(PYTHON_PLATFORM)' = x'linux2'
>       test x'$(PYTHON_PREFIX)' = x'${prefix}'
>       test x'$(PYTHON_EXEC_PREFIX)' = x'${exec_prefix}'
>       test x'$(pythondir)' = x'${prefix}/lib/python2.6/site-packages'
>       test x'$(pyexecdir)' = x'${exec_prefix}/lib/python2.6/site-packages'
>       test x'$(pkgpythondir)' = x'${pythondir}/python-vars'
>       test x'$(pkgpyexecdir)' = x'${pyexecdir}/python-vars'
> + cat vars-got.in
> 
> ### PYTHON_VERSION ###
> @PYTHON_VERSION@
> 
> ### PYTHON_PLATFORM ###
> @PYTHON_PLATFORM@
> 
> ### PYTHON_PREFIX ###
> @PYTHON_PREFIX@
> 
> ### PYTHON_EXEC_PREFIX ###
> @PYTHON_EXEC_PREFIX@
> 
> ### pythondir ###
> @pythondir@
> 
> ### pyexecdir ###
> @pyexecdir@
> 
> ### pkgpythondir ###
> @pkgpythondir@
> 
> ### pkgpyexecdir ###
> @pkgpyexecdir@
> 
> + aclocal-1.11a -Werror
> + automake-1.11a --foreign -Werror -Wall --add-missing
> Makefile.am:2: installing `./py-compile'
> + grep ^PYTHON_VERSION *= Makefile.in
> PYTHON_VERSION = @PYTHON_VERSION@
> + grep ^PYTHON_PLATFORM *= Makefile.in
> PYTHON_PLATFORM = @PYTHON_PLATFORM@
> + grep ^PYTHON_PREFIX *= Makefile.in
> PYTHON_PREFIX = @PYTHON_PREFIX@
> + grep ^PYTHON_EXEC_PREFIX *= Makefile.in
> PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
> + grep ^pythondir *= Makefile.in
> pythondir = @pythondir@
> + grep ^pyexecdir *= Makefile.in
> pyexecdir = @pyexecdir@
> + grep ^pkgpythondir *= Makefile.in
> pkgpythondir = @pkgpythondir@
> + grep ^pkgpyexecdir *= Makefile.in
> pkgpyexecdir = @pkgpyexecdir@
> + autoconf
> + ./configure PYTHON=python
> checking for a BSD-compatible install... /usr/bin/install -c
> checking whether build environment is sane... yes
> checking for a thread-safe mkdir -p... /bin/mkdir -p
> checking for gawk... gawk
> checking whether make sets $(MAKE)... yes
> checking for python version... 2.6
> checking for python platform... linux2
> checking for python script directory... ${prefix}/lib/python2.6/dist-packages
> checking for python extension module directory... 
> ${exec_prefix}/lib/python2.6/dist-packages
> checking that generated files are newer than configure... done
> configure: creating ./config.status
> config.status: creating Makefile
> config.status: creating vars-got
> + make test-in test-am
> cat ./vars-exp
> 
> ### PYTHON_VERSION ###
> 2.6
> 
> ### PYTHON_PLATFORM ###
> linux2
> 
> ### PYTHON_PREFIX ###
> ${prefix}
> 
> ### PYTHON_EXEC_PREFIX ###
> ${exec_prefix}
> 
> ### pythondir ###
> ${prefix}/lib/python2.6/site-packages
> 
> ### pyexecdir ###
> ${exec_prefix}/lib/python2.6/site-packages
> 
> ### pkgpythondir ###
> ${pythondir}/python-vars
> 
> ### pkgpyexecdir ###
> ${pyexecdir}/python-vars
> 
> cat ./vars-got
> 
> ### PYTHON_VERSION ###
> 2.6
> 
> ### PYTHON_PLATFORM ###
> linux2
> 
> ### PYTHON_PREFIX ###
> ${prefix}
> 
> ### PYTHON_EXEC_PREFIX ###
> ${exec_prefix}
> 
> ### pythondir ###
> ${prefix}/lib/python2.6/dist-packages
> 
> ### pyexecdir ###
> ${exec_prefix}/lib/python2.6/dist-packages
> 
> ### pkgpythondir ###
> ${pythondir}/python-vars
> 
> ### pkgpyexecdir ###
> ${pyexecdir}/python-vars
> 
> diff ./vars-exp ./vars-got
> 15c15
> < ${prefix}/lib/python2.6/site-packages
> ---
> > ${prefix}/lib/python2.6/dist-packages
> 18c18
> < ${exec_prefix}/lib/python2.6/site-packages
> ---
> > ${exec_prefix}/lib/python2.6/dist-packages
> Makefile:536: recipe for target `test-in' failed
> make: *** [test-in] Error 1
> + exit_status=2
> + set +e
> + cd /tmp/automake/build/tests
> + test 0 != 0
> + echo python-vars: exit 2
> python-vars: exit 2
> + exit 2
> 
From 69c2d35de8668548cb6435e839acfa6b189cb5d1 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Sun, 13 Feb 2011 11:40:16 +0100
Subject: [PATCH] python: fix spurious failure in tests

* tests/python-vars.test: Be laxer in matching the expected values
of output variables `pythondir' and `pyexecdir', since they can
change quite unpredictably among different python installations.
Also, avoid "hyping" debugging output, thus offering smaller trace
output and more informative diff.

Report by Ralf Wildenhues.
---
 ChangeLog              |   10 ++++++++++
 tests/python-vars.test |   33 +++++++++++++++++++++++----------
 2 files changed, 33 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0df8d8e..6989c19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-02-13  Stefano Lattarini  <address@hidden>
+
+       python: fix spurious failure in tests
+       * tests/python-vars.test: Be laxer in matching the expected values
+       of output variables `pythondir' and `pyexecdir', since they can
+       change quite unpredictably among different python installations.
+       Also, avoid "hyping" debugging output, thus offering smaller trace
+       output and more informative diff.
+       Report by Ralf Wildenhues.
+
 2011-02-06  Stefano Lattarini  <address@hidden>
 
        python: extend and improve tests, fix minor glitches
diff --git a/tests/python-vars.test b/tests/python-vars.test
index ad263a5..2242691 100755
--- a/tests/python-vars.test
+++ b/tests/python-vars.test
@@ -24,21 +24,23 @@ set -e
 
 PYTHON=python
 
-# Update these if the documentation changes.
+# Update the definition below if the documentation changes.
+# Note that the value of the `pythondir' and `pyexecdir' variables can
+# vary among different python installations, so we need more relaxed
+# and ad-hoc checks for them.  Also, more proper "functional" checks
+# on them should be done in the `python-virtualenv.test' test.
 PYTHON_VERSION=`$PYTHON -c 'import sys; print(sys.version[:3])'` || Exit 1
 PYTHON_PLATFORM=`$PYTHON -c 'import sys; print(sys.platform)'` || Exit 1
 PYTHON_EXEC_PREFIX='${exec_prefix}'
 PYTHON_PREFIX='${prefix}'
-pythondir="\${prefix}/lib/python$PYTHON_VERSION/site-packages"
-pyexecdir="\${exec_prefix}/lib/python$PYTHON_VERSION/site-packages"
 pkgpythondir="\${pythondir}/$me"
 pkgpyexecdir="\${pyexecdir}/$me"
 
 pyvars='PYTHON_VERSION PYTHON_PLATFORM PYTHON_PREFIX PYTHON_EXEC_PREFIX
-        pythondir pyexecdir pkgpythondir pkgpyexecdir'
+        pkgpythondir pkgpyexecdir'
 
 cat >> configure.in << 'END'
-AC_CONFIG_FILES([vars-got])
+AC_CONFIG_FILES([vars-got pythondir pyexecdir])
 AM_PATH_PYTHON
 AC_OUTPUT
 END
@@ -58,19 +60,30 @@ check-local: test-in test-am
 .PHONY: test-in test-am
 
 test-in:
+       cat pythondir
+       case `cat pythondir` in '$${prefix}'/*);; *) exit 1;; esac
+       cat pyexecdir
+       case `cat pyexecdir` in '$${exec_prefix}'/*);; *) exit 1;; esac
        cat $(srcdir)/vars-exp
        cat $(builddir)/vars-got
        diff $(srcdir)/vars-exp $(builddir)/vars-got
+
+## Note: this target's rules will be extended in the "for" loop below.
+test-am:
+       case '$(pythondir)' in '$(prefix)'/*);; *) exit 1;; esac
+       case '$(pyexecdir)' in '$(exec_prefix)'/*);; *) exit 1;; esac
 END
 
-echo > vars-exp
-echo > vars-got.in
-echo test-am: >> Makefile.am
+echo @pythondir@ > pythondir.in
+echo @pyexecdir@ > pyexecdir.in
+
+: > vars-exp
+: > vars-got.in
 
 for var in $pyvars; do
   eval val=\$$var
-  (echo "### $var ###" && echo "$val" && echo) >> vars-exp
-  (echo "### $var ###" && echo "@$var@" && echo) >> vars-got.in
+  echo "var=$val" >> vars-exp
+  echo "address@hidden@" >> vars-got.in
   echo "${tab}test x'\$($var)' = x'$val'" >> Makefile.am
 done
 
-- 
1.7.2.3


reply via email to

[Prev in Thread] Current Thread [Next in Thread]