[Python-Dev] Stable buildbots

David Bolen db3l.net at gmail.com
Tue Nov 16 03:35:05 CET 2010


Brian Curtin <brian.curtin at gmail.com> writes:

> Is the dialog closer script available somewhere? I'm guessing this is the
> same script that closes the window which pops up during test_capi's crash?

Not sure about that specific test, as I won't normally see the windows.

If the failure is causing a C RTL pop-up, then yes, the script will
be closing it. If the test is generating an OS level pop-up (process
error dialog from the OS, not RTL) then that is instead suppressed for
any of the child processes run on my slave, so it never shows up at all.

The RTL script is trivial enough that I'll just include it inline:

          - - - - - - - - - - - - - - - - - - - - - - - - -
; buildbot.au3
; Forceably acknowledge any RTL pop-ups that may occur during testing

$MSVCRT = "Microsoft Visual C++ Runtime Library"

while 1
    ; Wait for any RTL pop-up and then acknowledge
    WinWait($MSVCRT)
    ControlClick($MSVCRT, "", "[CLASS:Button; TEXT:OK]")
    
    ; Safety check to avoid spinning if it doesn't go away
    Sleep(1000)
WEnd
          - - - - - - - - - - - - - - - - - - - - - - - - -

Execute with AutoIt3 (http://www.autoitscript.com/autoit3/).  I just
use the plain autoit3.exe against this script from the Startup folder.

The error mode buildbot patch was discussed in the past on this list
(or it might have been the python-3000-devel list at the time).
Originally it just used pywin32, but I added a fallback to ctypes if
available.  When first done, we were still building pre-2.5 builds - I
suppose at this point it could just assume the presence of ctypes.
The patch below is from 0.7.11p3:

          - - - - - - - - - - - - - - - - - - - - - - - - -
--- commands.py	2009-08-13 11:53:17.000000000 -0400
+++ /cygdrive/d/python/2.6/lib/site-packages/buildbot/slave/commands.py	2009-11-08 02:09:38.000000000 -0500
@@ -489,6 +489,23 @@
         if not self.keepStdinOpen:
             self.pp.closeStdin()
 
+        # [db3l] Under Win32, try to control error mode
+        win32_SetErrorMode = None
+        if runtime.platformType  == 'win32':
+            try:
+                import win32api
+                win32_SetErrorMode = win32api.SetErrorMode
+            except:
+                try:
+                    import ctypes
+                    win32_SetErrorMode = ctypes.windll.kernel32.SetErrorMode
+                except:
+                    pass
+
+        if win32_SetErrorMode:
+            log.msg(" Setting Windows error mode")
+            old_err_mode = win32_SetErrorMode(7)
+
         # win32eventreactor's spawnProcess (under twisted <= 2.0.1) returns
         # None, as opposed to all the posixbase-derived reactors (which
         # return the new Process object). This is a nuisance. We can make up
@@ -509,6 +526,10 @@
         if not self.process:
             self.process = p
 
+        # [db3l]
+        if win32_SetErrorMode:
+            win32_SetErrorMode(old_err_mode)
+
         # connectionMade also closes stdin as long as we're not using a PTY.
         # This is intended to kill off inappropriately interactive commands
         # better than the (long) hung-command timeout. ProcessPTY should be
          - - - - - - - - - - - - - - - - - - - - - - - - -

-- David



More information about the Python-Dev mailing list