On Sunday 13 February 2011, Ralf Wildenhues wrote:
> * Stefano Lattarini wrote on Sun, Feb 13, 2011 at 11:49:28AM CET:
> > OK to apply?  I will push in 72 hours if there are no further
> > objections.
> 
> The patch is OK as it is a strict improvement IIUC, but I still have a
> question below.
> 
> Thanks,
> Ralf
> 
> > 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.
> 
> > --- 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
> 
> This is probably pragmatically correct most anywhere, but I don't think
> we require pyexecdir to start with ${exec_prefix}.  The user can
> override it, for example by a cache variable entry in config.site, no?
>
Yes, but than he could do so also for `pythondir' -- which would cause
failures in both `python-vars.test' and `python-virtualenv.test'.  Maybe
the best fix would be to `export CONFIG_SITE=/dev/null' in these tests?
Or should we start caring about those cache variables only once (and if)
they start creating real troubles?

> Tests should generally be lax wrt. sane config.site entries.  When we
> meet insane ones, we may want to decide to disable it for our testsuite,
> but let's cross that bridge when we get to it.
> 
> >     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
> 
> Same here.
> 
> >  END
> 

Also, as an aside, now that $pyvars does not contain anymore `pythondir'
and `pyexecdir', I think we should also squash-in the following diff in
the test.  OK?

-*-*-

diff --git a/tests/python-vars.test b/tests/python-vars.test
index 2242691..ab2fe35 100755
--- a/tests/python-vars.test
+++ b/tests/python-vars.test
@@ -93,7 +93,7 @@ cat vars-got.in
 $ACLOCAL
 $AUTOMAKE --add-missing
 
-for var in $pyvars; do
+for var in pythondir pyexecdir $pyvars; do
   grep "^$var *=" Makefile.in
 done

Reply via email to