source: branches/testScripts/newNightlyBuild.py @ 681

Last change on this file since 681 was 681, checked in by jpfasano, 14 years ago

Added svn property svn:eol-style native

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 6.5 KB
Line 
1#!/usr/bin/env python
2
3import os
4import sys
5
6import NBuserConfig
7import NBprojectConfig
8import NBlogMessages
9import NBemail
10import NBosCommand
11import NBsvnCommand
12import NBcheckResult
13import NBbuildConfig
14
15# TODO:
16#   -Get some information about the platform and put this in email failure message.
17#   -In userConfig allow one to optionally do a clean checkout and/or config
18#   -Don't do build if 'svn update' doesn't change anything and prior test was OK.
19#     (no need to re-run if nothing has changed since prior run)
20#   -Skip make of project that depend on a project which make had been failing. (Similar for configure.)
21#    But also tell project managers of skiped project that their project was skipped.
22
23
24#------------------------------------------------------------------------
25#  Main Program Starts Here 
26#------------------------------------------------------------------------
27
28#------------------------------------------------------------------------
29#  If needed create the top level directory
30#------------------------------------------------------------------------
31if not os.path.isdir(NBuserConfig.NIGHTLY_BUILD_ROOT_DIR) :
32  os.makedirs(NBuserConfig.NIGHTLY_BUILD_ROOT_DIR)
33os.chdir(NBuserConfig.NIGHTLY_BUILD_ROOT_DIR)
34
35#------------------------------------------------------------------------
36#  Get the data directories if they don't already exist
37#------------------------------------------------------------------------
38dataBaseDir=os.path.join(NBuserConfig.NIGHTLY_BUILD_ROOT_DIR,'Data')
39if not os.path.isdir(dataBaseDir) :
40  os.makedirs(dataBaseDir)
41dataDirs=['Netlib','miplib3']
42for d in dataDirs :
43  dataDir=os.path.join(dataBaseDir,d)
44  if not os.path.isdir(dataDir) :
45    svnCmd=os.path.join(NBuserConfig.SVNPATH_PREFIX,'svn') + ' checkout https://projects.coin-or.org/svn/Data/releases/1.0.0/'+d+' '+d
46    if NBsvnCommand.run(svnCmd,dataBaseDir,'Data')!='OK' :
47      sys.exit(1)
48    result=NBosCommand.run('find '+d+' -name \*.gz -print | xargs gzip -d')
49netlibDir=os.path.join(dataBaseDir,'Netlib')
50miplib3Dir=os.path.join(dataBaseDir,'miplib3')
51
52#------------------------------------------------------------------------
53# Loop once for each project (get code, compile & link, and test).
54#------------------------------------------------------------------------
55configuration={}
56configuration['rootDir']=NBuserConfig.NIGHTLY_BUILD_ROOT_DIR
57#for p,buildConfigs in NBprojectConfig.BUILDS.iteritems():
58for p in NBuserConfig.PROJECTS :
59
60  configuration['project']=p
61
62  #------------------------------------------------------------------------
63  # Loop once for each build configuration of p
64  #------------------------------------------------------------------------
65  buildConfigs = NBprojectConfig.BUILDS[p]
66  for bc in buildConfigs:
67
68    #--------------------------------------------------------------------
69    # Does build reference another project's build configuration.
70    # If yes, then build p as specified by the reference project.
71    #--------------------------------------------------------------------
72    if 'Reference' in bc :
73      referencedConfigs = NBprojectConfig.BUILDS[ bc['Reference'] ]
74      for c in referencedConfigs :
75        buildConfigs.append(c)
76      continue
77
78    #--------------------------------------------------------------------
79    # Setup subversion verion
80    #--------------------------------------------------------------------
81    if 'SvnVersion' not in bc :
82      print 'Error. BUILDS does not contain SvnVersion'
83      print '       Project is '+p
84      print '       BuildConfig is '+str(bc)
85      sys.exit(1)
86    if bc['SvnVersion']=='latestStable' :
87      configuration['svnVersion']='stable/'+NBsvnCommand.latestStableVersion(p)
88    else:
89      configuration['svnVersion']=bc['SvnVersion']
90
91    #--------------------------------------------------------------------
92    # Setup usage of 3rd Party code
93    #--------------------------------------------------------------------
94    if 'noThirdParty' in configuration: configuration.pop('noThirdParty')
95    if 'ThirdParty' in bc:
96      if bc['ThirdParty'].lower()=='yes' :
97        configuration['noThirdParty']=False
98      else:
99        configuration['noThirdParty']=True
100
101    #--------------------------------------------------------------------
102    # Set config options
103    #--------------------------------------------------------------------
104    configuration['configOptions']={}
105    configuration['configOptions']['unique']=""
106    configuration['configOptions']['invariant']=""
107    if 'OptLevel' not in bc :
108      print 'Error. BUILDS does not contain OptLevel'
109      print '       Project is '+p
110      print '       BuildConfig is '+str(bc)
111      sys.exit(1)
112    if bc['OptLevel']=='Debug' :
113      configuration['configOptions']['unique']+=" --enable-debug"
114    if 'AdditionalConfigOptions' in bc :
115      configuration['configOptions']['unique']+=" "+bc['AdditionalConfigOptions']
116
117    configuration['configOptions']['invariant']+=" "+NBuserConfig.CONFIGURE_FLAGS
118
119    #--------------------------------------------------------------------
120    # Deal with coin projects to be skipped by ./config
121    #--------------------------------------------------------------------
122    if 'SkipProjects' in configuration: configuration.pop('SkipProjects')
123    if 'SkipProjects' in bc :
124      configuration['SkipProjects']=bc['SkipProjects']
125
126    #---------------------------------------------------------------------
127    # Setup checkMakeTest
128    #---------------------------------------------------------------------
129    configuration['checkMakeTest']=NBcheckResult.didTestFail
130
131
132    #---------------------------------------------------------------------
133    # Set up unitTest
134    #---------------------------------------------------------------------
135    configuration['unitTest']={}
136    if NBprojectConfig.UNITTEST_CMD.has_key(p) :
137
138      unitTestCmdTemplate=NBprojectConfig.UNITTEST_CMD[p]
139      unitTestCmd=unitTestCmdTemplate.replace('_NETLIBDIR_',netlibDir)
140      unitTestCmd=unitTestCmd.replace('_MIPLIB3DIR_',miplib3Dir)
141
142      configuration['unitTest']['command']=unitTestCmd
143      configuration['unitTest']['checkUnitTest']=NBcheckResult.didTestFail
144      configuration['unitTest']['path']=NBprojectConfig.UNITTEST_DIR[p]
145
146    else :
147      # No unitTest so remove from configuration
148      configuration.pop('unitTest')
149
150    #--------------------------------------------------
151    # Build & Test the configuration
152    #--------------------------------------------------
153    NBbuildConfig.run(configuration)
154
155
156NBlogMessages.writeMessage( "nightlyBuild.py Finished" )
157
158sys.exit(0)
159
Note: See TracBrowser for help on using the repository browser.