runStressTests.xml revision 2f2b85856e60cc6706b066a426148b58f378ce95
15394N/A<?xml version="1.0" encoding="UTF-8" standalone="no"?>
15394N/A<!DOCTYPE stax SYSTEM "/shared/stax.dtd">
15394N/A<!--
15394N/A ! CDDL HEADER START
15394N/A !
15394N/A ! The contents of this file are subject to the terms of the
18022N/A ! Common Development and Distribution License, Version 1.0 only
15394N/A ! (the "License"). You may not use this file except in compliance
15394N/A ! with the License.
15394N/A !
17185N/A ! You can obtain a copy of the license at
15394N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
15394N/A ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
15394N/A ! See the License for the specific language governing permissions
15394N/A ! and limitations under the License.
19109N/A !
18688N/A ! When distributing Covered Code, include this CDDL HEADER in each
18688N/A ! file and include the License file at
15394N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
15394N/A ! add the following below this CDDL HEADER, with the fields enclosed
15394N/A ! by brackets "[]" replaced with your own identifying information:
18022N/A ! Portions Copyright [yyyy] [name of copyright owner]
15394N/A !
15394N/A ! CDDL HEADER END
18022N/A !
15394N/A ! Copyright 2006-2008 Sun Microsystems, Inc.
15394N/A ! -->
19142N/A<stax>
16401N/A <defaultcall function="main" />
16241N/A <function name="main">
17093N/A <sequence>
17093N/A <!--- Load the environment for the test suite execution -->
18850N/A <import machine="STAF_LOCAL_HOSTNAME"
18850N/A file="'%s/environment.xml' % TESTS_FUNCTIONS_DIR" />
18850N/A <call function="'loadEnvironment'" />
18850N/A
15394N/A <!-- The Functional Tests -->
15394N/A <import machine="STAF_LOCAL_HOSTNAME"
15394N/A file="'%s/testcases/import_ldif/import_ldif.xml' % TESTS_DIR" />
15394N/A
15394N/A <script>
19142N/A # this function return a well-formatted testcase name
15394N/A def getTestCaseName(name):
16401N/A return '%s: %s: %s' % (CurrentTestPath['group'],CurrentTestPath['suite'],name)
15394N/A
15394N/A # this functions adds a known issue to a testcase's known issues list
15394N/A issuesList=[]
15394N/A def knownIssue(issue):
15929N/A issuesList.append(issue)
15929N/A
18022N/A class functionToRun:
15394N/A def __init__(self, name):
18390N/A self.name = name
18390N/A
18390N/A def getName(self):
18390N/A return self.name
18390N/A
18390N/A testlog=open('%s/tests-log.xml' % TMPDIR,'w')
18390N/A testlog.write('&lt;qa&gt;\n')
18390N/A testlog.write(' &lt;functional-tests&gt;\n')
18390N/A testlog.write(' &lt;results&gt;\n')
18390N/A testlog.close()
15394N/A
18390N/A suitesFileName='%s/testcases/run-custom-suites.dat' % TESTS_DIR
18390N/A
18390N/A if not os.path.exists(suitesFileName):
15929N/A suitesFileName='%s/testcases/run-default-suites.dat' % TESTS_DIR
15394N/A
15394N/A f = open(suitesFileName, 'r')
15929N/A functionsToRun = []
15394N/A for line in f.readlines():
15394N/A functionsToRun.append(functionToRun(line.rstrip()))
15394N/A f.close()
18022N/A </script>
18022N/A <iterate var="function" in="functionsToRun">
15394N/A <sequence>
15394N/A <message>'calling function [%s]' % function.getName()</message>
15394N/A <call function="function.getName()" />
15394N/A </sequence>
15394N/A </iterate>
17093N/A
17093N/A <!-- in this section we'll compute the coverage for all the tests
17093N/A if coverage is turned on
17093N/A so far I could only get through this on either machines with a lot
17093N/A of memory or small sets of tests
17093N/A -->
17093N/A <if expr="os.path.exists('%s/lib/emma.jar' % dsPath)">
17093N/A <sequence>
16256N/A <script>
16256N/A coverageFiles=''
16256N/A for group in os.listdir('%s/coverage/' % TMPDIR):
15394N/A coverageFiles+='%s/coverage/%s/coverage.ec' % (TMPDIR,group)
15394N/A </script>
15394N/A <call function="'runCommand'">
15394N/A { 'name' : 'Generate global coverage xml report',
15394N/A 'command' : 'java',
15394N/A 'arguments' : ' -Xms64M -Xmx1024M -cp %s/lib/emma.jar emma report -r xml,html -in %s/coverage.em,%s -Dreport.xml.out.file=%s/coverage/coverage.xml -Dreport.html.out.file=%s/coverage/coverage.html -sp %/src' % (dsPath,dsPath,coverageFiles,TMPDIR,TMPDIR,TMPDIR),
15394N/A 'path' : TMPDIR
15394N/A }
15394N/A </call>
15394N/A <script>
15394N/A from java.io import FileInputStream
15394N/A from javax.xml.transform.stream import StreamSource
15394N/A from javax.xml.transform.stream import StreamResult
19051N/A from javax.xml.parsers import DocumentBuilderFactory
19051N/A from org.w3c.dom import *
18850N/A
18850N/A factory = DocumentBuilderFactory.newInstance()
18390N/A builder = factory.newDocumentBuilder()
18390N/A
18022N/A input = FileInputStream("%s/coverage/coverage.xml" % TMPDIR)
18022N/A document = builder.parse(input)
17095N/A dom = document.getDocumentElement()
17095N/A coverageNodes = dom.getElementsByTagName("all").item(0).getChildNodes()
17093N/A for coverageNodeIndex in range(coverageNodes.getLength()):
17093N/A thisNode = coverageNodes.item(coverageNodeIndex)
17093N/A if thisNode.getNodeName() == 'coverage':
16716N/A thisNodeAttributes = thisNode.getAttributes()
16716N/A if thisNodeAttributes.getNamedItem("type").getNodeValue() == 'block, %':
16256N/A rawCoverage = thisNodeAttributes.getNamedItem("value").getNodeValue()
16256N/A coverage = rawCoverage.split('%')[0]
16241N/A testlog=open('%s/tests-log.xml' % TMPDIR,'a')
16241N/A testlog.seek(0,2)
15929N/A testlog.write(" &lt;all&gt;\n")
15929N/A testlog.write(" &lt;coverage&gt;\n")
15394N/A testlog.write(" %s\n" % coverage)
15394N/A testlog.write(" &lt;/coverage&gt;\n")
19163N/A testlog.write(" &lt;/all&gt;\n")
testlog.close()
</script>
</sequence>
<else>
<script>
testlog=open('%s/tests-log.xml' % TMPDIR,'a')
testlog.seek(0,2)
testlog.write(" &lt;all&gt;\n")
testlog.write(" &lt;coverage&gt;\n")
testlog.write(" N/A\n")
testlog.write(" &lt;/coverage&gt;\n")
testlog.write(" &lt;/all&gt;\n")
testlog.close()
</script>
</else>
</if>
<!-- here goes the section where we get the product's info -->
<call function="'GetVar'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'type' : 'shared',
'variable' : 'Job%s_ServerInfo' % STAXJobID
}
</call>
<if expr="RC != 0">
<script>
STAFResult='{}'
</script>
</if>
<!-- Build the Servers Information Dictionary -->
<script>
ServersInfoDict=eval(STAFResult)
ServerVersion='unknown'
ServerBuildId='unknown'
ServerJavaVersion='unknown'
ServerJavaVendor='unknown'
ServerJVMVersion='unknown'
ServerJVMVendor='unknown'
ServerSystemOS='unknown'
ServerSystemName='unknown'
ServerSvnRevision='unknown'
if ServersInfoDict.has_key('%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)):
ServerInfoDict=ServersInfoDict['%s/%s' % (DIRECTORY_INSTANCE_DIR,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='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):
ServerSvnRevision=ServerInfoDict[ServerInfoKey]
else:
ServerInfoDict='No key found (%s/%s)' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)
testlog=open('%s/tests-log.xml' % TMPDIR,'a')
testlog.seek(0,2)
testlog.write(' &lt;/results&gt;\n')
testlog.write(' &lt;identification&gt;\n')
testlog.write(' &lt;version&gt;\n')
testlog.write(' %s\n' % ServerVersion)
testlog.write(' &lt;/version&gt;\n')
testlog.write(' &lt;buildid&gt;\n')
testlog.write(' %s\n' % ServerBuildId)
testlog.write(' &lt;/buildid&gt;\n')
testlog.write(' &lt;revision&gt;\n')
testlog.write(' %s\n' % ServerSvnRevision)
testlog.write(' &lt;/revision&gt;\n')
testlog.write(' &lt;platform&gt;\n')
testlog.write(' %s\n' % ServerSystemOS)
testlog.write(' &lt;/platform&gt;\n')
testlog.write(' &lt;jvm-version&gt;\n')
testlog.write(' %s\n' % ServerJVMVersion)
testlog.write(' &lt;/jvm-version&gt;\n')
testlog.write(' &lt;jvm-vendor&gt;\n')
testlog.write(' %s\n' % ServerJVMVendor)
testlog.write(' &lt;/jvm-vendor&gt;\n')
testlog.write(' &lt;/identification&gt;\n')
testlog.write(' &lt;/functional-tests&gt;\n')
testlog.write('&lt;/qa&gt;\n')
testlog.close()
</script>
</sequence>
</function>
</stax>