[python] 2.7-8: add a %check

dmalcolm dmalcolm at fedoraproject.org
Wed Aug 18 17:36:18 UTC 2010


commit 5810c5d8b1c876ccc4c547cc71cf20520dd27d85
Author: David Malcolm <dmalcolm at redhat.com>
Date:   Wed Aug 18 13:35:32 2010 -0400

    2.7-8: add a %check
    
    * Wed Aug 18 2010 David Malcolm <dmalcolm at redhat.com> - 2.7-8
    - add %%check section
    - update lib64 patch (patch 102) to fix expected output in test_site.py on
    64-bit systems
    - patch test_commands.py to work with SELinux (patch 124)
    - patch the debug build's usage of COUNT_ALLOCS to be less verbose (patch 125)

 ...est_commands-expected-ls-output-issue7108.patch |   12 +
 less-verbose-COUNT_ALLOCS.patch                    |   20 ++
 python-2.7rc1-lib64.patch                          |   70 +++++--
 python.spec                                        |  228 +++++++++++++++++++-
 4 files changed, 307 insertions(+), 23 deletions(-)
---
diff --git a/fix-test_commands-expected-ls-output-issue7108.patch b/fix-test_commands-expected-ls-output-issue7108.patch
new file mode 100644
index 0000000..e270ec5
--- /dev/null
+++ b/fix-test_commands-expected-ls-output-issue7108.patch
@@ -0,0 +1,12 @@
+diff -up Python-2.7/Lib/test/test_commands.py.gnu-ls-output Python-2.7/Lib/test/test_commands.py
+--- Python-2.7/Lib/test/test_commands.py.gnu-ls-output	2010-08-17 11:31:35.714913918 -0400
++++ Python-2.7/Lib/test/test_commands.py	2010-08-17 11:37:08.913911808 -0400
+@@ -50,7 +50,7 @@ class CommandTests(unittest.TestCase):
+         # Note that the first case above has a space in the group name
+         # while the second one has a space in both names.
+         pat = r'''d.........   # It is a directory.
+-                  \+?          # It may have ACLs.
++                  [.+@]?       # It may have alt access (SELinux, ACLs or metadata ('@' OS X).
+                   \s+\d+       # It has some number of links.
+                   [^/]*        # Skip user, group, size, and date.
+                   /\.          # and end with the name of the file.
diff --git a/less-verbose-COUNT_ALLOCS.patch b/less-verbose-COUNT_ALLOCS.patch
new file mode 100644
index 0000000..8cef015
--- /dev/null
+++ b/less-verbose-COUNT_ALLOCS.patch
@@ -0,0 +1,20 @@
+diff -up Python-2.7/Python/pythonrun.c.less-verbose-COUNT_ALLOCS Python-2.7/Python/pythonrun.c
+--- Python-2.7/Python/pythonrun.c.less-verbose-COUNT_ALLOCS	2010-08-17 14:49:33.321913909 -0400
++++ Python-2.7/Python/pythonrun.c	2010-08-17 14:54:48.750910403 -0400
+@@ -470,7 +470,15 @@ Py_Finalize(void)
+ 
+     /* Debugging stuff */
+ #ifdef COUNT_ALLOCS
+-    dump_counts(stdout);
++    /* This is a downstream Fedora modification.
++       The upstream default with COUNT_ALLOCS is to always dump the counts to
++       stdout on exit.  For our debug builds its useful to have the info from
++       COUNT_ALLOCS available, but the stdout info here gets in the way, so
++       we make it optional, wrapping it in an environment variable (modelled
++       on the other PYTHONDUMP* env variables):
++    */
++    if (Py_GETENV("PYTHONDUMPCOUNTS"))
++        dump_counts(stdout);
+ #endif
+ 
+     PRINT_TOTAL_REFS();
diff --git a/python-2.7rc1-lib64.patch b/python-2.7rc1-lib64.patch
index 9462e82..78e7b93 100644
--- a/python-2.7rc1-lib64.patch
+++ b/python-2.7rc1-lib64.patch
@@ -1,6 +1,6 @@
-diff -up Python-2.7rc1/Lib/distutils/command/install.py.lib64 Python-2.7rc1/Lib/distutils/command/install.py
---- Python-2.7rc1/Lib/distutils/command/install.py.lib64	2010-05-05 15:09:31.000000000 -0400
-+++ Python-2.7rc1/Lib/distutils/command/install.py	2010-06-05 23:53:24.802224367 -0400
+diff -up Python-2.7/Lib/distutils/command/install.py.lib64 Python-2.7/Lib/distutils/command/install.py
+--- Python-2.7/Lib/distutils/command/install.py.lib64	2010-05-05 15:09:31.000000000 -0400
++++ Python-2.7/Lib/distutils/command/install.py	2010-08-16 15:49:49.998271662 -0400
 @@ -42,14 +42,14 @@ else:
  INSTALL_SCHEMES = {
      'unix_prefix': {
@@ -18,9 +18,9 @@ diff -up Python-2.7rc1/Lib/distutils/command/install.py.lib64 Python-2.7rc1/Lib/
          'headers': '$base/include/python/$dist_name',
          'scripts': '$base/bin',
          'data'   : '$base',
-diff -up Python-2.7rc1/Lib/distutils/sysconfig.py.lib64 Python-2.7rc1/Lib/distutils/sysconfig.py
---- Python-2.7rc1/Lib/distutils/sysconfig.py.lib64	2010-05-05 15:09:31.000000000 -0400
-+++ Python-2.7rc1/Lib/distutils/sysconfig.py	2010-06-05 23:53:24.803224186 -0400
+diff -up Python-2.7/Lib/distutils/sysconfig.py.lib64 Python-2.7/Lib/distutils/sysconfig.py
+--- Python-2.7/Lib/distutils/sysconfig.py.lib64	2010-05-05 15:09:31.000000000 -0400
++++ Python-2.7/Lib/distutils/sysconfig.py	2010-08-16 15:49:49.998271662 -0400
 @@ -114,8 +114,12 @@ def get_python_lib(plat_specific=0, stan
          prefix = plat_specific and EXEC_PREFIX or PREFIX
  
@@ -35,9 +35,9 @@ diff -up Python-2.7rc1/Lib/distutils/sysconfig.py.lib64 Python-2.7rc1/Lib/distut
          if standard_lib:
              return libpython
          else:
-diff -up Python-2.7rc1/Lib/site.py.lib64 Python-2.7rc1/Lib/site.py
---- Python-2.7rc1/Lib/site.py.lib64	2010-06-03 17:21:03.000000000 -0400
-+++ Python-2.7rc1/Lib/site.py	2010-06-06 04:56:41.504986054 -0400
+diff -up Python-2.7/Lib/site.py.lib64 Python-2.7/Lib/site.py
+--- Python-2.7/Lib/site.py.lib64	2010-06-03 17:21:03.000000000 -0400
++++ Python-2.7/Lib/site.py	2010-08-16 15:49:49.998271662 -0400
 @@ -286,12 +286,16 @@ def getsitepackages():
          if sys.platform in ('os2emx', 'riscos'):
              sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
@@ -55,9 +55,37 @@ diff -up Python-2.7rc1/Lib/site.py.lib64 Python-2.7rc1/Lib/site.py
              sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
          if sys.platform == "darwin":
              # for framework builds *only* we add the standard Apple
-diff -up Python-2.7rc1/Makefile.pre.in.lib64 Python-2.7rc1/Makefile.pre.in
---- Python-2.7rc1/Makefile.pre.in.lib64	2010-06-05 23:53:24.000000000 -0400
-+++ Python-2.7rc1/Makefile.pre.in	2010-06-06 04:57:25.280017307 -0400
+diff -up Python-2.7/Lib/test/test_site.py.lib64 Python-2.7/Lib/test/test_site.py
+--- Python-2.7/Lib/test/test_site.py.lib64	2010-08-16 15:49:56.149022511 -0400
++++ Python-2.7/Lib/test/test_site.py	2010-08-16 15:49:58.268901184 -0400
+@@ -169,16 +169,19 @@ class HelperFunctionsTests(unittest.Test
+             wanted = os.path.join('xoxo', 'Lib', 'site-packages')
+             self.assertEquals(dirs[0], wanted)
+         elif os.sep == '/':
+-            self.assertTrue(len(dirs), 2)
+-            wanted = os.path.join('xoxo', 'lib', 'python' + sys.version[:3],
++            self.assertEquals(len(dirs), 3)
++            wanted = os.path.join('xoxo', 'lib64', 'python' + sys.version[:3],
+                                   'site-packages')
+             self.assertEquals(dirs[0], wanted)
+-            wanted = os.path.join('xoxo', 'lib', 'site-python')
++            wanted = os.path.join('xoxo', 'lib', 'python' + sys.version[:3],
++                                  'site-packages')
+             self.assertEquals(dirs[1], wanted)
++            wanted = os.path.join('xoxo', 'lib', 'site-python')
++            self.assertEquals(dirs[2], wanted)
+         else:
+-            self.assertTrue(len(dirs), 2)
++            self.assertEquals(len(dirs), 2)
+             self.assertEquals(dirs[0], 'xoxo')
+-            wanted = os.path.join('xoxo', 'lib', 'site-packages')
++            wanted = os.path.join('xoxo', 'lib64', 'site-packages')
+             self.assertEquals(dirs[1], wanted)
+ 
+         # let's try the specific Apple location
+diff -up Python-2.7/Makefile.pre.in.lib64 Python-2.7/Makefile.pre.in
+--- Python-2.7/Makefile.pre.in.lib64	2010-08-16 15:49:49.992272080 -0400
++++ Python-2.7/Makefile.pre.in	2010-08-16 15:49:49.999271826 -0400
 @@ -94,7 +94,7 @@ LIBDIR=		@libdir@
  MANDIR=		@mandir@
  INCLUDEDIR=	@includedir@
@@ -67,9 +95,9 @@ diff -up Python-2.7rc1/Makefile.pre.in.lib64 Python-2.7rc1/Makefile.pre.in
  
  # Detailed destination directories
  BINLIBDEST=	$(LIBDIR)/python$(VERSION)
-diff -up Python-2.7rc1/Modules/getpath.c.lib64 Python-2.7rc1/Modules/getpath.c
---- Python-2.7rc1/Modules/getpath.c.lib64	2010-05-09 10:46:46.000000000 -0400
-+++ Python-2.7rc1/Modules/getpath.c	2010-06-06 04:58:53.840226352 -0400
+diff -up Python-2.7/Modules/getpath.c.lib64 Python-2.7/Modules/getpath.c
+--- Python-2.7/Modules/getpath.c.lib64	2010-05-09 10:46:46.000000000 -0400
++++ Python-2.7/Modules/getpath.c	2010-08-16 15:49:49.999271826 -0400
 @@ -117,8 +117,8 @@
  #endif
  
@@ -108,9 +136,9 @@ diff -up Python-2.7rc1/Modules/getpath.c.lib64 Python-2.7rc1/Modules/getpath.c
      }
      /* If we found EXEC_PREFIX do *not* reduce it!  (Yet.) */
  
-diff -up Python-2.7rc1/Modules/Setup.dist.lib64 Python-2.7rc1/Modules/Setup.dist
---- Python-2.7rc1/Modules/Setup.dist.lib64	2010-06-05 23:53:24.792224061 -0400
-+++ Python-2.7rc1/Modules/Setup.dist	2010-06-05 23:53:24.845009526 -0400
+diff -up Python-2.7/Modules/Setup.dist.lib64 Python-2.7/Modules/Setup.dist
+--- Python-2.7/Modules/Setup.dist.lib64	2010-08-16 15:49:49.988272889 -0400
++++ Python-2.7/Modules/Setup.dist	2010-08-16 15:49:49.999271826 -0400
 @@ -413,7 +413,7 @@ gdbm gdbmmodule.c -lgdbm
  # and the subdirectory of PORT where you built it.
  DBLIBVER=4.7
@@ -129,9 +157,9 @@ diff -up Python-2.7rc1/Modules/Setup.dist.lib64 Python-2.7rc1/Modules/Setup.dist
  
  # Interface to the Expat XML parser
  #
-diff -up Python-2.7rc1/setup.py.lib64 Python-2.7rc1/setup.py
---- Python-2.7rc1/setup.py.lib64	2010-06-04 05:49:20.000000000 -0400
-+++ Python-2.7rc1/setup.py	2010-06-06 05:00:36.653100371 -0400
+diff -up Python-2.7/setup.py.lib64 Python-2.7/setup.py
+--- Python-2.7/setup.py.lib64	2010-06-27 08:36:16.000000000 -0400
++++ Python-2.7/setup.py	2010-08-16 15:49:50.000271774 -0400
 @@ -347,7 +347,7 @@ class PyBuildExt(build_ext):
  
      def detect_modules(self):
diff --git a/python.spec b/python.spec
index 731983d..8be62e9 100644
--- a/python.spec
+++ b/python.spec
@@ -35,6 +35,9 @@
 
 %global with_debug_build 1
 
+# Disabled for now:
+%global with_huntrleaks 0
+
 %global with_gdb_hooks 1
 
 %global with_systemtap 1
@@ -91,7 +94,7 @@ Summary: An interpreted, interactive, object-oriented programming language
 Name: %{python}
 # Remember to also rebase python-docs when changing this:
 Version: 2.7
-Release: 7%{?dist}
+Release: 8%{?dist}
 License: Python
 Group: Development/Languages
 Provides: python-abi = %{pybasever}
@@ -416,6 +419,17 @@ Patch122: python-2.7-fix-parallel-make.patch
 # Cherrypicked from r82530 upstream:
 Patch123: python-2.7-fix-2to3-itertools-import-star.patch
 
+# test_commmands fails on SELinux systems due to a change in the output
+# of "ls" (http://bugs.python.org/issue7108)
+Patch124: fix-test_commands-expected-ls-output-issue7108.patch
+
+# COUNT_ALLOCS is useful for debugging, but the upstream behaviour of always
+# emitting debug info to stdout on exit is too verbose and makes it harder to
+# use the debug build.  Add a "PYTHONDUMPCOUNTS" environment variable which
+# must be set to enable the output on exit
+# Not yet sent upstream:
+Patch125: less-verbose-COUNT_ALLOCS.patch
+
 # This is the generated patch to "configure"; see the description of
 #   %{regenerate_autotooling_patch}
 # above:
@@ -659,7 +673,9 @@ rm -r Modules/zlib || exit 1
 %patch122 -p1 -b .fix-parallel-make
 pushd Lib
 %patch123 -p0
-popd 
+popd
+%patch124 -p1
+%patch125 -p1 -b .less-verbose-COUNT_ALLOCS
 
 # This shouldn't be necesarry, but is right now (2.2a3)
 find -name "*~" |xargs rm -f
@@ -1062,6 +1078,207 @@ sed \
 %endif # with_debug_build
 %endif # with_systemtap
 
+%check
+topdir=$(pwd)
+CheckPython() {
+  ConfName=$1
+  BinaryName=$2
+  ConfDir=$(pwd)/build/$ConfName
+
+  echo STARTING: CHECKING OF PYTHON FOR CONFIGURATION: $ConfName
+
+  # Notes about disabled tests:
+  #
+  # test_argparse:
+  #   fails when in a full build, but works when run standalone; seems to be
+  #   http://bugs.python.org/issue9553 (needs COLUMNS=80 in the environment)
+  #
+  # test_distutils:
+  #   fails with
+  #      /usr/bin/ld: cannot find -lpython2.7
+  #   in: test_build_ext (distutils.tests.test_build_ext.BuildExtTestCase)
+  #       test_get_outputs (distutils.tests.test_build_ext.BuildExtTestCase)
+  #
+  # test_dl: 
+  #   fails with:
+  #     <type 'exceptions.SystemError'>: module dl requires sizeof(int) ==
+  #     sizeof(long) == sizeof(char*)
+  #   on 64-bit builds, and the module is deprecated in favour of ctypes
+  #
+  # test_gdb:
+  #   very dependent on GCC version
+  #
+  # test_http*
+  #   I've seen occasional hangs in some http tests when running the test suite
+  #   inside Koji on Python 3.  For that reason I exclude them
+  #
+  # test_socket.py:
+  #   Can fail on Koji build with:
+  #     gaierror: [Errno -3] Temporary failure in name resolution
+  #
+  # test_urllib2
+  #   Can fail on Koji build with:
+  #     gaierror: [Errno -3] Temporary failure in name resolution
+  #
+  #
+  ###########################################################################
+  # TO BE INVESTIGATED:
+  ###########################################################################
+  # 
+  # test_file:
+  #   Fails in Koji with:
+  #  ======================================================================
+  #  FAIL: testStdin (test.test_file.COtherFileTests)
+  #  ----------------------------------------------------------------------
+  #  Traceback (most recent call last):
+  #    File "/builddir/build/BUILD/Python-2.7/Lib/test/test_file.py", line 160, in testStdin
+  #      self.assertRaises((IOError, ValueError), sys.stdin.seek, -1)
+  #  AssertionError: (<type 'exceptions.IOError'>, <type 'exceptions.ValueError'>) not raised
+  #  ======================================================================
+  #  FAIL: testStdin (test.test_file.PyOtherFileTests)
+  #  ----------------------------------------------------------------------
+  #  Traceback (most recent call last):
+  #    File "/builddir/build/BUILD/Python-2.7/Lib/test/test_file.py", line 160, in testStdin
+  #      self.assertRaises((IOError, ValueError), sys.stdin.seek, -1)
+  #  AssertionError: (<type 'exceptions.IOError'>, <type 'exceptions.ValueError'>) not raised
+  #  ----------------------------------------------------------------------
+  #
+  # test_file2k:
+  #   Fails in Koji on with:
+  #  ======================================================================
+  #  FAIL: testStdin (test.test_file2k.OtherFileTests)
+  #  ----------------------------------------------------------------------
+  #  Traceback (most recent call last):
+  #    File "/builddir/build/BUILD/Python-2.7/Lib/test/test_file2k.py", line 211, in testStdin
+  #      self.assertRaises(IOError, sys.stdin.seek, -1)
+  #  AssertionError: IOError not raised
+  #  ----------------------------------------------------------------------
+  #
+  # test_subprocess:
+  #    Fails in Koji with:
+  #  ======================================================================
+  #  ERROR: test_leaking_fds_on_error (test.test_subprocess.ProcessTestCase)
+  #  ----------------------------------------------------------------------
+  #  Traceback (most recent call last):
+  #    File "/builddir/build/BUILD/Python-2.7/Lib/test/test_subprocess.py", line 534, in test_leaking_fds_on_error
+  #      raise c.exception
+  #  OSError: [Errno 13] Permission denied
+  #  ======================================================================
+  #  ERROR: test_leaking_fds_on_error (test.test_subprocess.ProcessTestCaseNoPoll)
+  #  ----------------------------------------------------------------------
+  #  Traceback (most recent call last):
+  #    File "/builddir/build/BUILD/Python-2.7/Lib/test/test_subprocess.py", line 534, in test_leaking_fds_on_error
+  #      raise c.exception
+  #  OSError: [Errno 13] Permission denied
+  #  ----------------------------------------------------------------------
+  #
+  EXCLUDED_TESTS="test_argparse \
+      test_distutils \
+      test_dl \
+      test_gdb \
+      test_http_cookies \
+      test_httplib \
+      test_socket \
+      test_urllib2 \
+      test_file \
+      test_file2k \
+      test_subprocess \
+  %{nil}"
+  
+  # Debug build shows some additional failures (to be investigated):
+  #
+  # test_gc:
+  #  ======================================================================
+  #  FAIL: test_newinstance (__main__.GCTests)
+  #  ----------------------------------------------------------------------
+  #  Traceback (most recent call last):
+  #    File "Lib/test/test_gc.py", line 105, in test_newinstance
+  #      self.assertNotEqual(gc.collect(), 0)
+  #  AssertionError: 0 == 0
+  #  
+  #  ----------------------------------------------------------------------
+  #
+  # test_sys:
+  #  ======================================================================
+  #  FAIL: test_objecttypes (__main__.SizeofTest)
+  #  ----------------------------------------------------------------------
+  #  Traceback (most recent call last):
+  #    File "Lib/test/test_sys.py", line 739, in test_objecttypes
+  #      check(newstyleclass, s)
+  #    File "Lib/test/test_sys.py", line 510, in check_sizeof
+  #      self.assertEqual(result, size, msg)
+  #  AssertionError: wrong size for <type 'type'>: got 960, expected 920
+  #  
+  #  ----------------------------------------------------------------------
+  #  which is this code:
+  #          # type
+  #          # (PyTypeObject + PyNumberMethods +  PyMappingMethods +
+  #          #  PySequenceMethods + PyBufferProcs)
+  #          s = size(vh + 'P2P15Pl4PP9PP11PI') + size('41P 10P 3P 6P')
+  #          class newstyleclass(object):
+  #              pass
+  #          check(newstyleclass, s)
+  #  
+  # test_weakref:
+  #  ======================================================================
+  #  FAIL: test_callback_in_cycle_resurrection (__main__.ReferencesTestCase)
+  #  ----------------------------------------------------------------------
+  #  Traceback (most recent call last):
+  #    File "Lib/test/test_weakref.py", line 591, in test_callback_in_cycle_resurrection
+  #      self.assertEqual(alist, ["C went away"])
+  #  AssertionError: Lists differ: [] != ['C went away']
+  #  
+  #  Second list contains 1 additional elements.
+  #  First extra element 0:
+  #  C went away
+  #  
+  #  - []
+  #  + ['C went away']
+  #  
+  #  ----------------------------------------------------------------------
+  #
+  if [ "$ConfName" = "debug"  ] ; then
+    EXCLUDED_TESTS="$EXCLUDED_TESTS \
+      test_gc \
+      test_sys \
+      test_weakref \
+    %{nil}"
+  fi
+  
+  # Note that we're running the tests using the version of the code in the
+  # builddir, not in the buildroot.
+
+  pushd $ConfDir
+
+  EXTRATESTOPTS="--verbose3"
+
+%if 0%{?with_huntrleaks}
+  # Try to detect reference leaks on debug builds.  By default this means
+  # running every test 10 times (6 to stabilize, then 4 to watch):
+  if [ "$ConfName" = "debug"  ] ; then
+    EXTRATESTOPTS="$EXTRATESTOPTS --huntrleaks : "
+  fi
+%endif
+
+  # Actually invoke regrtest.py:
+  EXTRATESTOPTS="$EXTRATESTOPTS -x $EXCLUDED_TESTS" make test
+
+  popd
+
+  echo FINISHED: CHECKING OF PYTHON FOR CONFIGURATION: $ConfName
+
+}
+
+# Check each of the configurations:
+%if 0%{?with_debug_build}
+CheckPython \
+  debug \
+  python%{pybasever}-debug
+%endif # with_debug_build
+CheckPython \
+  optimized \
+  python%{pybasever}
+
 %clean
 rm -fr %{buildroot}
 
@@ -1405,6 +1622,13 @@ rm -fr %{buildroot}
 # payload file would be unpackaged)
 
 %changelog
+* Wed Aug 18 2010 David Malcolm <dmalcolm at redhat.com> - 2.7-8
+- add %%check section
+- update lib64 patch (patch 102) to fix expected output in test_site.py on
+64-bit systems
+- patch test_commands.py to work with SELinux (patch 124)
+- patch the debug build's usage of COUNT_ALLOCS to be less verbose (patch 125)
+
 * Mon Jul 26 2010 David Malcolm <dmalcolm at redhat.com> - 2.7-7
 - fixup missing -lcrypt to "crypt" module in config patch (patch 0)
 


More information about the scm-commits mailing list