mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

gary_williams
11.05.2007 2d8669c190018f4662039e9da1dd098d183baa89
Issue 1120 test results and logs must go into a unique folder
6 files modified
103 ■■■■ changed files
opends/tests/functional-tests/config/config.py 2 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/shared/functions/environment.xml 42 ●●●● patch | view | raw | blame | history
opends/tests/functional-tests/shared/functions/utils.xml 2 ●●● patch | view | raw | blame | history
opends/tests/functional-tests/shared/python/common.py 9 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/staf-installer/config.py.stubs 2 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/runTestJob.xml 46 ●●●● patch | view | raw | blame | history
opends/tests/functional-tests/config/config.py
@@ -29,5 +29,7 @@
STAGED_DATA_DIR             = '%s/functional-tests/shared/data' % DIRECTORY_INSTANCE_DIR
LOCAL_DATA_DIR          = '%s/functional-tests/shared/data' % TMPDIR
JAVA_HOME                   = '/usr/jdk/jdk1.5.0_01'
LOGS_ROOT                   = '%s' % TMPDIR
LOGS_URI                    = ''
SEND_MAIL_AFTER_TEST_RUN    = 'FALSE'
SEND_MAIL_TO                = ' '
opends/tests/functional-tests/shared/functions/environment.xml
@@ -121,7 +121,6 @@
      <!-- XXXX this needs some cleanup XXXX -->
      <script>
        STAXLogMessage = 1 
        LogDir='%s' % TMPDIR
        SRCFILE = '%s/%s' % (ZIPPATH,ZIPNAME) 
        DSTFILE = '%s/%s' % (TMPDIR,ZIPNAME)
        OPENDS_BINPATH ='%s/%s/bin' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME) 
@@ -208,7 +207,7 @@
        <call function="'SetVar'">
          { 'location'  : STAF_REMOTE_HOSTNAME,
            'type'      : 'shared',
            'variable'  : 'ServerInfo=%s' % DSInfoServersDict }
            'variable'  : 'Job%s_ServerInfo=%s' % (STAXJobID,DSInfoServersDict) }
        </call>
        <if expr="RC != 0">
@@ -257,6 +256,39 @@
        
  </function>
    
  <function name="SetLogsDir">
    <function-prolog>
      This function sets the directory to which logs are written
    </function-prolog>
    <sequence>
      <script>
        logsDate=strftime("%Y%m%d-%H:%M:%S",localtime())
        logsArch=DSInfo.getServerArch(DSInfo.ServerDict['system os'])
        logsOSName=DSInfo.getServerOSName(DSInfo.ServerDict['system os'])
        logsOS='%s-%s' % (logsOSName,logsArch)
        logsJvm=DSInfo.getServerJavaMajorMinor(DSInfo.ServerDict['java version'])
        logsDir='%s/%s/%s-jvm%s' % (LOGS_ROOT,logsDate,logsOS,logsJvm)
        logsTestsDir='%s/testlogs' % logsDir
        logsReportDir='%s/reports' % logsDir
        logsSUTDir='%s/sutlogs' % logsDir
        logsTmpDir='%s/tmp' % logsDir
      </script>
      <message>
        'Tests logs output set to %s' % logsDir
      </message>
      <call function="'SetVar'">
        { 'location'  : STAF_REMOTE_HOSTNAME,
          'type'      : 'shared',
          'variable'  : 'Job%s_LogsDir=%s' % (STAXJobID,logsDir) }
      </call>
    </sequence>
  </function>
    
  <function name="loadEnvironment">
    <function-prolog>
@@ -276,12 +308,10 @@
        
      <call function="'initialiseGlobalVariables'"/>
                
<!--
      <call function="'prepareInstanceCreation'"></call>
-->
      <call function="'GetDirectoryServerInformation'"/>
                            
      <call function="'SetLogsDir'"/>
      <call function="'checkRC'">
        { 'returncode' : RC ,
          'result'     : STAXResult }
opends/tests/functional-tests/shared/functions/utils.xml
@@ -559,7 +559,7 @@
        FormattedTestgroup=FormattedTestcase.group(ThisGroupName)         
        FormattedTestsuite=FormattedTestcase.suite(ThisSuiteName)
             
        TestLogDir= '%s/%s' % (LogDir,FormattedTestgroup)
        TestLogDir= '%s/%s' % (logsTestsDir,FormattedTestgroup)
        TestLogFile='%s/%s' % (TestLogDir,FormattedTestsuite) 
      </script>
                  
