Changeset 614


Ignore:
Timestamp:
Oct 15, 2007 9:31:10 AM (12 years ago)
Author:
jpfasano
Message:

Started process of breaking code up into several files(modules in python speak)
Project and User variables are now defined in their own files.

Location:
branches/testScripts
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • branches/testScripts/nightlyBuild.py

    r613 r614  
    77import re
    88import time
     9
     10import NBuserConfig
     11import NBprojectConfig
    912
    1013# TODO:
     
    2124#     to test on in an email dated 10/12/2007 12:01pm
    2225
    23 #----------------------------------------------------------------------
    24 # NIGHTLY_BUILD_ROOT_DIR:
    25 #   directory where code will be checked out and builds
    26 #   done. If the directory does not exist, it will be created.
    27 #----------------------------------------------------------------------
    28 NIGHTLY_BUILD_ROOT_DIR = '/home/jp/COIN'
    29 
    30 #----------------------------------------------------------------------
    31 # Values for sending mail:
    32 #  SMTP_SERVER_NAME: name of smtp server. For gmail server
    33 #                 this is smtp.gmail.com
    34 #  SMTP_SERVER_PORT: port number of the smtp server. This is typically 25,
    35 #                 but for gmail server it is 587.
    36 #  SMTP_SSL_SERVER: 0 or 1. If 1 then SMTP uses SSL (sometimes called startltls).
    37 #                 For gmail this is 1.
    38 #  SMTP_USER_NAME: name of authorized user on server. If using gmail server
    39 #                 this is gmail_userid@gmail.com which is coded as
    40 #                 'gmail_userid _AT_ gmail _DOT_ com. 
    41 #  SMTP_PASSWORD_FILENAME: name of file containing smtp user's password
    42 #  SENDER_EMAIL_ADDR: email sent by this script will be from this address
    43 #  MY_EMAIL_ADDR: All problems detected by the script will be sent to
    44 #                 this email address. The intention is for this to be
    45 #                 the email address of the person running this script
    46 #  SEND_MAIL_TO_PROJECT_MANAGER: 0 or 1. If 1 then any problems
    47 #                 detected are sent to MY_EMAIL_ADDRESS and the
    48 #                 project manager.
    49 #----------------------------------------------------------------------
    50 #SMTP_SERVER_NAME = 'outgoing.verizon.net'
    51 #SMTP_SERVER_PORT = 25
    52 #SMTP_SSL_SERVER = 0
    53 #SMTP_USER_NAME = 'jpfasano'
    54 
    55 SMTP_SERVER_NAME = 'smtp.gmail.com'
    56 SMTP_SERVER_PORT = 587
    57 SMTP_SSL_SERVER = 1
    58 SMTP_USER_NAME = 'jpfasano _AT_ gmail _DOT_ com'
    59 SMTP_PASSWORD_FILENAME = '/home/jp/bin/smtpPwFile'
    60 
    61 SENDER_EMAIL_ADDR='jpfasano _AT_ verizon _DOT_ net'
    62 MY_EMAIL_ADDR='jpfasano _AT_ us _DOT_ ibm _DOT_ com'
    63 SEND_MAIL_TO_PROJECT_MANAGER=0
    64 #SMTP_SERVER_NAME = 'gsbims.chicagogsb.edu'
    65 
    66 
    67 #----------------------------------------------------------------------
    68 # List of Projects to be processed by script
    69 #----------------------------------------------------------------------
    70 PROJECTS = ['CoinUtils','DyLP','Clp','SYMPHONY','Vol','Osi','Cgl','Cbc','Ipopt','OS','CppAD']
    71 #PROJECTS = ['CppAD']
    72 
    73 #----------------------------------------------------------------------
    74 PROJECT_EMAIL_ADDRS = {}
    75 UNITTEST_DIR = {}
    76 UNITTEST_CMD = {}
    77 ALL_TESTS_COMPLETED_SUCCESSFULLY_CMDS = {}
    78 
    79 #----------------------------------------------------------------------
    80 PROJECT_EMAIL_ADDRS['CoinUtils'] = 'ladanyi _AT_ us _DOT_ ibm _DOT_ com'
    81 ALL_TESTS_COMPLETED_SUCCESSFULLY_CMDS['CoinUtils'] = ['make test']
    82 
    83 #----------------------------------------------------------------------
    84 PROJECT_EMAIL_ADDRS['DyLP'] = 'lou _AT_ cs _DOT_ sfu _DOT_ ca'
    85 UNITTEST_DIR['DyLP'] = os.path.join('Osi','test')
    86 UNITTEST_CMD['DyLP'] = './unitTest -testOsiSolverInterface -netlibDir=_NETLIBDIR_ -cerr2cout'
    87 ALL_TESTS_COMPLETED_SUCCESSFULLY_CMDS['DyLP'] = ['make test']
    88 
    89 #----------------------------------------------------------------------
    90 PROJECT_EMAIL_ADDRS['Clp'] = 'jjforre _AT_ us _DOT_ ibm _DOT_ com'
    91 UNITTEST_DIR['Clp'] = os.path.join('Clp','src')
    92 UNITTEST_CMD['Clp'] = './clp -unitTest -netlib dirNetlib=_NETLIBDIR_'
    93 ALL_TESTS_COMPLETED_SUCCESSFULLY_CMDS['Clp'] = ['make test',UNITTEST_CMD['Clp']]
    94 
    95 #----------------------------------------------------------------------
    96 PROJECT_EMAIL_ADDRS['SYMPHONY'] = 'tkr2 _AT_ lehigh _DOT_ edu'
    97 ALL_TESTS_COMPLETED_SUCCESSFULLY_CMDS['SYMPHONY'] = ['make test']
    98 
    99 #----------------------------------------------------------------------
    100 PROJECT_EMAIL_ADDRS['Vol'] = 'barahon _AT_ us _DOT_ ibm _DOT_ com'
    101 
    102 #----------------------------------------------------------------------
    103 PROJECT_EMAIL_ADDRS['Osi'] = 'mjs _AT_ ces _DOT_ clemson _DOT_ edu'
    104 UNITTEST_DIR['Osi'] = os.path.join('Osi','test')
    105 UNITTEST_CMD['Osi'] = './unitTest -testOsiSolverInterface'
    106 UNITTEST_CMD['Osi'] = './unitTest -testOsiSolverInterface -netlibDir=_NETLIBDIR_ -cerr2cout'
    107 ALL_TESTS_COMPLETED_SUCCESSFULLY_CMDS['Osi'] = ['make test',UNITTEST_CMD['Osi']]
    108 
    109 #----------------------------------------------------------------------
    110 PROJECT_EMAIL_ADDRS['Cgl'] = 'robinlh _AT_ us _DOT_ ibm _DOT_ com'
    111 ALL_TESTS_COMPLETED_SUCCESSFULLY_CMDS['Cgl'] = ['make test']
    112 
    113 #----------------------------------------------------------------------
    114 PROJECT_EMAIL_ADDRS['Cbc'] = 'jjforre _AT_ us _DOT_ ibm _DOT_ com'
    115 
    116 #----------------------------------------------------------------------
    117 PROJECT_EMAIL_ADDRS['Ipopt'] = 'andreasw _AT_ us _DOT_ ibm _DOT_ com'
    118 
    119 #----------------------------------------------------------------------
    120 PROJECT_EMAIL_ADDRS['OS'] = 'kipp _DOT_ martin _AT_ chicagogsb _DOT_ edu'
    121 
    122 #----------------------------------------------------------------------
    123 PROJECT_EMAIL_ADDRS['CppAD'] = 'bradbell _AT_ washington _DOT_ edu'
    12426
    12527#------------------------------------------------------------------------
     
    13436  curDir = os.getcwd()
    13537 
    136   toAddrs = [unscrambleEmailAddress(MY_EMAIL_ADDR)]
    137   if PROJECT_EMAIL_ADDRS.has_key(project) and SEND_MAIL_TO_PROJECT_MANAGER:
    138     toAddrs.append(unscrambleEmailAddress(PROJECT_EMAIL_ADDRS[project]))
     38  toAddrs = [unscrambleEmailAddress(NBuserConfig.MY_EMAIL_ADDR)]
     39  if NBprojectConfig.PROJECT_EMAIL_ADDRS.has_key(project) and NBuserConfig.SEND_MAIL_TO_PROJECT_MANAGER:
     40    toAddrs.append(unscrambleEmailAddress(NBprojectConfig.PROJECT_EMAIL_ADDRS[project]))
    13941
    14042  subject = project + " build problem when running '" + cmd +"'"
     
    15254def sendEmail(toAddrs,subject,message):
    15355
    154   sender = unscrambleEmailAddress(SENDER_EMAIL_ADDR) 
     56  sender = unscrambleEmailAddress(NBuserConfig.SENDER_EMAIL_ADDR) 
    15557  msgWHeader = ("From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n"
    15658       % (sender, ", ".join(toAddrs), subject))
     
    15860 
    15961  # Get smpt server password
    160   if os.path.isfile(SMTP_PASSWORD_FILENAME) :
    161     pwFilePtr = open(SMTP_PASSWORD_FILENAME,'r')
     62  if os.path.isfile(NBuserConfig.SMTP_PASSWORD_FILENAME) :
     63    pwFilePtr = open(NBuserConfig.SMTP_PASSWORD_FILENAME,'r')
    16264    smtppass  = pwFilePtr.read().strip()
    16365    pwFilePtr.close()
    16466  else :
    165     writeLogMessage( "Failure reading pwFileName=" + SMTP_PASSWORD_FILENAME )
     67    writeLogMessage( "Failure reading pwFileName=" + NBuserConfig.SMTP_PASSWORD_FILENAME )
    16668    sys.exit(1)
    16769   
    168   session = smtplib.SMTP(SMTP_SERVER_NAME,SMTP_SERVER_PORT)
     70  session = smtplib.SMTP(NBuserConfig.SMTP_SERVER_NAME,NBuserConfig.SMTP_SERVER_PORT)
    16971  #session.set_debuglevel(1)
    170   if SMTP_SSL_SERVER==1 :
     72  if NBuserConfig.SMTP_SSL_SERVER==1 :
    17173    session.ehlo('x')
    17274    session.starttls()
    17375    session.ehlo('x') 
    174   session.login(unscrambleEmailAddress(SMTP_USER_NAME),smtppass)
     76  session.login(unscrambleEmailAddress(NBuserConfig.SMTP_USER_NAME),smtppass)
    17577
    17678  rc = session.sendmail(sender,toAddrs,msgWHeader)
     
    201103  # Many tests write a "Success" message.
    202104  # For test that do this, check for the success message
    203   if ALL_TESTS_COMPLETED_SUCCESSFULLY_CMDS.has_key(project) :
    204     if buildStep in ALL_TESTS_COMPLETED_SUCCESSFULLY_CMDS[project] :
     105  if NBprojectConfig.ALL_TESTS_COMPLETED_SUCCESSFULLY_CMDS.has_key(project) :
     106    if buildStep in NBprojectConfig.ALL_TESTS_COMPLETED_SUCCESSFULLY_CMDS[project] :
    205107      # Is the success message contained in the output?
    206108      if rc[1].rfind("All tests completed successfully") == -1 :
     
    213115  #---------------------------------------------------------------------
    214116  # Clp's "./clp -unitTest -netlib dirNetlib=_NETLIBDIR_"
    215   if project=='Clp' and buildStep==UNITTEST_CMD['Clp'] :
     117  if project=='Clp' and buildStep==NBprojectConfig.UNITTEST_CMD['Clp'] :
    216118    # Check that last netlib test case ran by looking for message of form
    217119    # '../../Data/Netlib/woodw took 0.47 seconds using algorithm either'
     
    260162#  If needed create the top level directory
    261163#------------------------------------------------------------------------
    262 # rc=commands.getstatusoutput(NIGHTLY_BUILD_ROOT_DIR)
    263 if not os.path.isdir(NIGHTLY_BUILD_ROOT_DIR) :
    264   os.makedirs(NIGHTLY_BUILD_ROOT_DIR)
    265 os.chdir(NIGHTLY_BUILD_ROOT_DIR)
     164# rc=commands.getstatusoutput(NBuserConfig.NIGHTLY_BUILD_ROOT_DIR)
     165if not os.path.isdir(NBuserConfig.NIGHTLY_BUILD_ROOT_DIR) :
     166  os.makedirs(NBuserConfig.NIGHTLY_BUILD_ROOT_DIR)
     167os.chdir(NBuserConfig.NIGHTLY_BUILD_ROOT_DIR)
    266168
    267169#------------------------------------------------------------------------
    268170#  Get the data directories if they don't already exist
    269171#------------------------------------------------------------------------
    270 dataBaseDir=os.path.join(NIGHTLY_BUILD_ROOT_DIR,'Data')
     172dataBaseDir=os.path.join(NBuserConfig.NIGHTLY_BUILD_ROOT_DIR,'Data')
    271173if not os.path.isdir(dataBaseDir) :
    272174  os.makedirs(dataBaseDir)
     
    285187# Loop once for each project
    286188#------------------------------------------------------------------------
    287 for p in PROJECTS:
     189for p in NBuserConfig.PROJECTS:
    288190  writeLogMessage( p )
    289191  rc = [0]
     
    292194  # svn checkout or update the project
    293195  #---------------------------------------------------------------------
    294   projectBaseDir=os.path.join(NIGHTLY_BUILD_ROOT_DIR,p)
     196  projectBaseDir=os.path.join(NBuserConfig.NIGHTLY_BUILD_ROOT_DIR,p)
    295197  projectCheckOutDir=os.path.join(projectBaseDir,'trunk')
    296198  if not os.path.isdir(projectBaseDir) :
     
    357259  # Run unitTest if available and different from 'make test'
    358260  #---------------------------------------------------------------------
    359   if UNITTEST_CMD.has_key(p) :
    360     unitTestPath = os.path.join(projectCheckOutDir,UNITTEST_DIR[p])
     261  if NBprojectConfig.UNITTEST_CMD.has_key(p) :
     262    unitTestPath = os.path.join(projectCheckOutDir,NBprojectConfig.UNITTEST_DIR[p])
    361263    os.chdir(unitTestPath)
    362264
    363     unitTestCmd=UNITTEST_CMD[p]
     265    unitTestCmd=NBprojectConfig.UNITTEST_CMD[p]
    364266    unitTestCmd=unitTestCmd.replace('_NETLIBDIR_',netlibDir)
    365267    unitTestCmd=unitTestCmd.replace('_MIPLIB3DIR_',miplib3Dir)
     
    389291#   it should have values for
    390292#   NIGHTLY_BUILD_ROOT
    391 #   SMTP_SERVER_NAME
    392 #   SMTP_SERVER_PORT
    393 #   SMTP_SSL_SERVER
    394 #   SMTP_USER_NAME
    395 #   SMTP_PASSWORD_FILENAME = '/home/jp/bin/smtpPwFile'
    396 #   SENDER_EMAIL_ADDR='jpfasano _AT_ verizon _DOT_ net'
    397 #   MY_EMAIL_ADDR='jpfasano _AT_ us _DOT_ ibm _DOT_ com'
     293#   NBuserConfig.SMTP_SERVER_NAME
     294#   NBuserConfig.SMTP_SERVER_PORT
     295#   NBuserConfig.SMTP_SSL_SERVER
     296#   NBuserConfig.SMTP_USER_NAME
     297#   NBuserConfig.SMTP_PASSWORD_FILENAME = '/home/jp/bin/smtpPwFile'
     298#   NBuserConfig.SENDER_EMAIL_ADDR='jpfasano _AT_ verizon _DOT_ net'
     299#   NBuserConfig.MY_EMAIL_ADDR='jpfasano _AT_ us _DOT_ ibm _DOT_ com'
    398300#   
    399301#----------------------------------------------------------------------
     
    434336#   it should have values for
    435337#   NIGHTLY_BUILD_ROOT
    436 #   SMTP_SERVER_NAME
    437 #   SMTP_SERVER_PORT
    438 #   SMTP_SSL_SERVER
    439 #   SMTP_USER_NAME
    440 #   SMTP_PASSWORD_FILENAME
    441 #   SENDER_EMAIL_ADDR
    442 #   MY_EMAIL_ADDR
     338#   NBuserConfig.SMTP_SERVER_NAME
     339#   NBuserConfig.SMTP_SERVER_PORT
     340#   NBuserConfig.SMTP_SSL_SERVER
     341#   NBuserConfig.SMTP_USER_NAME
     342#   NBuserConfig.SMTP_PASSWORD_FILENAME
     343#   NBuserConfig.SENDER_EMAIL_ADDR
     344#   NBuserConfig.MY_EMAIL_ADDR
    443345#   
    444346#----------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.