<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<!DOCTYPE stax SYSTEM "../../shared/stax.dtd">
|
<!--
|
! CDDL HEADER START
|
!
|
! The contents of this file are subject to the terms of the
|
! Common Development and Distribution License, Version 1.0 only
|
! (the "License"). You may not use this file except in compliance
|
! with the License.
|
!
|
! You can obtain a copy of the license at
|
! trunk/opends/resource/legal-notices/OpenDS.LICENSE
|
! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
|
! See the License for the specific language governing permissions
|
! and limitations under the License.
|
!
|
! When distributing Covered Code, include this CDDL HEADER in each
|
! file and include the License file at
|
! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
|
! add the following below this CDDL HEADER, with the fields enclosed
|
! by brackets "[]" replaced with your own identifying information:
|
! Portions Copyright [yyyy] [name of copyright owner]
|
!
|
! CDDL HEADER END
|
!
|
! Copyright 2006-2009 Sun Microsystems, Inc.
|
! -->
|
|
<stax>
|
<defaultcall function="start_job"/>
|
<function name="start_job">
|
|
<sequence>
|
|
<script>
|
STAXLogMessage = 1
|
</script>
|
|
<if expr="not STAXJobScriptFiles">
|
<sequence>
|
<message>'No script file (config.py) is specified. Unable to run the tests.'</message>
|
<return></return>
|
</sequence>
|
</if>
|
|
<!-- Load in the local shared python objects -->
|
<script>
|
import sys,os
|
import java.io.FileNotFoundException
|
sys.path.append("%s/shared/python" % TESTS_ROOT )
|
from common import *
|
</script>
|
|
<message>'PATH= %s' % sys.path</message>
|
|
<!-- Check some of the optional variables from config.py -->
|
<script>
|
try:
|
if TEST_OS_STRING:
|
ServerOsString=TEST_OS_STRING
|
else:
|
ServerOsString='Unknown Operating System'
|
except NameError,details:
|
ServerOsString='Unknown Operating System'
|
|
try:
|
if TEST_JVM_STRING:
|
ServerJVMString=TEST_JVM_STRING
|
else:
|
ServerJVMString='Unknown JVM'
|
except NameError,details:
|
ServerJVMString='Unknown JVM'
|
|
try:
|
if LOGS_URI:
|
logsURI=LOGS_URI
|
else:
|
logsURI=''
|
except NameError,details:
|
logsURI=''
|
|
</script>
|
|
<job name="'Job: %s %s' % (STAF_REMOTE_HOSTNAME,ServerOsString) " monitor="1" clearlogs="'Enabled'" logtcstartstop="'Enabled'">
|
<job-file>'%s/shared/tests/runTests.xml' % TESTS_ROOT</job-file>
|
<job-scriptfiles machine="STAF_LOCAL_HOSTNAME"> STAXJobScriptFiles </job-scriptfiles>
|
<job-action>
|
<log>'Started sub-job %s on %s, %s' % (STAXSubJobID,STAF_REMOTE_HOSTNAME,ServerOsString )</log>
|
</job-action>
|
</job>
|
|
<if expr="RC == 0">
|
<sequence>
|
<message>
|
'Sub-job %s completed. Children: %s' % (STAXSubJobID, STAXResult)
|
</message>
|
|
<script>
|
listOfChildren=STAXResult
|
</script>
|
</sequence>
|
<else>
|
<sequence>
|
<message log="1" level="'Error'">
|
'Sub-job %s could not be started. RC: %s Result: %s' % (STAXSubJobID,RC,STAFResult)
|
</message>
|
<return>1</return>
|
</sequence>
|
</else>
|
</if>
|
|
<!--- Import required shared xml libraries -->
|
<import machine="STAF_LOCAL_HOSTNAME"
|
file="'%s/stafcmd.xml' % TESTS_FUNCTIONS_DIR" />
|
|
<!-- FixMe
|
dirty workaround because utils.xml now depends on environment.xml
|
to avoid loading environment.xml I'll just set the required vars here
|
allegedly ugly
|
-=arnaud=-
|
-->
|
<script>
|
NO_CHECK = 'noCheck'
|
</script>
|
<import machine="STAF_LOCAL_HOSTNAME"
|
file="'%s/utils.xml' % (TESTS_FUNCTIONS_DIR)" />
|
|
<!-- Get Directory Server Variables -->
|
<call function="'GetVar'">
|
{ 'location' : STAF_REMOTE_HOSTNAME,
|
'type' : 'shared',
|
'variable' : 'Job%s_ServerInfo' % STAXSubJobID
|
}
|
</call>
|
|
<if expr="RC != 0">
|
<script>
|
STAFResult='{}'
|
</script>
|
</if>
|
|
<!-- Build the Servers Information Dictionary -->
|
<script>
|
|
ServersInfoDict=eval(STAFResult)
|
|
ServerPath='%s/%s' % (DIRECTORY_INSTANCE_BIN,OPENDSNAME)
|
ServerName='unknown'
|
ServerVersion='unknown'
|
ServerBuildId='unknown'
|
ServerJavaVersion='unknown'
|
ServerJavaVendor='unknown'
|
ServerJVMVersion='unknown'
|
ServerJVMVendor='unknown'
|
ServerJVMArchitecture='unknown'
|
ServerJVMLabel='unknown'
|
ServerSystemOS='unknown'
|
ServerSystemName='unknown'
|
ServerRevision='unknown'
|
ServerPackage='%s/%s' % (ZIPPATH,ZIPNAME)
|
ServerSNMPJarFile='%s' % SNMP_OPENDMK_JARFILE
|
|
if ServersInfoDict.has_key(ServerPath):
|
ServerInfoDict=ServersInfoDict[ServerPath]
|
|
ServerName=OPENDSNAME
|
|
ServerInfoKey='server version'
|
if ServerInfoDict.has_key(ServerInfoKey):
|
ServerVersion=ServerInfoDict[ServerInfoKey]
|
|
ServerInfoKey='server buildid'
|
if ServerInfoDict.has_key(ServerInfoKey):
|
ServerBuildId=ServerInfoDict[ServerInfoKey]
|
|
ServerInfoKey='java version'
|
if ServerInfoDict.has_key(ServerInfoKey):
|
ServerJavaVersion=ServerInfoDict[ServerInfoKey]
|
|
ServerInfoKey='java vendor'
|
if ServerInfoDict.has_key(ServerInfoKey):
|
ServerJavaVendor=ServerInfoDict[ServerInfoKey]
|
|
ServerInfoKey='jvm version'
|
if ServerInfoDict.has_key(ServerInfoKey):
|
ServerJVMVersion=ServerInfoDict[ServerInfoKey]
|
|
ServerInfoKey='jvm vendor'
|
if ServerInfoDict.has_key(ServerInfoKey):
|
ServerJVMVendor=ServerInfoDict[ServerInfoKey]
|
|
ServerInfoKey='jvm architecture'
|
if ServerInfoDict.has_key(ServerInfoKey):
|
ServerJVMArchitecture=ServerInfoDict[ServerInfoKey]
|
|
ServerInfoKey='system os'
|
if ServerInfoDict.has_key(ServerInfoKey):
|
ServerSystemOS=ServerInfoDict[ServerInfoKey]
|
|
ServerInfoKey='system name'
|
if ServerInfoDict.has_key(ServerInfoKey):
|
ServerSystemName=ServerInfoDict[ServerInfoKey]
|
|
ServerInfoKey='svn revision'
|
if ServerInfoDict.has_key(ServerInfoKey):
|
ServerRevision=ServerInfoDict[ServerInfoKey]
|
|
else:
|
ServerInfoDict='No key found (%s)' % ServerPath
|
|
if ServerOsString == 'Unknown Operating System':
|
ServerOsString=ServerSystemOS
|
|
if ServerJVMString == 'Unknown JVM':
|
ServerJVMString=ServerJVMVersion
|
|
</script>
|
|
<message>'Server= %s' % ServerInfoDict </message>
|
|
<!-- Build the DSML Gateway Information Dictionary -->
|
<script>
|
DSMLName='%s' % DSML_WARNAME
|
DSMLPackage='%s' % DSML_WARPATH
|
DSMLContainer='%s %s' % (WC_TYPE,WC_VERSION)
|
</script>
|
|
<!-- Get the location of where the test logs are -->
|
<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
|
logsTestsDir='%s/testlogs' % logsDir
|
</script>
|
|
<call function="'createFolder'">
|
{ 'location' : STAF_LOCAL_HOSTNAME,
|
'foldername' : logsReportDir }
|
</call>
|
|
<script>
|
resultQuery=[]
|
textfile= '%s/results.txt' % logsReportDir
|
txtfh=open(textfile,'w')
|
</script>
|
|
<!-- Defend against not having any test groups run -->
|
<if expr="not listOfChildren">
|
<sequence>
|
<message log="1" level="'Warning'">
|
'No test groups have been run.'
|
</message>
|
</sequence>
|
<else>
|
<sequence>
|
<iterate var="thisChild" in="listOfChildren">
|
<sequence>
|
<stafcmd name="'STAF Command: Log Query All'">
|
<location>'%s' % STAF_LOCAL_HOSTNAME </location>
|
<service>'log'</service>
|
<request>
|
'QUERY ALL MACHINE %s LOGNAME STAX_Job_%s' % (STAXServiceMachine,thisChild)
|
</request>
|
</stafcmd>
|
|
<if expr="RC == 0">
|
<sequence>
|
<script>
|
resultQuery=STAFResult
|
</script>
|
<message>
|
'Log Query on STAX_Job_%s Completed. RC=%s' % (thisChild,RC)
|
</message>
|
<iterate var="line" in="resultQuery">
|
|
<script>
|
txtfh.write('%s\n' % line)
|
</script>
|
|
</iterate>
|
</sequence>
|
<else>
|
<sequence>
|
<message log="1" level="'Error'">
|
'Unable to perform log query on STAX_Job_%s. RC: %s Result: %s' % (thisChild,RC,STAFResult)
|
</message>
|
<return>1</return>
|
</sequence>
|
</else>
|
</if>
|
|
</sequence>
|
</iterate>
|
</sequence>
|
</else>
|
</if>
|
|
<script>
|
txtfh.close()
|
</script>
|
|
<!-- Write error File for results -->
|
<script>
|
import re
|
errorfile= '%s/results.errors' % logsReportDir
|
errorfh=open(errorfile,'w')
|
</script>
|
|
<!-- Build the test case dictionary object -->
|
<script>
|
testDict={}
|
testCaseList=[]
|
tcshortname=''
|
try:
|
txtfh=open(textfile,'r')
|
|
try:
|
for line in txtfh.readlines():
|
element=eval(line)
|
|
level=element['level']
|
message=element['message']
|
timestamp=element['timestamp']
|
|
startValueDict={}
|
stopValueDict={}
|
failValueDict={}
|
statusValueDict={}
|
|
if level == 'Start':
|
tcpattern=re.compile("(Testcase): (.*)")
|
tcmatch = tcpattern.search(message)
|
if tcmatch:
|
tctype=tcmatch.group(1)
|
tcname=tcmatch.group(2)
|
if testDict.has_key(tcname):
|
for key in testDict[tcname].keys():
|
value=testDict[tcname][key]
|
startValueDict[key]=value
|
|
startValueDict['start']=timestamp
|
testDict[tcname]=startValueDict
|
|
testCaseList.append(tcname.strip())
|
|
else:
|
errorfh.write('Warning: No match Start element %s.\n' % element)
|
|
elif level == 'Stop':
|
|
tcpattern=re.compile("(Testcase): (.*), ElapsedTime: (.*)")
|
tcmatch = tcpattern.search(message)
|
|
if tcmatch:
|
tctype=tcmatch.group(1)
|
tcname=tcmatch.group(2)
|
tctime=tcmatch.group(3)
|
if testDict.has_key(tcname):
|
for key in testDict[tcname].keys():
|
value=testDict[tcname][key]
|
stopValueDict[key]=value
|
|
stopValueDict['stop']=timestamp
|
stopValueDict['duration']=tctime
|
testDict[tcname]=stopValueDict
|
|
else:
|
errorfh.write('Warning: No match Stop element %s.\n' % element)
|
|
elif level == 'Fail':
|
|
tcpattern=re.compile("(Testcase): (.*),.*,.*, Last Status: fail, Message: KnownIssue: (.*)")
|
tcmatch = tcpattern.search(message)
|
|
if tcmatch:
|
tctype=tcmatch.group(1)
|
tcname=tcmatch.group(2)
|
tcissues=tcmatch.group(3)
|
if testDict.has_key(tcname):
|
for key in testDict[tcname].keys():
|
value=testDict[tcname][key]
|
failValueDict[key]=value
|
|
failValueDict['issue']=tcissues
|
testDict[tcname]=failValueDict
|
|
else:
|
errorfh.write('Warning: No match Fail element %s.\n' % element)
|
|
elif level == 'Status':
|
|
tcpattern=re.compile("(Testcase): (.*), Pass: (.*), Fail: (.*), ElapsedTime: (.*), NumStarts: (.*)")
|
tcmatch = tcpattern.search(message)
|
|
if tcmatch:
|
tctype=tcmatch.group(1)
|
tcname=tcmatch.group(2)
|
tcpass=tcmatch.group(3)
|
tcfail=tcmatch.group(4)
|
tctime=tcmatch.group(5)
|
tcnums=tcmatch.group(6)
|
|
if testDict.has_key(tcname):
|
|
for key in testDict[tcname].keys():
|
value=testDict[tcname][key]
|
statusValueDict[key]=value
|
|
statusValueDict['pass']=tcpass
|
statusValueDict['fail']=tcfail
|
testDict[tcname]=statusValueDict
|
|
else:
|
errorfh.write('Warning: No match Status element %s.\n' % element)
|
|
elif level == 'Info':
|
errorfh.write('Warning: Info element %s.\n' % element)
|
|
else:
|
errorfh.write('Error: Unknown element %s.\n' % element)
|
|
finally:
|
txtfh.close()
|
|
except IOError:
|
errorfh.write('Error: Unable to open %s. Reason IOError.' % textfile )
|
|
</script>
|
|
<message>'Starting to create results XML file.'</message>
|
|
<script>
|
# Create the objects
|
localstaf =test_env.staf(STAF_LOCAL_HOSTNAME)
|
remotestaf=test_env.staf(STAF_REMOTE_HOSTNAME)
|
|
stax = test_env.stax(STAF_LOCAL_HOSTNAME)
|
event = test_env.event(STAF_LOCAL_HOSTNAME)
|
eventman = test_env.eventmanager(STAF_LOCAL_HOSTNAME)
|
email = test_env.email(STAF_LOCAL_HOSTNAME)
|
http = test_env.http(STAF_LOCAL_HOSTNAME)
|
dsml = test_env.dsml(STAF_LOCAL_HOSTNAME)
|
|
# Build the XML results file
|
from xml.dom.minidom import Document
|
|
def write_text_elements(parent,elements):
|
|
for sutElement in elements:
|
label,text = sutElement
|
element = doc.createElement(label)
|
parent.appendChild(element)
|
try:
|
element.appendChild(doc.createTextNode(text))
|
except TypeError,details:
|
element.appendChild(doc.createTextNode('TypeError: %s' % details))
|
|
# Create the test results document
|
doc = Document()
|
|
# Create the qa base element
|
qa = doc.createElement("qa")
|
doc.appendChild(qa)
|
|
# Create the functional-tests element
|
ft = doc.createElement("%s" % TESTS_TYPE)
|
qa.appendChild(ft)
|
|
# Create the identification element
|
id = doc.createElement("identification")
|
ft.appendChild(id)
|
|
# Create the sut opends element
|
sut = doc.createElement("sut")
|
sut.setAttribute("product", "opends")
|
id.appendChild(sut)
|
|
# Create the sut opends elements
|
sutElementList=[]
|
sutElementList.append(['name',ServerName])
|
sutElementList.append(['path',ServerPath])
|
sutElementList.append(['version',ServerVersion])
|
sutElementList.append(['buildid',ServerBuildId])
|
sutElementList.append(['revision',ServerRevision])
|
sutElementList.append(['hostname',STAF_REMOTE_HOSTNAME])
|
sutElementList.append(['platform',ServerSystemOS])
|
sutElementList.append(['jvm-version',ServerJVMVersion])
|
sutElementList.append(['jvm-label',ServerJVMString])
|
sutElementList.append(['jvm-vendor',ServerJVMVendor])
|
sutElementList.append(['jvm-arch',ServerJVMArchitecture])
|
sutElementList.append(['jvm-args','TBD'])
|
sutElementList.append(['jvm-home','TBD'])
|
sutElementList.append(['jvm-bin','TBD'])
|
sutElementList.append(['os-label',ServerOsString])
|
sutElementList.append(['server-package',ServerPackage])
|
sutElementList.append(['snmp-jarfile',ServerSNMPJarFile])
|
sutElementList.append(['md5-sum','TDB'])
|
|
write_text_elements(sut,sutElementList)
|
|
# Create the sut dsml element
|
sut = doc.createElement("sut")
|
sut.setAttribute("product", "dsml")
|
id.appendChild(sut)
|
|
# Create the sut dsml elements
|
sutElementList=[]
|
sutElementList.append(['name',DSMLName])
|
sutElementList.append(['dsml-container',DSMLContainer])
|
sutElementList.append(['dsml-package',DSMLPackage])
|
sutElementList.append(['md5-sum','TDB'])
|
|
write_text_elements(sut,sutElementList)
|
|
sutElementList=[]
|
|
# Create the testware element
|
testware = doc.createElement("testware")
|
id.appendChild(testware)
|
|
# Create the staf testware element
|
staf = doc.createElement("staf")
|
testware.appendChild(staf)
|
|
# Create the staf local element
|
local = doc.createElement("local")
|
staf.appendChild(local)
|
|
# Create the staf local testware elements
|
testwareElementList=[]
|
testwareElementList.append(['hostname',STAF_LOCAL_HOSTNAME])
|
testwareElementList.append(['version',localstaf.version])
|
testwareElementList.append(['rootdir',localstaf.root])
|
|
write_text_elements(local,testwareElementList)
|
|
# Create the staf remote testware element
|
remote = doc.createElement("remote")
|
staf.appendChild(remote)
|
|
# Create the staf remote testware elements
|
testwareElementList=[]
|
testwareElementList.append(['hostname',STAF_REMOTE_HOSTNAME])
|
testwareElementList.append(['version',remotestaf.version])
|
testwareElementList.append(['rootdir',remotestaf.root])
|
|
write_text_elements(remote,testwareElementList)
|
|
for serviceType in [stax,event,eventman,email,http,dsml]:
|
|
# Create the service testware element
|
service = doc.createElement("service")
|
service.setAttribute("name", serviceType.name)
|
testware.appendChild(service)
|
|
# Create the service testware elements
|
testwareElementList=[]
|
testwareElementList.append(['version',serviceType.version])
|
testwareElementList.append(['library',serviceType.library])
|
testwareElementList.append(['executable',serviceType.executable])
|
testwareElementList.append(['options','%s' % serviceType.options])
|
testwareElementList.append(['params','%s' % serviceType.params])
|
|
write_text_elements(service,testwareElementList)
|
|
testwareElementList=[]
|
|
# Create the id elements
|
idElementList=[]
|
idElementList.append(['tests-dir',logsDir])
|
idElementList.append(['tests-url',logsURI])
|
idElementList.append(['mailto',SEND_MAIL_TO])
|
|
write_text_elements(id,idElementList)
|
|
idElementList=[]
|
|
# Create the results element
|
results = doc.createElement("results")
|
ft.appendChild(results)
|
|
# Create the results elements and attributes
|
for tcname in testCaseList:
|
|
print 'Processing %s' % tcname
|
|
if testDict.has_key(tcname):
|
tcnamesplit=tcname.split(":")
|
if tcnamesplit[0]:
|
tcgroup=tcnamesplit[0].strip()
|
if tcnamesplit[1]:
|
tcsuite=tcnamesplit[1].strip()
|
try:
|
tcsuiteshort=tcsuite.split(".")[2].strip()
|
except:
|
print 'Default test suite short name to %s.' % tcsuite
|
tcsuiteshort=tcsuite
|
else:
|
tcsuite=tcgroup
|
else:
|
tcgroup=tcname
|
tcsuite=tcname
|
tcsuiteshort=tcname
|
|
if testDict[tcname].has_key('pass'):
|
tcpass=testDict[tcname]['pass']
|
else:
|
tcpass='0'
|
|
if testDict[tcname].has_key('fail'):
|
tcfail=testDict[tcname]['fail']
|
else:
|
tcfail='0'
|
|
if testDict[tcname].has_key('start'):
|
tcstart=testDict[tcname]['start']
|
else:
|
tcstart='unknown'
|
|
if testDict[tcname].has_key('stop'):
|
tcstop=testDict[tcname]['stop']
|
else:
|
tcstop='unknown'
|
|
if testDict[tcname].has_key('duration'):
|
tcduration=testDict[tcname]['duration']
|
else:
|
tcduration='unknown'
|
|
if testDict[tcname].has_key('issue'):
|
tcissues=testDict[tcname]['issue']
|
else:
|
tcissues='unknown'
|
|
else:
|
errorfh.write('No key for testcase %s.\n' % tcname)
|
|
if int(tcfail) == 0 and int(tcpass) > 0:
|
tcresult='pass'
|
elif int(tcfail) == 0 and int(tcpass) == 0:
|
tcresult='unknown'
|
else:
|
tcresult='fail'
|
|
tcshortname=get_test_name(tcname)
|
tcdurationsecs=test_time().timeToSeconds(tcduration)
|
|
# Create the testgroup element
|
group = doc.createElement("testgroup")
|
group.setAttribute("name", tcgroup.lower())
|
results.appendChild(group)
|
|
# Create the testsuite element
|
suite = doc.createElement("testsuite")
|
suite.setAttribute("name", tcsuite.lower())
|
suite.setAttribute("shortname", tcsuiteshort.lower())
|
group.appendChild(suite)
|
|
# Create the testcase element
|
case = doc.createElement("testcase")
|
case.setAttribute("group", "%s" % tcgroup.lower())
|
case.setAttribute("suite", "%s" % tcsuite.lower())
|
case.setAttribute("name", "%s" % tcname.lower())
|
case.setAttribute("shortname", "%s" % tcshortname.lower())
|
case.setAttribute("result", "%s" % tcresult)
|
case.setAttribute("start", "%s" % tcstart)
|
case.setAttribute("stop", "%s" % tcstop)
|
case.setAttribute("duration", "%s" % tcdurationsecs)
|
if tcissues != 'unknown':
|
issues = doc.createElement("issues")
|
tcissuesList=eval(tcissues)
|
for attr in tcissuesList:
|
issue = doc.createElement("issue")
|
issue.setAttribute("id", attr)
|
issues.appendChild(issue)
|
case.appendChild(issues)
|
suite.appendChild(case)
|
|
# Write out the results
|
xmlfile= '%s/results.xml' % logsReportDir
|
xmlfh=open(xmlfile,'w')
|
xmlfh.writelines(doc.toprettyxml(indent=" "))
|
xmlfh.close()
|
errorfh.close()
|
</script>
|
|
<message>
|
'XML Report Written to %s.' % xmlfile
|
</message>
|
|
<!-- Generate the standard test report showing all testcases -->
|
<script>
|
_message='Generated standard test report.'
|
xslfile= '%s/gen-alltests-report.xsl' % TESTS_XSL_DIR
|
htmlfile= '%s/results.html' % logsReportDir
|
|
standardReport=report_generation()
|
|
stringParamsDict={}
|
|
try:
|
standardReport.transformReport(xslfile,xmlfile,htmlfile,stringParamsDict)
|
except java.io.FileNotFoundException,details:
|
_message='Unable to generate standard test report %s.' % details
|
except IOError,details:
|
_message='Unable to generate standard test report %s.' % details
|
except:
|
_message='Unable to generate standard test report !!!'
|
</script>
|
<message>_message</message>
|
|
<!-- Generate the test report by test groups-->
|
<script>
|
_message='Generated groups test report.'
|
xslfile= '%s/gen-groups-report.xsl' % TESTS_XSL_DIR
|
htmlfile= '%s/groups.html' % logsReportDir
|
testslog= '%s/tests-log.xml' % logsTestsDir
|
groupsReport=report_generation()
|
stringParamsDict={}
|
|
try:
|
groupsReport.transformReport(xslfile,xmlfile,htmlfile,stringParamsDict)
|
except java.io.FileNotFoundException,details:
|
_message='Unable to generate groups test report %s.' % details
|
except IOError,details:
|
_message='Unable to generate groups test report %s.' % details
|
except:
|
_message='Unable to generate groups test report !!!'
|
</script>
|
<message>_message</message>
|
|
<!-- Generate the test report by test suites -->
|
<script>
|
_message='Generated suites test reports.'
|
|
testGroupDirsList=os.listdir(logsTestsDir)
|
for testGroupName in testGroupDirsList:
|
|
groupDir='%s/%s' % (logsTestsDir,testGroupName)
|
|
if os.path.isdir(groupDir):
|
|
xmlfile='%s/results.xml' % logsReportDir
|
htmlfile='%s/%s.html' % (groupDir,testGroupName)
|
xslfile= '%s/gen-suites-report.xsl' % TESTS_XSL_DIR
|
|
suitesReport=report_generation()
|
stringParamsDict={ 'group' : testGroupName }
|
|
try:
|
suitesReport.transformReport(xslfile,xmlfile,htmlfile,stringParamsDict)
|
except java.io.FileNotFoundException,details:
|
_message='Unable to generate suites test report %s.' % details
|
except IOError,details:
|
_message='Unable to generate suites test report %s.' % details
|
except:
|
_message='Unable to generate suites test report %s !!!' % groupDir
|
</script>
|
<message>_message</message>
|
|
<!-- Generate the test case report by test suites -->
|
<script>
|
_message='Generated cases test reports.'
|
|
testGroupDirsList=os.listdir(logsTestsDir)
|
for testGroupName in testGroupDirsList:
|
|
print 'group= %s' % testGroupName
|
|
groupDir='%s/%s' % (logsTestsDir,testGroupName)
|
|
if os.path.isdir(groupDir):
|
|
import glob
|
testSuiteFilesList=glob.glob('%s/*.xml' % groupDir)
|
|
xmlfile='%s/results.xml' % logsReportDir
|
xslfile= '%s/gen-tests-report.xsl' % TESTS_XSL_DIR
|
|
for testSuiteFile in testSuiteFilesList:
|
|
if os.path.isfile(testSuiteFile):
|
testSuiteName=os.path.basename(testSuiteFile.replace('-log.xml',''))
|
try:
|
testSuiteShortName=testSuiteName.split('.')[2]
|
except:
|
print 'Default test suite short name to %s.' % testSuiteName
|
testSuiteShortName=testSuiteName
|
|
print 'suite= %s' % testSuiteName
|
|
htmlfile='%s/%s-report.html' % (groupDir,testSuiteShortName)
|
|
stringParamsDict={ 'group' : testGroupName, 'suite' : testSuiteName, 'tests-log' : testslog }
|
|
casesReport=report_generation()
|
|
try:
|
casesReport.transformReport(xslfile,xmlfile,htmlfile,stringParamsDict)
|
except java.io.FileNotFoundException,details:
|
_message='Unable to generate test case report %s.' % details
|
except IOError,details:
|
_message='Unable to generate test case report %s.' % details
|
except:
|
_message='Unable to generate test case report %s !!!' % groupDir
|
</script>
|
<message>_message</message>
|
|
<!-- Generate the product identification report -->
|
<script>
|
_message='Generated product identification test report.'
|
xslfile= '%s/id.xsl' % TESTS_XSL_DIR
|
htmlfile= '%s/id.html' % logsReportDir
|
|
idReport=report_generation()
|
|
stringParamsDict={}
|
|
try:
|
idReport.transformReport(xslfile,xmlfile,htmlfile,stringParamsDict)
|
except java.io.FileNotFoundException,details:
|
_message='Unable to generate product id test report %s.' % details
|
except IOError,details:
|
_message='Unable to generate product id test report %s.' % details
|
except:
|
_message='Unable to generate product id test report !!!'
|
</script>
|
<message>_message</message>
|
|
<!-- Generate the summary text file -->
|
<script>
|
_message='Generated the summary text report'
|
mysummaryxsl='%s/gen-text-summary.xsl' % TESTS_XSL_DIR
|
mysummarytext='%s/summary.txt' % logsReportDir
|
mysummaryxml=xmlfile
|
|
summaryReport=report_generation()
|
|
stringParamsDict={}
|
|
try:
|
summaryReport.transformReport(mysummaryxsl,mysummaryxml,mysummarytext,stringParamsDict)
|
except IOError,details:
|
_message='Unable to generate summary text file %s.' % details
|
</script>
|
<message>_message</message>
|
|
<if expr="SEND_MAIL_AFTER_TEST_RUN == 'true'">
|
<sequence>
|
<message>
|
'Sending Email Test Report to %s.' % SEND_MAIL_TO
|
</message>
|
|
<script>
|
try:
|
if SEND_MAIL_REPORT:
|
MailSendReport=SEND_MAIL_REPORT
|
else:
|
MailSendReport='%s/groups.html' % logsReportDir
|
except NameError,details:
|
MailSendReport='%s/groups.html' % logsReportDir
|
|
try:
|
if SEND_MAIL_TO:
|
MailToList= SEND_MAIL_TO.split(",")
|
else:
|
MailToList=[]
|
except NameError,details:
|
MailToList=[]
|
|
try:
|
if SEND_MAIL_SUBJECT:
|
MailSubject= SEND_MAIL_SUBJECT
|
else:
|
MailSubject= 'OpenDS Test Report for %s' % STAF_REMOTE_HOSTNAME
|
except NameError,details:
|
MailSubject= 'OpenDS Test Report for %s' % STAF_REMOTE_HOSTNAME
|
|
MailSendTo= ' '
|
</script>
|
|
<iterate var="Recipient" in="MailToList">
|
<script>
|
MailSendTo='to %s %s' % (Recipient,MailSendTo)
|
</script>
|
</iterate>
|
|
<stafcmd name="'STAF Command: Send test report %s' % MailSendTo">
|
<location>'%s' % STAF_LOCAL_HOSTNAME </location>
|
<service>'email'</service>
|
<request>
|
'send %s contenttype "text/html" file %s subject "%s" noheader' % (MailSendTo,MailSendReport,MailSubject)
|
</request>
|
</stafcmd>
|
|
<if expr="RC != 0">
|
<message log="1" level="'Error'">
|
'Send test report failed. RC: %s STAFResult: %s' % (RC,STAFResult)
|
</message>
|
<else>
|
<message>
|
'Send test report successful. RC: %s' % (RC)
|
</message>
|
</else>
|
</if>
|
</sequence>
|
</if>
|
|
<!-- Saving Staf/Stax logs -->
|
<message>'Saving staf logs'</message>
|
|
<call function="'ResolveVar'" >
|
{
|
'location' : STAF_LOCAL_HOSTNAME ,
|
'type' : 'STRING',
|
'name' : 'STAF/Config/STAFRoot'
|
}
|
</call>
|
<if expr="RC != 0">
|
<script>
|
STAFResult = '{}'
|
</script>
|
<else>
|
<script>
|
STAFRoot = STAFResult
|
</script>
|
</else>
|
</if>
|
|
<script>
|
listOfChildren2 = listOfChildren
|
listOfChildren2.append(STAXJobID)
|
listOfChildren2.append(STAXSubJobID)
|
</script>
|
<iterate var="thisChild" in="listOfChildren2">
|
<sequence>
|
<script>
|
srcFile = '%s/logs/MACHINE/%s/GLOBAL/STAX_Job_%s.log' \
|
% (STAFRoot,STAF_LOCAL_HOSTNAME,thisChild)
|
destFile = '%s/staf-logs/STAX_Job_%s.log' \
|
% (LOGS_ROOT,thisChild)
|
</script>
|
<process name="'Saving job logs.....'">
|
<location>STAF_LOCAL_HOSTNAME</location>
|
<command mode="'shell'">'%s/bin/fmtlog' % STAFRoot</command>
|
<parms>'FORMAT LOGFILE %s NEWFILE %s' % (srcFile,destFile)</parms>
|
<envs>'%s/lib' % STAFRoot</envs>
|
<stderr mode="'stdout'"/>
|
<returnstdout/>
|
</process>
|
|
<script>
|
srcFile = '%s/logs/MACHINE/%s/GLOBAL/STAX_Job_%s_User.log' \
|
% (STAFRoot,STAF_LOCAL_HOSTNAME,thisChild)
|
destFile = '%s/staf-logs/STAX_Job_%s_User.log' \
|
% (LOGS_ROOT,thisChild)
|
</script>
|
<process name="'Saving job user logs.....'">
|
<location>STAF_LOCAL_HOSTNAME</location>
|
<command mode="'shell'">'%s/bin/fmtlog' % STAFRoot</command>
|
<parms>'FORMAT LOGFILE %s NEWFILE %s' % (srcFile,destFile)</parms>
|
<envs>'%s/lib' % STAFRoot</envs>
|
<stderr mode="'stdout'"/>
|
<returnstdout/>
|
</process>
|
</sequence>
|
</iterate>
|
|
</sequence>
|
|
</function>
|
</stax>
|