- Timestamp:
- Nov 9, 2007 9:43:13 PM (12 years ago)
- Location:
- branches/testScripts
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/testScripts/NBbuildConfig.py
r739 r740 22 22 THIRD_PARTY_HISTORY = [] 23 23 24 25 #--------------------------------------------------------------------- 26 # cleanUpName: 27 # File and directory names are generated and may contain 28 # undesireable characters. 29 # Remove these characters from the name 30 #--------------------------------------------------------------------- 31 def cleanUpName(messedUpName) : 32 cleanedUpName=messedUpName 33 cleanedUpName=cleanedUpName.replace('/','-') 34 cleanedUpName=cleanedUpName.replace('\\','-') 35 cleanedUpName=cleanedUpName.replace(' ','') 36 cleanedUpName=cleanedUpName.replace('"','') 37 cleanedUpName=cleanedUpName.replace("'",'') 38 cleanedUpName=cleanedUpName.replace('--enable','') 39 return cleanedUpName 40 41 42 #--------------------------------------------------------------------- 43 # writeResults: 44 # After running a command write stdout and stderr to a file 45 #--------------------------------------------------------------------- 46 def writeResults(result,filenameSuffix) : 47 cleanedUpSuffix=cleanUpName(filenameSuffix) 48 stdoutfile=open('NBstdout-'+cleanedUpSuffix,'w') 49 stdoutfile.write(result['stdout']) 50 stdoutfile.close() 51 stderrfile=open('NBstderr-'+cleanedUpSuffix,'w') 52 stderrfile.write(result['stderr']) 53 stderrfile.close() 54 24 55 #------------------------------------------------------------------------ 25 56 # Given a configuration, build and test it. … … 63 94 # from the build. 64 95 # examples: "Ipopt", "Ipopt DyLP" 96 # 97 # configuration['slnFile']= path and name of solution file if it is not 98 # in the standard location. 65 99 # Only used if configuration['buildMethod']=='unixConfig' 66 100 # 67 # configuration['checkMakeTest']= function to be called to determine 68 # if "make test" ran correctly 69 # Only used if configuration['buildMethod']=='unixConfig' 70 # 71 # configuration['unitTest']= undefined or dictionary D where 72 # D['path']= relative path were unitTest is to be run from. 73 # D['command']= command to be issued to run unitTest 74 # D['checkUnitTest']= function to be called to determine if unitTest 75 # ran correctly. 76 # Only used if configuration['buildMethod']=='unixConfig' 77 # 78 # configuration['test'] 79 # configuration['slnFile'] 101 # configuration['test']=vector of triples indicating tests that 102 # are to be run after building the project. Each triple consists 103 # of: 104 # 'dir': directory where test command is to be issued. 105 # 'cmd': command to be run with any parameters. 106 # 'check': vector of functions to be called which will check the 107 # results from running 'cmd' to determine if an error occurred 80 108 #------------------------------------------------------------------------ 81 109 def run(configuration) : … … 83 111 84 112 # Create svn checkout target directory name 85 svnVersionFlattened=c onfiguration['svnVersion'].replace('/','-')113 svnVersionFlattened=cleanUpName(configuration['svnVersion']) 86 114 87 115 #--------------------------------------------------------------------- … … 109 137 configuration['configOptions']['unique']+\ 110 138 buildDir 111 buildDir=buildDir.replace(' ','') 112 buildDir=buildDir.replace('"','') 113 buildDir=buildDir.replace("'",'') 114 buildDir=buildDir.replace('--enable','') 139 buildDir=cleanUpName(buildDir) 115 140 if buildDir==svnVersionFlattened : buildDir+='-default' 116 141 … … 205 230 f=open('NBinstalldone','w') 206 231 f.close() 207 stdoutfile=open(thirdPartyDir+'/NBstdout','w') 208 stdoutfile.write(installReturn['stdout']) 209 stdoutfile.close() 210 stderrfile=open(thirdPartyDir+'/NBstderr','w') 211 stderrfile.write(installReturn['stderr']) 212 stderrfile.close() 232 writeResults(result,install3rdPartyCmd) 213 233 else : 214 234 NBlogMessages.writeMessage(' skipped a new download of '+d) … … 216 236 NBlogMessages.writeMessage(' Skipped a new download into '+thirdPartyBaseDir) 217 237 238 #--------------------------------------------------------------------- 239 # Source is now available, so now it is time to run config 240 #--------------------------------------------------------------------- 218 241 if configuration['buildMethod']=='unixConfig' : 219 #---------------------------------------------------------------------220 # Source is now available, so now it is time to run config221 #---------------------------------------------------------------------222 242 skipOptions='' 223 243 … … 250 270 configCmd = os.path.join(projectCheckOutDir,"configure "+configOptions) 251 271 252 253 254 272 # If config was previously run, then no need to run again. 255 273 # if NBcheckResult.didConfigRunOK() : … … 260 278 # Finally run config 261 279 result=NBosCommand.run(configCmd) 262 stdoutfile=open('NBconfig.stdout','w') 263 stdoutfile.write(result['stdout']) 264 stdoutfile.close() 265 stderrfile=open('NBconfig.stderr','w') 266 stderrfile.write(result['stderr']) 267 stderrfile.close() 280 writeResults(result,'config') 268 281 269 282 # Check if configure worked … … 286 299 NBlogMessages.writeMessage( ' make' ) 287 300 result=NBosCommand.run('make') 288 stdoutfile=open('NBmake.stdout','w') 289 stdoutfile.write(result['stdout']) 290 stdoutfile.close() 291 stderrfile=open('NBmake.stderr','w') 292 stderrfile.write(result['stderr']) 293 stderrfile.close() 301 writeResults(result,'make') 294 302 295 303 # Check if make worked … … 299 307 NBemail.sendCmdMsgs(configuration['project'],result,'make') 300 308 return 301 302 #---------------------------------------------------------------------303 # Run 'make test' part of build304 #---------------------------------------------------------------------305 if configuration['buildMethod']=='unixConfig' :306 NBlogMessages.writeMessage( ' make test' )307 result=NBosCommand.run('make test')308 stdoutfile=open('NBmaketest.stdout','w')309 stdoutfile.write(result['stdout'])310 stdoutfile.close()311 stderrfile=open('NBmaketest.stderr','w')312 stderrfile.write(result['stderr'])313 stderrfile.close()314 315 # Check if 'make test' worked316 for testFunc in configuration['checkMakeTest'] :317 testResultFail=testFunc(result,configuration['project'])318 if testResultFail :319 result['configure flags']=configOptions320 result['svn version']=configuration['svnVersion']321 result['make test']=testResultFail322 NBemail.sendCmdMsgs(configuration['project'],result,"make test")323 return324 309 325 310 if configuration['buildMethod']=='msSln' : … … 351 336 # Finally run vcbuild 352 337 result=NBosCommand.run(vcbuild) 353 stdoutfile=open('NBvcbuild.stdout','w') 354 stdoutfile.write(result['stdout']) 355 stdoutfile.close() 356 stderrfile=open('NBvcbuild.stderr','w') 357 stderrfile.write(result['stderr']) 358 stderrfile.close() 338 writeResults(result,'vcbuild') 359 339 360 340 # Check if vcbuild worked … … 366 346 367 347 #--------------------------------------------------------------------- 368 # Run unitTest if available and different from 'make test' 369 #--------------------------------------------------------------------- 370 if configuration['buildMethod']=='unixConfig' : 371 if "unitTest" in configuration : 372 unitTestRelPath=configuration['unitTest']['path'] 373 unitTestPath = os.path.join(fullBuildDir,unitTestRelPath) 374 os.chdir(unitTestPath) 375 NBlogMessages.writeMessage(' Current directory: '+unitTestPath) 376 377 unitTestCmdTemplate=configuration['unitTest']['command'] 378 379 dataBaseDir=os.path.join(configuration['rootDir'],'Data') 380 netlibDir=os.path.join(dataBaseDir,'Netlib') 381 miplib3Dir=os.path.join(dataBaseDir,'miplib3') 382 383 unitTestCmd=unitTestCmdTemplate.replace('_NETLIBDIR_',netlibDir) 384 unitTestCmd=unitTestCmd.replace('_MIPLIB3DIR_',miplib3Dir) 385 386 NBlogMessages.writeMessage( ' '+unitTestCmd ) 387 result=NBosCommand.run(unitTestCmd) 388 stdoutfile=open('NBunittest.stdout','w') 389 stdoutfile.write(result['stdout']) 390 stdoutfile.close() 391 stderrfile=open('NBunittest.stderr','w') 392 stderrfile.write(result['stderr']) 393 stderrfile.close() 394 395 for testFunc in configuration['unitTest']['checkUnitTest'] : 348 # Run all test executables 349 #--------------------------------------------------------------------- 350 if "test" in configuration : 351 for t in range( len(configuration['test']) ) : 352 testRelDir=configuration['test'][t]['dir'] 353 testDir = os.path.join(fullBuildDir,testRelDir) 354 os.chdir(testDir) 355 NBlogMessages.writeMessage(' Current directory: '+testDir) 356 357 testCmd=configuration['test'][t]['cmd'] 358 359 NBlogMessages.writeMessage( ' '+testCmd ) 360 result=NBosCommand.run(testCmd) 361 writeResults(result,testCmd) 362 363 for testFunc in configuration['test'][t]['check'] : 396 364 testResultFail=testFunc(result,configuration['project']) 397 365 if testResultFail : 398 result['configure flags']=configOptions399 366 result['svn version']=configuration['svnVersion'] 400 367 result['unitTest']=testResultFail 401 NBemail.sendCmdMsgs(configuration['project'],result, unitTestCmd)368 NBemail.sendCmdMsgs(configuration['project'],result,testCmd) 402 369 return 403 404 if configuration['buildMethod']=='msSln' :405 #---------------------------------------------------------------------406 # Run all test executables407 #---------------------------------------------------------------------408 if "test" in configuration :409 for t in range( len(configuration['test']) ) :410 testRelDir=configuration['test'][t]['dir']411 testDir = os.path.join(projectCheckOutDir,testRelDir)412 os.chdir(testDir)413 NBlogMessages.writeMessage(' Current directory: '+testDir)414 415 testCmd=configuration['test'][t]['cmd']416 417 NBlogMessages.writeMessage( ' '+testCmd )418 result=NBosCommand.run(testCmd)419 stdoutfile=open('NBtest.stdout','w')420 stdoutfile.write(result['stdout'])421 stdoutfile.close()422 stderrfile=open('NBtest.stderr','w')423 stderrfile.write(result['stderr'])424 stderrfile.close()425 426 for testFunc in configuration['test'][t]['check'] :427 testResultFail=testFunc(result,configuration['project'])428 if testResultFail :429 result['svn version']=configuration['svnVersion']430 result['unitTest']=testResultFail431 NBemail.sendCmdMsgs(configuration['project'],result,testCmd)432 return433 370 434 371 -
branches/testScripts/NBprojectConfig.py
r739 r740 16 16 #---------------------------------------------------------------------- 17 17 PROJECT_EMAIL_ADDRS = {} 18 UNITTEST_DIR = {}19 UNITTEST_CMD = {}20 ALL_TESTS_COMPLETED_SUCCESSFULLY_CMDS = {}21 CHECK_MAKE_TEST = {}22 CHECK_UNITTEST = {}23 18 SLN_BLD_TEST = {} 24 19 CFG_BLD_TEST = {} … … 26 21 27 22 28 29 23 #---------------------------------------------------------------------- 30 24 PROJECT_EMAIL_ADDRS['CoinUtils'] = 'ladanyi _AT_ us _DOT_ ibm _DOT_ com' 31 CHECK_MAKE_TEST['CoinUtils']=[NBcheckResult.rc0, 32 NBcheckResult.standardSuccessMessage] 25 33 26 CFG_BLD_TEST['CoinUtils']=[ 34 27 {'dir':'', … … 40 33 #---------------------------------------------------------------------- 41 34 PROJECT_EMAIL_ADDRS['DyLP'] = 'lou _AT_ cs _DOT_ sfu _DOT_ ca' 42 UNITTEST_DIR['DyLP'] = os.path.join('Osi','test')43 UNITTEST_CMD['DyLP'] = './unitTest -testOsiSolverInterface -netlibDir=_NETLIBDIR_ -cerr2cout'44 CHECK_MAKE_TEST['DyLP']=[45 NBcheckResult.rc0,46 NBcheckResult.standardSuccessMessage,47 NBcheckResult.noSolverInterfaceTestingIssueMessage]48 CHECK_UNITTEST['DyLP']=[49 NBcheckResult.rc0,50 NBcheckResult.standardSuccessMessage,51 NBcheckResult.noSolverInterfaceTestingIssueMessage]52 35 53 36 CFG_BLD_TEST['DyLP']=[ … … 61 44 'check':[ NBcheckResult.rc0, 62 45 NBcheckResult.standardSuccessMessage, 63 NBcheckResult.endWithWoodw,64 46 NBcheckResult.noSolverInterfaceTestingIssueMessage] } ] 65 47 … … 68 50 #---------------------------------------------------------------------- 69 51 PROJECT_EMAIL_ADDRS['Clp'] = 'jjforre _AT_ us _DOT_ ibm _DOT_ com' 70 UNITTEST_DIR['Clp'] = os.path.join('Clp','src')71 UNITTEST_CMD['Clp'] = './clp -unitTest -dirNetlib=_NETLIBDIR_ -netlib'72 CHECK_MAKE_TEST['Clp']=[73 NBcheckResult.rc0,74 NBcheckResult.standardSuccessMessage]75 CHECK_UNITTEST['Clp']=[76 NBcheckResult.rc0,77 NBcheckResult.standardSuccessMessage,78 NBcheckResult.endWithWoodw]79 52 80 53 CFG_BLD_TEST['Clp']=[ … … 102 75 #---------------------------------------------------------------------- 103 76 PROJECT_EMAIL_ADDRS['SYMPHONY'] = 'tkr2 _AT_ lehigh _DOT_ edu' 104 CHECK_MAKE_TEST['SYMPHONY']=[105 NBcheckResult.rc0,106 NBcheckResult.standardSuccessMessage]107 UNITTEST_DIR['SYMPHONY'] = '.'108 UNITTEST_CMD['SYMPHONY'] = 'make fulltest'109 CHECK_UNITTEST['SYMPHONY']=[110 NBcheckResult.rc0,111 NBcheckResult.standardSuccessMessage,112 ]113 77 CFG_BLD_TEST['SYMPHONY']=[ 114 78 {'dir':'', … … 130 94 #---------------------------------------------------------------------- 131 95 PROJECT_EMAIL_ADDRS['Vol'] = 'barahon _AT_ us _DOT_ ibm _DOT_ com' 132 CHECK_MAKE_TEST['Vol']=[133 NBcheckResult.rc0]134 96 CFG_BLD_TEST['Vol']=[ 135 97 {'dir':'', … … 140 102 #---------------------------------------------------------------------- 141 103 PROJECT_EMAIL_ADDRS['Osi'] = 'mjs _AT_ ces _DOT_ clemson _DOT_ edu' 142 UNITTEST_DIR['Osi'] = os.path.join('Osi','test')143 UNITTEST_CMD['Osi'] = './unitTest -testOsiSolverInterface -netlibDir=_NETLIBDIR_ -cerr2cout'144 CHECK_MAKE_TEST['Osi']=[145 NBcheckResult.rc0,146 NBcheckResult.standardSuccessMessage,147 NBcheckResult.noSolverInterfaceTestingIssueMessage]148 CHECK_UNITTEST['Osi']=[149 NBcheckResult.rc0,150 NBcheckResult.standardSuccessMessage,151 NBcheckResult.noSolverInterfaceTestingIssueMessage]152 104 CFG_BLD_TEST['Osi']=[ 153 105 {'dir':'', … … 172 124 #---------------------------------------------------------------------- 173 125 PROJECT_EMAIL_ADDRS['Cgl'] = 'robinlh _AT_ us _DOT_ ibm _DOT_ com' 174 CHECK_MAKE_TEST['Cgl']=[175 NBcheckResult.rc0,176 NBcheckResult.standardSuccessMessage]177 126 CFG_BLD_TEST['Cgl']=[ 178 127 {'dir':'', … … 184 133 #---------------------------------------------------------------------- 185 134 PROJECT_EMAIL_ADDRS['Cbc'] = 'jjforre _AT_ us _DOT_ ibm _DOT_ com' 186 UNITTEST_DIR['Cbc'] = os.path.join('Cbc','src')187 UNITTEST_CMD['Cbc'] = './cbc -unitTest -dirMiplib=_MIPLIB3DIR_ -miplib'188 CHECK_MAKE_TEST['Cbc']=[189 NBcheckResult.rc0,190 NBcheckResult.cbcMakeTestSuccessMessage]191 CHECK_UNITTEST['Cbc']=[ NBcheckResult.rc0to2 ]192 135 193 136 CFG_BLD_TEST['Cbc']=[ … … 210 153 #---------------------------------------------------------------------- 211 154 PROJECT_EMAIL_ADDRS['Ipopt'] = 'andreasw _AT_ us _DOT_ ibm _DOT_ com' 212 CHECK_MAKE_TEST['Ipopt']=[NBcheckResult.rc0 213 # ,NBcheckResult.standardSuccessMessage 214 ] 155 215 156 CFG_BLD_TEST['Ipopt']=[ 216 157 {'dir':'', … … 223 164 #---------------------------------------------------------------------- 224 165 PROJECT_EMAIL_ADDRS['Bonmin'] = 'pbonami _AT_ us _DOT_ ibm _DOT_ com' 225 CHECK_MAKE_TEST['Bonmin']=[NBcheckResult.rc0 226 ,NBcheckResult.standardSuccessMessage 227 ] 166 228 167 CFG_BLD_TEST['Bonmin']=[ 229 168 {'dir':'', … … 235 174 #---------------------------------------------------------------------- 236 175 PROJECT_EMAIL_ADDRS['FlopC++'] = 'Tim _DOT_ Hultberg _AT_ eumetsat _DOT_ int' 237 CHECK_MAKE_TEST['FlopC++']=[ 238 NBcheckResult.rc0, 239 NBcheckResult.standardSuccessMessage] 176 240 177 CFG_BLD_TEST['FlopC++']=[ 241 178 {'dir':'', … … 258 195 #---------------------------------------------------------------------- 259 196 PROJECT_EMAIL_ADDRS['OS'] = 'kipp _DOT_ martin _AT_ chicagogsb _DOT_ edu' 260 CHECK_MAKE_TEST['OS']=[261 NBcheckResult.rc0,262 NBcheckResult.standardSuccessMessage]197 #CHECK_MAKE_TEST['OS']=[ 198 # NBcheckResult.rc0, 199 # NBcheckResult.standardSuccessMessage] 263 200 CFG_BLD_TEST['OS']=[ 264 201 {'dir':'', … … 270 207 #---------------------------------------------------------------------- 271 208 PROJECT_EMAIL_ADDRS['CppAD'] = 'bradbell _AT_ washington _DOT_ edu' 272 CHECK_MAKE_TEST['CppAD']=[NBcheckResult.anythingGoes]273 UNITTEST_DIR['CppAD'] = os.path.join('.')274 UNITTEST_CMD['CppAD'] = './example/example'275 CHECK_UNITTEST['CppAD']=[NBcheckResult.rc0]276 209 277 210 CFG_BLD_TEST['CppAD']=[ … … 283 216 #---------------------------------------------------------------------- 284 217 PROJECT_EMAIL_ADDRS['Smi'] = 'kingaj _AT_ us _DOT_ ibm _DOT_ com' 285 CHECK_MAKE_TEST['Smi']=[ 286 NBcheckResult.rc0, 287 NBcheckResult.standardSuccessMessage] 218 288 219 CFG_BLD_TEST['Smi']=[ 289 220 {'dir':'', -
branches/testScripts/nightlyBuild.py
r739 r740 26 26 # TODO: 27 27 # -In userConfig allow one to optionally do a clean checkout and/or config 28 # -Clean up the kludge that tests if "make test" and 'unitTest' were29 # successfull30 28 # -Reduce size of email messages. 31 29 # -Get working on windows … … 172 170 if 'SkipProjects' in bc : 173 171 configuration['SkipProjects']=bc['SkipProjects'] 172 173 #--------------------------------------------------------------------- 174 # Set up test commands 175 #--------------------------------------------------------------------- 176 configuration['test']={} 177 if NBprojectConfig.CFG_BLD_TEST.has_key(p) : 178 configuration['test']=NBprojectConfig.CFG_BLD_TEST[p] 179 else : 180 # No test commands so remove from configuration 181 configuration.pop('test') 174 182 175 183 #--------------------------------------------------------------------- 176 184 # Setup checkMakeTest 177 185 #--------------------------------------------------------------------- 178 configuration['checkMakeTest']=NBprojectConfig.CHECK_MAKE_TEST[p]186 #configuration['checkMakeTest']=NBprojectConfig.CHECK_MAKE_TEST[p] 179 187 180 188 … … 182 190 # Set up unitTest 183 191 #--------------------------------------------------------------------- 184 configuration['unitTest']={}185 if NBprojectConfig.UNITTEST_CMD.has_key(p) :186 187 unitTestCmdTemplate=NBprojectConfig.UNITTEST_CMD[p]188 unitTestCmd=unitTestCmdTemplate.replace('_NETLIBDIR_',netlibDir)189 unitTestCmd=unitTestCmd.replace('_MIPLIB3DIR_',miplib3Dir)190 unitTestCmd=unitTestCmd.replace('_SAMPLEDIR_',sampleDir)191 192 configuration['unitTest']['command']=unitTestCmd193 configuration['unitTest']['checkUnitTest']=NBprojectConfig.CHECK_UNITTEST[p]194 configuration['unitTest']['path']=NBprojectConfig.UNITTEST_DIR[p]195 196 else :197 # No unitTest so remove from configuration198 configuration.pop('unitTest')192 #configuration['unitTest']={} 193 #if NBprojectConfig.UNITTEST_CMD.has_key(p) : 194 # 195 # unitTestCmdTemplate=NBprojectConfig.UNITTEST_CMD[p] 196 # unitTestCmd=unitTestCmdTemplate.replace('_NETLIBDIR_',netlibDir) 197 # unitTestCmd=unitTestCmd.replace('_MIPLIB3DIR_',miplib3Dir) 198 # unitTestCmd=unitTestCmd.replace('_SAMPLEDIR_',sampleDir) 199 # 200 # configuration['unitTest']['command']=unitTestCmd 201 # configuration['unitTest']['checkUnitTest']=NBprojectConfig.CHECK_UNITTEST[p] 202 # configuration['unitTest']['path']=NBprojectConfig.UNITTEST_DIR[p] 203 # 204 #else : 205 # # No unitTest so remove from configuration 206 # configuration.pop('unitTest') 199 207 200 208 if configuration['buildMethod']=='msSln' : … … 208 216 configuration['test']={} 209 217 if NBprojectConfig.SLN_BLD_TEST.has_key(p) : 210 211 218 configuration['test']=NBprojectConfig.SLN_BLD_TEST[p] 212 for t in range( len(configuration['test']) ) :213 testCmd=configuration['test'][t]['cmd']214 testCmd=testCmd.replace('_NETLIBDIR_',netlibDir)215 testCmd=testCmd.replace('_MIPLIB3DIR_',miplib3Dir)216 testCmd=testCmd.replace('_SAMPLEDIR_',sampleDir)217 configuration['test'][t]['cmd']=testCmd218 219 219 else : 220 220 # No test executables so remove from configuration 221 221 configuration.pop('test') 222 222 223 223 #--------------------------------------------------------------------- 224 224 # If solution file is not in standard place then specify it's location … … 229 229 else : 230 230 configuration.pop('slnFile') 231 232 #--------------------------------------------------------------------- 233 # Modify any executable commands to have location of data directories 234 #--------------------------------------------------------------------- 235 if configuration.has_key('test') : 236 for t in range( len(configuration['test']) ) : 237 testCmd=configuration['test'][t]['cmd'] 238 testCmd=testCmd.replace('_NETLIBDIR_',netlibDir) 239 testCmd=testCmd.replace('_MIPLIB3DIR_',miplib3Dir) 240 testCmd=testCmd.replace('_SAMPLEDIR_',sampleDir) 241 configuration['test'][t]['cmd']=testCmd 231 242 232 243 #--------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.