source: branches/testScripts/nightlyBuild.py @ 692

Last change on this file since 692 was 692, checked in by kmartin, 13 years ago

update files so NBuserConfig not needed

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