opends/tests/functional-tests/shared/python/common.py
@@ -64,6 +64,15 @@
  def getServerBuildId(self,string):
    return string.replace("Build ","")
  def getServerOSName(self,string):
    return string[0:string.find(' ')].strip()
  def getServerArch(self,string):
    return string[string.rfind(' ') +1:len(string)].strip()
  def getServerJavaMajorMinor(self,string):
    return string[0:string.rfind('.')]
  def getServerValueFromString(self,string):
    return string[string.find(':') +1:len(string)].strip()
opends/tests/functional-tests/staf-installer/config.py.stubs
@@ -28,6 +28,8 @@
DIRECTORY_INSTANCE_BE       = 'userRoot'
STAGED_DATA_DIR             = '%s/shared/data' % TMP_DATA_DIR
LOCAL_DATA_DIR              = '%s/functional-tests/shared/data' % TMPDIR
LOGS_ROOT                   = '%s' % TMPDIR
LOGS_URI                    = ''
JAVA_HOME                   = '${java.home}'
SEND_MAIL_AFTER_TEST_RUN    = '${staf.email.send}'
SEND_MAIL_TO                = '${staf.email.to}'
opends/tests/functional-tests/testcases/runTestJob.xml
@@ -36,7 +36,6 @@
      <script>
        STAXLogMessage = 1
        logdir='%s' % TMPDIR
      </script>
      
      <job name="'Job: %s %s' % (STAF_REMOTE_HOSTNAME,TEST_OS_STRING) " monitor="1" clearlogs="'Enabled'" logtcstartstop="'Enabled'">
@@ -63,11 +62,14 @@
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
        file="'%s/stafcmd.xml' % (TESTS_FUNCTIONS_DIR)" />
        
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
        file="'%s/utils.xml' % (TESTS_FUNCTIONS_DIR)" />
      <!-- Get Directory Server Variables -->
      <call function="'GetVar'">
        { 'location'  : STAF_REMOTE_HOSTNAME,
          'type'      : 'shared',
          'variable'  : 'ServerInfo' }
          'variable'  : 'Job%s_ServerInfo' % STAXSubJobID }
      </call>
      <if expr="RC != 0">
@@ -164,9 +166,41 @@
      </else>
      </if>
 
      <!-- Get logsDir Variable -->
      <call function="'GetVar'">
        { 'location'  : STAF_REMOTE_HOSTNAME,
          'type'      : 'shared',
          'variable'  : 'Job%s_LogsDir' % STAXSubJobID }
      </call>
      <if expr="RC == 0">
        <script>
          logsDir=STAFResult
        </script>
      <else>
        <sequence>
          <message>
            'Unable to retrieve LogsDir variable, RC=%s,Result=%s.' % (RC,STAFResult)
          </message>
          <script>
            logsDir='%s' % TMPDIR
          </script>
        </sequence>
      </else>
      </if>
      <script>
        logsReportDir='%s/reports' % logsDir
      </script>
      <call function="'createFolder'">
        { 'location'   : STAF_LOCAL_HOSTNAME,
          'foldername' : logsReportDir }
      </call>
      <!-- Write Text File for results -->
      <script>
          textfile= '%s/results.txt' % logdir
          textfile= '%s/results.txt' % logsReportDir
          txtfh=open(textfile,'w')
      </script>
      
@@ -189,9 +223,9 @@
      <!-- Write XML File for results -->
      <script>
        import re 
        xmlfile= '%s/results.xml' % logdir
        xmlfile= '%s/results.xml' % logsReportDir
        xmlfh=open(xmlfile,'w') 
        errorfile= '%s/results.errors' % logdir
        errorfile= '%s/results.errors' % logsReportDir
        errorfh=open(errorfile,'w')
      </script>
@@ -390,7 +424,7 @@
      <!-- Transform Report XML into HTML -->
      <script>
        xslfile= '%s/xsl/gen-alltests-report.xsl' % TESTS_SHARED_DIR
        htmlfile= '%s/results.html' % logdir
        htmlfile= '%s/results.html' % logsReportDir
      </script>
      
      <message>