source: branches/testScripts/newNightlyBuild.py @ 673

Last change on this file since 673 was 673, checked in by jpfasano, 13 years ago

New version of nightlyBuild (newNightlyBuild) which is supposed to
build the coin projects as configured in BUILDS currently defined in
NBprojectConfig.py

  • Property svn:executable set to *
File size: 6.7 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#   -Store output of get.XXX calls, make, make test, configures... in some files.
23#   -Allow a fine configuration of which build tests to run per project.
24#   -Move actual [get project, configure, make, tests] part into an extra file.
25
26
27#------------------------------------------------------------------------
28#  Main Program Starts Here 
29#------------------------------------------------------------------------
30
31#------------------------------------------------------------------------
32#  If needed create the top level directory
33#------------------------------------------------------------------------
34if not os.path.isdir(NBuserConfig.NIGHTLY_BUILD_ROOT_DIR) :
35  os.makedirs(NBuserConfig.NIGHTLY_BUILD_ROOT_DIR)
36os.chdir(NBuserConfig.NIGHTLY_BUILD_ROOT_DIR)
37
38#------------------------------------------------------------------------
39#  Get the data directories if they don't already exist
40#------------------------------------------------------------------------
41dataBaseDir=os.path.join(NBuserConfig.NIGHTLY_BUILD_ROOT_DIR,'Data')
42if not os.path.isdir(dataBaseDir) :
43  os.makedirs(dataBaseDir)
44dataDirs=['Netlib','miplib3']
45for d in dataDirs :
46  dataDir=os.path.join(dataBaseDir,d)
47  if not os.path.isdir(dataDir) :
48    svnCmd=os.path.join(NBuserConfig.SVNPATH_PREFIX,'svn') + ' checkout https://projects.coin-or.org/svn/Data/releases/1.0.0/'+d+' '+d
49    if NBsvnCommand.run(svnCmd,dataBaseDir,'Data')!='OK' :
50      sys.exit(1)
51    result=NBosCommand.run('find '+d+' -name \*.gz -print | xargs gzip -d')
52netlibDir=os.path.join(dataBaseDir,'Netlib')
53miplib3Dir=os.path.join(dataBaseDir,'miplib3')
54
55#------------------------------------------------------------------------
56# Loop once for each project (get code, compile & link, and test).
57#------------------------------------------------------------------------
58configuration={}
59configuration['rootDir']=NBuserConfig.NIGHTLY_BUILD_ROOT_DIR
60#for p,buildConfigs in NBprojectConfig.BUILDS.iteritems():
61for p in NBuserConfig.PROJECTS :
62
63  configuration['project']=p
64
65  #------------------------------------------------------------------------
66  # Loop once for each build configuration of p
67  #------------------------------------------------------------------------
68  buildConfigs = NBprojectConfig.BUILDS[p]
69  for bc in buildConfigs:
70
71    #--------------------------------------------------------------------
72    # Does build reference another project's build configuration.
73    # If yes, then build p as specified by the reference project.
74    #--------------------------------------------------------------------
75    if 'Reference' in bc :
76      referencedConfigs = NBprojectConfig.BUILDS[ bc['Reference'] ]
77      for c in referencedConfigs :
78        buildConfigs.append(c)
79      continue
80
81    #--------------------------------------------------------------------
82    # Setup subversion verion
83    #--------------------------------------------------------------------
84    if 'SvnVersion' not in bc :
85      print 'Error. BUILDS does not contain SvnVersion'
86      print '       Project is '+p
87      print '       BuildConfig is '+str(bc)
88      sys.exit(1)
89    if bc['SvnVersion']=='latestStable' :
90      configuration['svnVersion']='stable/'+NBsvnCommand.latestStableVersion(p)
91    else:
92      configuration['svnVersion']=bc['SvnVersion']
93
94    #--------------------------------------------------------------------
95    # Setup usage of 3rd Party code
96    #--------------------------------------------------------------------
97    if 'noThirdParty' in configuration: configuration.pop('noThirdParty')
98    if 'ThirdParty' in bc:
99      if bc['ThirdParty'].lower()=='yes' :
100        configuration['noThirdParty']=False
101      else:
102        configuration['noThirdParty']=True
103
104    #--------------------------------------------------------------------
105    # Set config options
106    #--------------------------------------------------------------------
107    configuration['configOptions']=""
108    if 'OptLevel' not in bc :
109      print 'Error. BUILDS does not contain OptLevel'
110      print '       Project is '+p
111      print '       BuildConfig is '+str(bc)
112      sys.exit(1)
113    if bc['OptLevel']=='Debug' :
114      configuration['configOptions']+=" --enable-debug"
115    if 'AdditionalConfigOptions' in bc :
116      configuration['configOptions']+=" "+bc['AdditionalConfigOptios']
117
118    configuration['configOptions']+=" "+NBuserConfig.CONFIGURE_FLAGS
119
120    #--------------------------------------------------------------------
121    # Deal with coin projects to be skipped by ./config
122    #--------------------------------------------------------------------
123    if 'SkipProjects' in configuration: configuration.pop('SkipProjects')
124    if 'SkipProjects' in bc :
125      configuration['SkipProjects']=bc['SkipProjects']
126
127    #---------------------------------------------------------------------
128    # Setup checkMakeTest
129    #---------------------------------------------------------------------
130    configuration['checkMakeTest']=NBcheckResult.didTestFail
131
132
133    #---------------------------------------------------------------------
134    # Set up unitTest
135    #---------------------------------------------------------------------
136    configuration['unitTest']={}
137    if NBprojectConfig.UNITTEST_CMD.has_key(p) :
138
139      unitTestCmdTemplate=NBprojectConfig.UNITTEST_CMD[p]
140      unitTestCmd=unitTestCmdTemplate.replace('_NETLIBDIR_',netlibDir)
141      unitTestCmd=unitTestCmd.replace('_MIPLIB3DIR_',miplib3Dir)
142
143      configuration['unitTest']['command']=unitTestCmd
144      configuration['unitTest']['checkUnitTest']=NBcheckResult.didTestFail
145      configuration['unitTest']['path']=NBprojectConfig.UNITTEST_DIR[p]
146
147    else :
148      # No unitTest so remove from configuration
149      configuration.pop('unitTest')
150
151    #--------------------------------------------------
152    # Build & Test the configuration
153    #--------------------------------------------------
154    NBbuildConfig.run(configuration)
155
156
157NBlogMessages.writeMessage( "nightlyBuild.py Finished" )
158
159sys.exit(0)
160
Note: See TracBrowser for help on using the repository browser.