From: Stefano Lattarini Date: Sun, 13 Feb 2011 10:40:16 +0000 (+0100) Subject: python: fix spurious failure in tests X-Git-Tag: ng-0.5a~235^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=50427eb4a86f3b9e05ef512f208c8a42a34a0084;p=thirdparty%2Fautomake.git python: fix spurious failure in tests * tests/python-vars.test: Ignore cached values from config.site by exporting CONFIG_SITE=/dev/null. 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. * tests/python-virtualenv.test: Require python, since we call it even after the virtualenv has been deactivated. Ignore cached values from config.site by exporting CONFIG_SITE=/dev/null. Report and suggestions by Ralf Wildenhues. --- diff --git a/ChangeLog b/ChangeLog index 0df8d8e08..e2e59551a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2011-02-14 Stefano Lattarini + + python: fix spurious failure in tests + * tests/python-vars.test: Ignore cached values from config.site + by exporting CONFIG_SITE=/dev/null. 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 and suggestions by Ralf Wildenhues. + * tests/python-virtualenv.test: Require python, since we call it + even after the virtualenv has been deactivated. Ignore cached + values from config.site by exporting CONFIG_SITE=/dev/null. + 2011-02-06 Stefano Lattarini python: extend and improve tests, fix minor glitches diff --git a/tests/python-vars.test b/tests/python-vars.test index ad263a572..7defee20c 100755 --- a/tests/python-vars.test +++ b/tests/python-vars.test @@ -22,23 +22,28 @@ required=python set -e +# In case the user's config.site defines pythondir or pyexecdir. +CONFIG_SITE=/dev/null; export CONFIG_SITE + 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 +63,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 "var=@$var@" >> vars-got.in echo "${tab}test x'\$($var)' = x'$val'" >> Makefile.am done @@ -80,7 +96,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 diff --git a/tests/python-virtualenv.test b/tests/python-virtualenv.test index 478a8dc3e..4bbfbfc4c 100755 --- a/tests/python-virtualenv.test +++ b/tests/python-virtualenv.test @@ -17,11 +17,14 @@ # Check that python support can work well with virtualenvs. # This test also works as a mild stress-test on the python support. -required=virtualenv +required='python virtualenv' . ./defs || Exit 1 set -e +# In case the user's config.site defines pythondir or pyexecdir. +CONFIG_SITE=/dev/null; export CONFIG_SITE + # Skip the test if a proper virtualenv cannot be created. virtualenv --verbose virtenv || Exit 77 test -f virtenv/bin/activate || Exit 77