[Python-3000] buildbots

Thomas Heller theller at ctypes.org
Thu Aug 30 08:40:05 CEST 2007


Martin v. Löwis schrieb:
>> I suggest to apply this patch, which sets an environment variable in the
>> Tools\buildbot\test.bat script, detects the Windows debug build, and calls
>> SetErrorMode(7) as David suggested:
> 
> Sounds fine with me - although I would leave out the test for debug
> build, and just check the environment variable.
> 
> Are you saying that calling SetErrorMode also makes the VC _ASSERT
> message boxes go away?

No. My mistake - I still had some _CrtSetReport... calls in a patched
posixmodule.c.

New patch (still detects the debug build because the name of the C runtime
dll depends on it):


Index: Lib/test/regrtest.py
===================================================================
--- Lib/test/regrtest.py	(revision 57666)
+++ Lib/test/regrtest.py	(working copy)
@@ -208,6 +208,22 @@
     flags on the command line.
     """
 
+    if sys.platform == "win32":
+        import imp
+        if "_d.pyd" in [s[0] for s in imp.get_suffixes()]:
+            # running is a debug build.
+            if os.environ.get("PYTEST_NONINTERACTIVE", ""):
+                # If the PYTEST_NONINTERACTIVE environment variable is
+                # set, we do not want any message boxes.
+                import ctypes
+                # from <crtdbg.h>
+                _CRT_ASSERT = 2
+                _CRTDBG_MODE_FILE = 1
+                _CRTDBG_FILE_STDERR = -5
+                ctypes.cdll.msvcr71d._CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
+                ctypes.cdll.msvcr71d._CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
+                ctypes.windll.kernel32.SetErrorMode(7)
+
     test_support.record_original_stdout(sys.stdout)
     try:
         opts, args = getopt.getopt(sys.argv[1:], 'dhvgqxsS:rf:lu:t:TD:NLR:wM:',
Index: Tools/buildbot/test.bat
===================================================================
--- Tools/buildbot/test.bat	(revision 57666)
+++ Tools/buildbot/test.bat	(working copy)
@@ -1,3 +1,4 @@
 @rem Used by the buildbot "test" step.
 cd PCbuild
+set PYTEST_NONINTERACTIVE=1
 call rt.bat -d -q -uall -rw



More information about the Python-3000 mailing list