Changeset 626
- Timestamp:
- Oct 17, 2007 7:52:37 AM (13 years ago)
- Location:
- branches/testScripts
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/testScripts/NBemail.py
r622 r626 42 42 emailMsg += "Host name: "+gethostname()+"\n\n" 43 43 44 emailMsg += "'" + cmd + "' messages are:\n" 45 emailMsg += cmdMsgs 44 emailMsg += "stderr messages are:\n" 45 emailMsg += cmdMsgs['stderr'] 46 emailMsg += "\n\nstdout messages are:\n" 47 emailMsg += cmdMsgs['stdout'] 48 if cmdMsgs.has_key('config.log') : 49 emailMsg += "\n\nconfig.log messages are:\n" 50 emailMsg += cmdMsgs['config.log'] 46 51 send(toAddrs,subject,emailMsg) 47 52 NBlogMessages.writeMessage( " email sent regarding "+project+" running '"+cmd+"'" ) -
branches/testScripts/NBuserConfig.py
r625 r626 79 79 # List of Projects to be processed by script 80 80 #---------------------------------------------------------------------- 81 PROJECTS = ['CoinUtils','DyLP','Clp','SYMPHONY','Vol','Osi','Cgl','Cbc', 'Ipopt','OS','CppAD']82 PROJECTS = ['CoinUtils']81 PROJECTS = ['CoinUtils','DyLP','Clp','SYMPHONY','Vol','Osi','Cgl','Cbc',\ 82 'FlopC++','Ipopt','OS','CppAD'] 83 83 84 84 -
branches/testScripts/nightlyBuild.py
r625 r626 3 3 import os 4 4 import sys 5 import commands6 5 import smtplib 7 6 import re … … 11 10 import NBlogMessages 12 11 import NBemail 12 import NBosCommand 13 13 14 14 # TODO: … … 26 26 27 27 28 #------------------------------------------------------------------------29 # Run command in another process.30 # Return: command's return code, stdout messages, & stderr messages31 #------------------------------------------------------------------------32 def runCommand(cmd) :33 p=subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)34 p.wait35 cmdRc=p.returncode36 cmdStdout=p.stdout.read()37 cmdStderr=p.stderr.read()38 28 39 29 #------------------------------------------------------------------------ 40 30 # Function to Check Return Code from unitTest 41 31 #------------------------------------------------------------------------ 42 def didTestFail( r c, project, buildStep ) :32 def didTestFail( result, project, buildStep ) : 43 33 retVal = 0 44 34 45 35 # If the return code is not 0, then failure 46 if r c[0] != 0 :36 if result['returnCode'] != 0 : 47 37 retVal = 1 48 38 … … 52 42 if buildStep in NBprojectConfig.ALL_TESTS_COMPLETED_SUCCESSFULLY_CMDS[project] : 53 43 # Is the success message contained in the output? 54 if rc[1].rfind("All tests completed successfully") == -1 : 44 if result['stderr'].rfind("All tests completed successfully") == -1 and \ 45 result['stdout'].rfind("All tests completed successfully") == -1 : 55 46 # Success message not found, assume test failed 56 47 retVal = 1 … … 64 55 # Check that last netlib test case ran by looking for message of form 65 56 # '../../Data/Netlib/woodw took 0.47 seconds using algorithm either' 66 reexp = r"(.|\n)* \.\.(\\|/)\.\.(\\|/)Data(\\|/)Netlib(\\|/)woodw took (\d*\.\d*) seconds using algorithm either(.|\n)*"67 msgTail = r c[1][-200:]57 reexp = r"(.|\n)*(\\|/)Data(\\|/)Netlib(\\|/)woodw took (\d*\.\d*) seconds using algorithm either(.|\n)*" 58 msgTail = result['stdout'][-200:] 68 59 if not re.compile(reexp).match(msgTail,1) : 69 60 # message not found, assume test failed … … 75 66 # 'cbc_clp solved 2 out of 2 and took XX.XX seconds.' 76 67 reexp=r"(.|\n)*cbc_clp solved 2 out of 2 and took (\d*\.\d*) seconds." 77 msgTail = r c[1][-300:]68 msgTail = result['stdout'][-300:] 78 69 if not re.compile(reexp).match(msgTail,1) : 79 70 # message not found, assume test failed … … 82 73 # Cbc's "./cbc -unitTest dirNetlib=_MIPLIB3DIR_ -miplib" 83 74 elif project=='Cbc' and buildStep==NBprojectConfig.UNITTEST_CMD['Cbc'] : 84 if r c[0]>=0 and rc[0]<=2 :75 if result['returnCode']>=0 and result['returnCode']<=2 : 85 76 # return code is between 0 and 2. 86 77 # Return code between 1 and 44 is the number of test cases that … … 100 91 os.chdir(dir) 101 92 NBlogMessages.writeMessage(' '+svnCmd) 102 r c=commands.getstatusoutput(svnCmd)103 if r c[0] != 0 :104 NBemail.sendCmdMsgs(project,r c[1],svnCmd)93 result = NBosCommand.run(svnCmd) 94 if result['returnCode'] != 0 : 95 NBemail.sendCmdMsgs(project,result,svnCmd) 105 96 retVal='Error' 106 97 return retVal … … 113 104 # If needed create the top level directory 114 105 #------------------------------------------------------------------------ 115 # rc=commands.getstatusoutput(NBuserConfig.NIGHTLY_BUILD_ROOT_DIR)116 106 if not os.path.isdir(NBuserConfig.NIGHTLY_BUILD_ROOT_DIR) : 117 107 os.makedirs(NBuserConfig.NIGHTLY_BUILD_ROOT_DIR) … … 131 121 if issueSvnCmd(svnCmd,dataBaseDir,'Data')!='OK' : 132 122 sys.exit(1) 133 r c=commands.getstatusoutput('find '+d+' -name \*.gz -print | xargs gzip -d')123 result=NBosCommand.run('find '+d+' -name \*.gz -print | xargs gzip -d') 134 124 netlibDir=os.path.join(dataBaseDir,'Netlib') 135 125 miplib3Dir=os.path.join(dataBaseDir,'miplib3') … … 140 130 for p in NBuserConfig.PROJECTS: 141 131 NBlogMessages.writeMessage( p ) 142 rc = [0]143 132 144 133 #--------------------------------------------------------------------- … … 170 159 configCmd = os.path.join('.','configure -C') 171 160 NBlogMessages.writeMessage(' '+configCmd) 172 r c=commands.getstatusoutput(configCmd)161 result=NBosCommand.run(configCmd) 173 162 174 163 # Check if configure worked 175 if r c[0] != 0 :176 error_msg = r c[1] + '\n\n'164 if result['returnCode'] != 0 : 165 error_msg = result 177 166 # Add contents of log file to message 178 167 logFileName = 'config.log' 179 168 if os.path.isfile(logFileName) : 180 169 logFilePtr = open(logFileName,'r') 181 error_msg += "config.log contains: \n"182 error_msg += logFilePtr.read()170 error_msg['config.log'] = "config.log contains: \n" 171 error_msg['config.log'] += logFilePtr.read() 183 172 logFilePtr.close() 184 173 NBemail.sendCmdMsgs(p,error_msg,configCmd) … … 186 175 187 176 #--------------------------------------------------------------------- 188 # Run make part of bui d177 # Run make part of build 189 178 #--------------------------------------------------------------------- 190 179 NBlogMessages.writeMessage( ' make' ) 191 r c=commands.getstatusoutput('make')180 result=NBosCommand.run('make') 192 181 193 182 # Check if make worked 194 if r c[0] != 0 :195 NBemail.sendCmdMsgs(p,r c[1],'make')183 if result['returnCode'] != 0 : 184 NBemail.sendCmdMsgs(p,result,'make') 196 185 continue 197 186 198 187 #--------------------------------------------------------------------- 199 # Run 'make test' part of bui d188 # Run 'make test' part of build 200 189 #--------------------------------------------------------------------- 201 190 NBlogMessages.writeMessage( ' make test' ) 202 r c=commands.getstatusoutput('make test')191 result=NBosCommand.run('make test') 203 192 204 193 # Check if 'make test' worked 205 if didTestFail(r c,p,"make test") :206 NBemail.sendCmdMsgs(p,r c[1],"make test")194 if didTestFail(result,p,"make test") : 195 NBemail.sendCmdMsgs(p,result,"make test") 207 196 continue 208 197 … … 219 208 220 209 NBlogMessages.writeMessage( ' '+unitTestCmd ) 221 r c=commands.getstatusoutput(unitTestCmd)210 result=NBosCommand.run(unitTestCmd) 222 211 223 if didTestFail(r c,p,unitTestCmdTemplate) :224 NBemail.sendCmdMsgs(p,r c[1],unitTestCmd)212 if didTestFail(result,p,unitTestCmdTemplate) : 213 NBemail.sendCmdMsgs(p,result,unitTestCmd) 225 214 continue 226 215
Note: See TracChangeset
for help on using the changeset viewer.