Changeset 633


Ignore:
Timestamp:
Oct 17, 2007 10:38:59 PM (12 years ago)
Author:
jpfasano
Message:

Created new file(module) for checking the results to see if a test
was successfull. This code was moved out of nightlyBuild.py.
Added code to test if DyLP and Osi were successful based on email from
Lou.

Location:
branches/testScripts
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • branches/testScripts/nightlyBuild.py

    r630 r633  
    33import os
    44import sys
    5 import re
    65
    76import NBuserConfig
     
    1110import NBosCommand
    1211import NBsvnCommand
     12import NBcheckResult
    1313
    1414# TODO:
     
    2626
    2727
    28 
    29 #------------------------------------------------------------------------
    30 # Function to Check Return Code from unitTest
    31 #------------------------------------------------------------------------
    32 def didTestFail( result, project, buildStep ) :
    33   retVal = 0
    34 
    35   # If the return code is not 0, then failure
    36   if result['returnCode'] != 0 :
    37     retVal = 1
    38 
    39   # Many tests write a "Success" message.
    40   # For test that do this, check for the success message
    41   if NBprojectConfig.ALL_TESTS_COMPLETED_SUCCESSFULLY_CMDS.has_key(project) :
    42     if buildStep in NBprojectConfig.ALL_TESTS_COMPLETED_SUCCESSFULLY_CMDS[project] :
    43       # Is the success message contained in the output?
    44       if result['stderr'].rfind("All tests completed successfully") == -1 and \
    45          result['stdout'].rfind("All tests completed successfully") == -1 :
    46         # Success message not found, assume test failed
    47         retVal = 1
    48 
    49   #---------------------------------------------------------------------
    50   # Some (project,buildStep) pairs require further checking
    51   # to determine if they were successful
    52   #---------------------------------------------------------------------
    53   # Clp's "./clp -unitTest dirNetlib=_NETLIBDIR_ -netlib"
    54   if project=='Clp' and buildStep==NBprojectConfig.UNITTEST_CMD['Clp'] :
    55     # Check that last netlib test case ran by looking for message of form
    56     # '../../Data/Netlib/woodw took 0.47 seconds using algorithm either'
    57     reexp = r"(.|\n)*(\\|/)Data(\\|/)Netlib(\\|/)woodw took (\d*\.\d*) seconds using algorithm either(.|\n)*"
    58     msgTail = result['stdout'][-200:]
    59     if not re.compile(reexp).match(msgTail,1) :
    60       # message not found, assume test failed
    61       retVal = 1
    62      
    63   # Cbc's "make test"
    64   elif project=='Cbc' and buildStep=='make test' :
    65     # Check that last the last few lines are of the form
    66     # 'cbc_clp solved 2 out of 2 and took XX.XX seconds.'
    67     reexp=r"(.|\n)*cbc_clp solved 2 out of 2 and took (\d*\.\d*) seconds."
    68     msgTail = result['stdout'][-300:]
    69     if not re.compile(reexp).match(msgTail,1) :
    70       # message not found, assume test failed
    71       retVal = 1
    72 
    73   # Cbc's "./cbc -unitTest dirNetlib=_MIPLIB3DIR_ -miplib"
    74   elif project=='Cbc' and buildStep==NBprojectConfig.UNITTEST_CMD['Cbc'] :
    75     if result['returnCode']>=0 and result['returnCode']<=2 :
    76       # return code is between 0 and 2.
    77       # Return code between 1 and 44 is the number of test cases that
    78       # ended because maxnodes limit reached.  John Forrest says if this
    79       # is less than 3, the OK.
    80       retVal=0
    81     else :
    82       retVal=1
    83 
    84   return retVal
    8528
    8629#------------------------------------------------------------------------
     
    14588  os.chdir(projectCheckOutDir)
    14689  configCmd = os.path.join('.','configure -C')
    147   NBlogMessages.writeMessage('  '+configCmd)
    148   result=NBosCommand.run(configCmd)
    149  
    150   # Check if configure worked
    151   if result['returnCode'] != 0 :
    152     error_msg = result
    153     # Add contents of log file to message
    154     logFileName = 'config.log'
    155     if os.path.isfile(logFileName) :
    156       logFilePtr = open(logFileName,'r')
    157       error_msg['config.log']  = "config.log contains: \n"
    158       error_msg['config.log'] += logFilePtr.read()
    159       logFilePtr.close()
    160     NBemail.sendCmdMsgs(p,error_msg,configCmd)
    161     continue
     90  if NBcheckResult.didConfigRunOK() :
     91    NBlogMessages.writeMessage("  '"+configCmd+"' previously ran. Not rerunning")
     92  else :
     93    NBlogMessages.writeMessage('  '+configCmd)
     94    result=NBosCommand.run(configCmd)
     95 
     96    # Check if configure worked
     97    if result['returnCode'] != 0 :
     98      error_msg = result
     99      # Add contents of log file to message
     100      logFileName = 'config.log'
     101      if os.path.isfile(logFileName) :
     102        logFilePtr = open(logFileName,'r')
     103        error_msg['config.log']  = "config.log contains: \n"
     104        error_msg['config.log'] += logFilePtr.read()
     105        logFilePtr.close()
     106      NBemail.sendCmdMsgs(p,error_msg,configCmd)
     107      continue
    162108
    163109  #---------------------------------------------------------------------
     
    179125 
    180126  # Check if 'make test' worked
    181   if didTestFail(result,p,"make test") :
     127  if NBcheckResult.didTestFail(result,p,"make test") :
    182128    NBemail.sendCmdMsgs(p,result,"make test")
    183129    continue
     
    197143    result=NBosCommand.run(unitTestCmd)
    198144 
    199     if didTestFail(result,p,unitTestCmdTemplate) :
     145    if NBcheckResult.didTestFail(result,p,unitTestCmdTemplate) :
    200146      NBemail.sendCmdMsgs(p,result,unitTestCmd)
    201147      continue
Note: See TracChangeset for help on using the changeset viewer.