Changeset 645
- Timestamp:
- Oct 21, 2007 9:31:02 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/testScripts/nightlyBuild.py
r644 r645 59 59 60 60 #--------------------------------------------------------------------- 61 # svn checkout or update the project 61 # Loop once for each version of the project to be checked out. 62 # Presently this is only trunk, but it should optionally be 63 # latest stable and trunk 62 64 #--------------------------------------------------------------------- 63 projectBaseDir=os.path.join(NBuserConfig.NIGHTLY_BUILD_ROOT_DIR,p) 64 projectCheckOutDir=os.path.join(projectBaseDir,'trunk') 65 if not os.path.isdir(projectBaseDir) : 66 os.makedirs(projectBaseDir) 67 if not os.path.isdir(projectCheckOutDir) : 68 svnCmd=os.path.join(NBuserConfig.SVNPATH_PREFIX,'svn') + ' checkout https://projects.coin-or.org/svn/'+p+'/trunk trunk' 69 if NBsvnCommand.run(svnCmd,projectBaseDir,p)!='OK' : 70 continue 71 else : 72 svnCmd=os.path.join(NBuserConfig.SVNPATH_PREFIX,'svn') + ' update' 73 if NBsvnCommand.run(svnCmd,projectCheckOutDir,p)!='OK' : 74 continue 75 76 #--------------------------------------------------------------------- 77 # If there is are third part apps, then get these apps 78 #--------------------------------------------------------------------- 79 if NBuserConfig.DOWNLOAD_3RD_PARTY : 80 thirdPartyBaseDir=os.path.join(projectCheckOutDir,'ThirdParty') 81 if os.path.isdir(thirdPartyBaseDir) : 82 thirdPartyDirs = os.listdir(thirdPartyBaseDir) 83 for d in thirdPartyDirs : 84 thirdPartyDir=os.path.join(thirdPartyBaseDir,d) 85 install3rdPartyCmd=os.path.join(".","get."+d) 86 os.chdir(thirdPartyDir) 87 if os.path.isfile(install3rdPartyCmd) : 88 NBlogMessages.writeMessage(' '+install3rdPartyCmd) 89 NBosCommand.run(install3rdPartyCmd) 90 91 #--------------------------------------------------------------------- 92 # Should probably run make 'distclean' to do a build from scrath 93 # or delete the VPATH directory when there is one 94 #--------------------------------------------------------------------- 95 96 97 #--------------------------------------------------------------------- 98 # Setup the directory where the build will be done 99 #--------------------------------------------------------------------- 100 vpathDir = 'defaultBuild' 101 fullVpathDir = os.path.join(projectBaseDir,vpathDir) 102 #TODO: if (MAKE_CLEAN) : distutils.dir_util.remove_tree(fullVpathDir) 103 if not os.path.isdir(fullVpathDir) : os.mkdir(fullVpathDir) 104 print fullVpathDir 105 106 #--------------------------------------------------------------------- 107 # Run configure part of build (only if config has not previously 108 # ran successfully). 109 #--------------------------------------------------------------------- 110 os.chdir(fullVpathDir) 111 #configCmd = os.path.join('.','configure -C') 112 configCmd = os.path.join('.',projectCheckOutDir,"configure -C") 113 print configCmd 114 if NBcheckResult.didConfigRunOK() : 115 NBlogMessages.writeMessage(" '"+configCmd+"' previously ran. Not rerunning") 116 else : 117 NBlogMessages.writeMessage(' '+configCmd) 118 result=NBosCommand.run(configCmd) 119 120 # Check if configure worked 121 if result['returnCode'] != 0 : 122 error_msg = result 123 # Add contents of log file to message 124 logFileName = 'config.log' 125 if os.path.isfile(logFileName) : 126 logFilePtr = open(logFileName,'r') 127 error_msg['config.log'] = "config.log contains: \n" 128 error_msg['config.log'] += logFilePtr.read() 129 logFilePtr.close() 130 NBemail.sendCmdMsgs(p,error_msg,configCmd) 131 continue 132 133 #--------------------------------------------------------------------- 134 # Run make part of build 135 #--------------------------------------------------------------------- 136 NBlogMessages.writeMessage( ' make' ) 137 result=NBosCommand.run('make') 138 139 # Check if make worked 140 if result['returnCode'] != 0 : 141 NBemail.sendCmdMsgs(p,result,'make') 142 continue 143 144 #--------------------------------------------------------------------- 145 # Run 'make test' part of build 146 #--------------------------------------------------------------------- 147 NBlogMessages.writeMessage( ' make test' ) 148 result=NBosCommand.run('make test') 149 150 # Check if 'make test' worked 151 didMakeTestFail=NBcheckResult.didTestFail(result,p,"make test") 152 if didMakeTestFail : 153 result['make test']=didMakeTestFail 154 NBemail.sendCmdMsgs(p,result,"make test") 155 continue 156 157 #--------------------------------------------------------------------- 158 # Run unitTest if available and different from 'make test' 159 #--------------------------------------------------------------------- 160 if NBprojectConfig.UNITTEST_CMD.has_key(p) : 161 unitTestPath = os.path.join(fullVpathDir,NBprojectConfig.UNITTEST_DIR[p]) 162 os.chdir(unitTestPath) 163 print unitTestPath 164 165 unitTestCmdTemplate=NBprojectConfig.UNITTEST_CMD[p] 166 unitTestCmd=unitTestCmdTemplate.replace('_NETLIBDIR_',netlibDir) 167 unitTestCmd=unitTestCmd.replace('_MIPLIB3DIR_',miplib3Dir) 168 169 NBlogMessages.writeMessage( ' '+unitTestCmd ) 170 result=NBosCommand.run(unitTestCmd) 171 172 didUnitTestFail=NBcheckResult.didTestFail(result,p,unitTestCmdTemplate) 173 if didUnitTestFail : 174 result['unitTest']=didUnitTestFail 175 NBemail.sendCmdMsgs(p,result,unitTestCmd) 176 continue 177 178 # For testing purposes only do first successful project 179 #break 180 65 projectVersions=['trunk'] 66 for projectVersion in projectVersions : 67 #--------------------------------------------------------------------- 68 # svn checkout or update the project 69 #--------------------------------------------------------------------- 70 projectBaseDir=os.path.join(NBuserConfig.NIGHTLY_BUILD_ROOT_DIR,p) 71 projectCheckOutDir=os.path.join(projectBaseDir,projectVersion) 72 if not os.path.isdir(projectBaseDir) : 73 os.makedirs(projectBaseDir) 74 if not os.path.isdir(projectCheckOutDir) : 75 svnCmd=os.path.join(NBuserConfig.SVNPATH_PREFIX,'svn') +\ 76 ' checkout https://projects.coin-or.org/svn/'+p+'/'+projectVersion+' '+projectVersion 77 if NBsvnCommand.run(svnCmd,projectBaseDir,p)!='OK' : 78 continue 79 else : 80 svnCmd=os.path.join(NBuserConfig.SVNPATH_PREFIX,'svn') + ' update' 81 if NBsvnCommand.run(svnCmd,projectCheckOutDir,p)!='OK' : 82 continue 83 84 #--------------------------------------------------------------------- 85 # If there is are third part apps, then get these apps 86 #--------------------------------------------------------------------- 87 if NBuserConfig.DOWNLOAD_3RD_PARTY : 88 thirdPartyBaseDir=os.path.join(projectCheckOutDir,'ThirdParty') 89 if os.path.isdir(thirdPartyBaseDir) : 90 thirdPartyDirs = os.listdir(thirdPartyBaseDir) 91 for d in thirdPartyDirs : 92 thirdPartyDir=os.path.join(thirdPartyBaseDir,d) 93 install3rdPartyCmd=os.path.join(".","get."+d) 94 os.chdir(thirdPartyDir) 95 if os.path.isfile(install3rdPartyCmd) : 96 NBlogMessages.writeMessage(' '+install3rdPartyCmd) 97 NBosCommand.run(install3rdPartyCmd) 98 99 #--------------------------------------------------------------------- 100 # Loop once for each type of build to be done. 101 # Debug, use third party code, ... 102 # vpath and options to configure must be set for the buildType 103 #--------------------------------------------------------------------- 104 buildTypes=['Default','Debug'] 105 for buildType in buildTypes : 106 107 #--------------------------------------------------------------------- 108 # Setup the directory where the build will be done 109 #--------------------------------------------------------------------- 110 vpathDir = projectVersion+buildType 111 fullVpathDir = os.path.join(projectBaseDir,vpathDir) 112 #TODO: if (MAKE_CLEAN) : distutils.dir_util.remove_tree(fullVpathDir) 113 if not os.path.isdir(fullVpathDir) : os.mkdir(fullVpathDir) 114 print fullVpathDir 115 116 #--------------------------------------------------------------------- 117 # Run configure part of build (only if config has not previously 118 # ran successfully). 119 #--------------------------------------------------------------------- 120 os.chdir(fullVpathDir) 121 #configCmd = os.path.join('.','configure -C') 122 configCmd = os.path.join('.',projectCheckOutDir,"configure -C") 123 if buildType=='Debug' : configCmd += " --enable-debug" 124 print configCmd 125 if NBcheckResult.didConfigRunOK() : 126 NBlogMessages.writeMessage(" '"+configCmd+"' previously ran. Not rerunning") 127 else : 128 NBlogMessages.writeMessage(' '+configCmd) 129 result=NBosCommand.run(configCmd) 130 131 # Check if configure worked 132 if result['returnCode'] != 0 : 133 error_msg = result 134 # Add contents of log file to message 135 logFileName = 'config.log' 136 if os.path.isfile(logFileName) : 137 logFilePtr = open(logFileName,'r') 138 error_msg['config.log'] = "config.log contains: \n" 139 error_msg['config.log'] += logFilePtr.read() 140 logFilePtr.close() 141 NBemail.sendCmdMsgs(p,error_msg,configCmd) 142 continue 143 144 #--------------------------------------------------------------------- 145 # Run make part of build 146 #--------------------------------------------------------------------- 147 NBlogMessages.writeMessage( ' make' ) 148 result=NBosCommand.run('make') 149 150 # Check if make worked 151 if result['returnCode'] != 0 : 152 NBemail.sendCmdMsgs(p,result,'make') 153 continue 154 155 #--------------------------------------------------------------------- 156 # Run 'make test' part of build 157 #--------------------------------------------------------------------- 158 NBlogMessages.writeMessage( ' make test' ) 159 result=NBosCommand.run('make test') 160 161 # Check if 'make test' worked 162 didMakeTestFail=NBcheckResult.didTestFail(result,p,"make test") 163 if didMakeTestFail : 164 result['make test']=didMakeTestFail 165 NBemail.sendCmdMsgs(p,result,"make test") 166 continue 167 168 #--------------------------------------------------------------------- 169 # Run unitTest if available and different from 'make test' 170 #--------------------------------------------------------------------- 171 if NBprojectConfig.UNITTEST_CMD.has_key(p) : 172 unitTestPath = os.path.join(fullVpathDir,NBprojectConfig.UNITTEST_DIR[p]) 173 os.chdir(unitTestPath) 174 print unitTestPath 175 176 unitTestCmdTemplate=NBprojectConfig.UNITTEST_CMD[p] 177 unitTestCmd=unitTestCmdTemplate.replace('_NETLIBDIR_',netlibDir) 178 unitTestCmd=unitTestCmd.replace('_MIPLIB3DIR_',miplib3Dir) 179 180 NBlogMessages.writeMessage( ' '+unitTestCmd ) 181 result=NBosCommand.run(unitTestCmd) 182 183 didUnitTestFail=NBcheckResult.didTestFail(result,p,unitTestCmdTemplate) 184 if didUnitTestFail : 185 result['unitTest']=didUnitTestFail 186 NBemail.sendCmdMsgs(p,result,unitTestCmd) 187 continue 181 188 182 189 NBlogMessages.writeMessage( "nightlyBuild.py Finished" )
Note: See TracChangeset
for help on using the changeset viewer.