classification
Title: Test failure in test_sysconfig_module
Type: Stage: resolved
Components: Distutils, Macintosh Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ned.deily Nosy List: eric.araujo, georg.brandl, koobs, ned.deily, pitrou, python-dev, ronaldoussoren, sbt, tarek
Priority: release blocker Keywords: patch

Created on 2012-06-25 19:15 by georg.brandl, last changed 2012-07-22 10:24 by ned.deily. This issue is now closed.

Files
File name Uploaded Description Edit
issue15184_osx_support.patch ned.deily, 2012-06-26 06:20 review
Messages (22)
msg164005 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2012-06-25 19:15
On default, have this single failure on my box (Gentoo amd64):

======================================================================
FAIL: test_sysconfig_module (distutils.tests.test_sysconfig.SysconfigTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/gbr/devel/python/Lib/distutils/tests/test_sysconfig.py", line 105, in test_sysconfig_module
    self.assertEqual(global_sysconfig.get_config_var('LDSHARED'),sysconfig.get_config_var('LDSHARED'))
AssertionError: 'gcc -pthread -shared' != '/usr/bin/clang -shared'
- gcc -pthread -shared
+ /usr/bin/clang -shared


While clang is installed, I haven't set anything to clang while configuring, or in my environment.
msg164042 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-06-26 06:19
This test failure points at a few issues:

 - The CFLAGS modification should only be taking place on OS X systems.  AFAICT, all of that code is protected by sys.platform checks.  One possible culprit, though, might be distutils test test_unixccompiler which attempts to test various platforms by mocking sys.platform.  It so happens that "darwin" is the first platform it tests and, while the test setup and teardown does preserve and restore the get_config_var function in distutils.sysconfig, it doesn't preserve the module global _config_vars which distutils.sysconfig uses to cache the results of parsing the Makefile.  I wonder what happens if test_unixccompiler happens to be the first caller of distutils.sys_config_vars().  I think it will get invoked with sys.platform = 'darwin' and trigger the customization code on what becomes the cached copy for remaining tests.  I'm attaching a patch to preserve and restore the cached values as well.  Georg, I'd appreciate it if you could try this on your system.

 - More importantly, the test failure shows that the code we added for Xcode 4 support in Issue13590 only addressed distutils.sysconfig and not the identical code in standalone sysconfig.  With the removal of packaging in 3.3, AFAIK there now is nothing in the standard library that should depend on this at the moment but it will undoubtedly be an issue for distutil2 and future packaging features.  We had discussed dealing with this by factoring out the common customization code into a separate module to avoid DRY but I didn't get that done.  I'm attaching a first rough patch that does that; it is only very lightly tested and so should not be a candidate for 3.3.0b1.

I recommend the following steps:
  1. For 3.3.0b1, either ignore the test failure or add a skip for 3.3.0b1.  (This failure will also likely show up if OS X installer users attempt to run the tests.)
  2. Resolve the test failure on non-OS X platforms.
  3. Test and review the refactoring patch and plan to push it for 3.3.0rc1.
  4. Post 3.3.0, regardless of the outcome of the proposed packaging PEPs, finally replace distutils.sysconfig with sysconfig.  Attempting to continue to maintain both of them is just asking for more trouble.
msg164046 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2012-06-26 06:32
Sounds good.
msg164079 - (view) Author: √Čric Araujo (eric.araujo) * (Python committer) Date: 2012-06-26 14:43
Moving stuff common to both sysconfig modules into a shared module sounds good, but the existence and API of distutils.sysconfig needs to be preserved.
msg164104 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2012-06-26 20:52
Moving to blocker for beta2.
msg165657 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-07-16 21:33
Georg, are you still able to reproduce this? I've subsequently tried on a Debian platform with an installed clang and could not reproduce.  And, after further inspecting the current code, I really don't see how the clang substitution could happen on a non-darwin platform.  My initial speculation about test_unixcompiler was incorrect as well as the proposed patch to preserve config vars in it (that test does not actually affect _config_vars and _config_vars is a dict so has to be deep-copied to be restorable).  I'm proceeding with the _osx_support consolidation but I sure would like to know what was behind the behavior you reported.
msg165767 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2012-07-18 13:00
I suspect the problem is related to http://bugs.python.org/issue15298.

Basically the global sysconfig module caches the results of parsing Makefile in Lib/_sysconfigdata.py.  This can cause you to get the config vars from an old configure and build.
msg165789 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-07-18 16:46
I don't see how this is related to Issue15298.  In the failure here, sysconfig returns the expected value; the problem is with what distutils.sysconfig returns.
msg166016 - (view) Author: Roundup Robot (python-dev) Date: 2012-07-21 12:44
New changeset d76b83803e7e by Ned Deily in branch 'default':
Issue #15184: Ensure consistent results of OS X configuration
http://hg.python.org/cpython/rev/d76b83803e7e
msg166017 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-07-21 12:55
I've committed an updated version of the refactoring patch which attempts to handle some additional edge cases and which includes a number of additional tests.  I still have not been able to reproduce the original failure so I'm setting the status to pending awaiting a test report from Georg or someone else who is able to reproduce it.
msg166029 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-07-21 14:24
Buildbot test failure:
http://buildbot.python.org/all/builders/AMD64%20Snow%20Leopard%203.x/builds/66
msg166030 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2012-07-21 14:25
Damn, I don't have clang on this machine.  Will install and test.
msg166034 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-07-21 14:31
> Buildbot test failure:
> http://buildbot.python.org/all/builders/AMD64%20Snow%20Leopard%203.x/builds/66

These failures are not new, and the buildbot is an unstable one.

As for clang, the Lion buildbot uses it and is green. Its configure line is "./configure --with-pydebug CC=clang":
http://buildbot.python.org/all/builders/AMD64%20Lion%203.x
msg166035 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-07-21 14:33
The problem isn't with clang. The problem was that the test appeared to be taking an OS X only code path apparently because a clang was installed on a Gentoo machine.
msg166039 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2012-07-21 15:11
OK, test passes here now with clang installed.
msg166040 - (view) Author: Kubilay Kocak (koobs) Date: 2012-07-21 15:17
FYI, Added two FreeBSD based buildslaves to the cluster not long ago, one is dedicated to python+CLANG
 
http://buildbot.python.org/all/buildslaves/koobs-freebsd-clang
msg166041 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-07-21 15:18
The new buildbot failure is due to that buildbot using env variables for some of the config variables during execution.  The new tests need to isolate themselves from that.  Should have a fix shortly.
msg166047 - (view) Author: Roundup Robot (python-dev) Date: 2012-07-21 16:38
New changeset 295b715b6875 by Ned Deily in branch 'default':
Issue #15184: Ensure configuration-related environment variables
http://hg.python.org/cpython/rev/295b715b6875
msg166051 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-07-21 18:10
I believe I've fixed the buildbot failure but the buildbot is not very stable and test runs aren't always completing.  I'll check back on it later.
msg166104 - (view) Author: Roundup Robot (python-dev) Date: 2012-07-22 05:36
New changeset 31349bc40214 by Ned Deily in branch 'default':
Issue #15184: Fix test__remove_unsupported_archs failures on 10.6
http://hg.python.org/cpython/rev/31349bc40214
msg166115 - (view) Author: Roundup Robot (python-dev) Date: 2012-07-22 10:00
New changeset c286d50ecd19 by Ned Deily in branch 'default':
Issue #15184: Some config variables in test_sysconfig_module
http://hg.python.org/cpython/rev/c286d50ecd19
msg166118 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-07-22 10:24
The buildbot failures were reproducible on OS X 10.6 with Xcode 3. With the latest two fixes and with the fixes for Issue15188, I believe this issue is resolved for 3.3.
History
Date User Action Args
2012-07-22 10:24:52ned.deilysetstatus: open -> closed

messages: + msg166118
2012-07-22 10:00:02python-devsetmessages: + msg166115
2012-07-22 05:36:20python-devsetstatus: pending -> open

messages: + msg166104
2012-07-21 18:10:49ned.deilysetstatus: open -> pending
resolution: fixed
messages: + msg166051
2012-07-21 16:38:16python-devsetmessages: + msg166047
2012-07-21 15:18:58ned.deilysetmessages: + msg166041
2012-07-21 15:17:12koobssetnosy: + koobs
messages: + msg166040
2012-07-21 15:11:36georg.brandlsetmessages: + msg166039
2012-07-21 14:33:48ned.deilysetmessages: + msg166035
2012-07-21 14:31:11pitrousetnosy: + pitrou
messages: + msg166034
2012-07-21 14:25:40georg.brandlsetmessages: + msg166030
2012-07-21 14:24:06ned.deilysetstatus: pending -> open
resolution: fixed -> (no value)
messages: + msg166029
2012-07-21 13:15:12ned.deilylinkissue15195 superseder
2012-07-21 12:55:33ned.deilysetstatus: open -> pending
resolution: fixed
messages: + msg166017

stage: patch review -> resolved
2012-07-21 12:44:23python-devsetnosy: + python-dev
messages: + msg166016
2012-07-18 16:46:37ned.deilysetmessages: + msg165789
2012-07-18 13:00:52sbtsetnosy: + sbt
messages: + msg165767
2012-07-16 21:33:40ned.deilysetfiles: - issue15184_preserve_config_vars.patch
2012-07-16 21:33:23ned.deilysetmessages: + msg165657
2012-06-26 20:52:13georg.brandlsetpriority: deferred blocker -> release blocker

messages: + msg164104
2012-06-26 14:43:12eric.araujosetmessages: + msg164079
2012-06-26 06:32:17georg.brandlsetmessages: + msg164046
2012-06-26 06:20:04ned.deilysetfiles: + issue15184_osx_support.patch
2012-06-26 06:19:33ned.deilysetfiles: + issue15184_preserve_config_vars.patch
priority: high -> deferred blocker

components: + Distutils, Macintosh, - Tests
assignee: ned.deily

keywords: + patch
nosy: + tarek, ronaldoussoren
messages: + msg164042
stage: patch review
2012-06-25 21:08:27ned.deilysetnosy: + ned.deily
2012-06-25 19:15:34georg.brandlcreate