From 47b4041e92b38671b593c59c57f70f677ac3963d Mon Sep 17 00:00:00 2001 From: "kjellander@webrtc.org" Date: Thu, 17 May 2012 18:08:04 +0000 Subject: [PATCH] Make the bot kill VCam properly Fixing so that VCamManager.exe is properly killed and changed so that the stepp is not failing if there's nothing to kill. BUG=None TEST=Tested successfully on live master and slaves. Review URL: https://webrtc-codereview.appspot.com/568007 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2255 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../scripts/webrtc_buildbot/utils.py | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/tools/continuous_build/build_internal/scripts/webrtc_buildbot/utils.py b/tools/continuous_build/build_internal/scripts/webrtc_buildbot/utils.py index 0ec5f13714..f59c002975 100755 --- a/tools/continuous_build/build_internal/scripts/webrtc_buildbot/utils.py +++ b/tools/continuous_build/build_internal/scripts/webrtc_buildbot/utils.py @@ -825,7 +825,6 @@ class WebRTCWinFactory(WebRTCFactory): # Must provide full path to the command since we cannot add custom paths to # the PATH environment variable when using Chromium buildbot startup scripts. BUILD_CMD = r'C:\Windows\Microsoft.NET\Framework\v3.5\msbuild.exe' - VCAM_PROCESS_NAME = 'VCamManager' VCAM_PATH = r'C:\Program Files (x86)\e2eSoft\VCam\VCamManager.exe' def __init__(self, build_status_oracle, is_try_slave=False): @@ -860,8 +859,7 @@ class WebRTCWinFactory(WebRTCFactory): # Since Windows is very picky about locking files, make sure to kill # any interfering processes. Feel free to add more process kill steps if # necessary. - cmd = '%WINDIR%\\system32\\taskkill /f /im svn.exe || set ERRORLEVEL=0' - self.AddCommonStep(cmd, 'svnkill') + self.KillProcesses('svn.exe') # TODO(kjellander): Enable for normal slaves too when all are moved over to # the new slave architecture. @@ -898,6 +896,20 @@ class WebRTCWinFactory(WebRTCFactory): '/p:Configuration=Release;Platform=%s' % (self.platform)] self.AddCommonStep(cmd, descriptor='Build(Release)') + def KillProcesses(self, process_name, descriptor=None): + """Kills all running processes with the specified name. + + Make sure the name contains .exe at the end. If no processes are found, this + method will execute silently doing nothing. + """ + # Setting ERRORLEVEL is to make sure the command always exits with exit code + # 0, since we want the step to succeed even when there's nothing to kill. + cmd = ('%WINDIR%\\system32\\taskkill.exe /f /im ' + process_name + + ' || set ERRORLEVEL=0') + if not descriptor: + descriptor = 'kill %s' % process_name + self.AddCommonStep(cmd, descriptor) + def EnableTest(self, test): """Adds a step for running a test on Windows. @@ -922,8 +934,7 @@ class WebRTCWinFactory(WebRTCFactory): 'ViEStandardIntegrationTest.RunsRtpRtcpTestWithoutErrors" ' # bug 477 '--capture_test_ensure_resolution_alignment_in_capture_device=false') self.AddCommonTestRunStep(test=test, cmd=cmd) - self.AddCommonStep(cmd=['tskill', WebRTCWinFactory.VCAM_PROCESS_NAME], - descriptor=['Stopping VCam']) + self.KillProcesses('VCamManager.exe', 'Stop VCam') elif test == 'voe_auto_test': cmd = 'build\\Debug\\voe_auto_test.exe --automated' self.AddCommonTestRunStep(test=test, cmd=cmd)