| opends/tests/functional-tests/shared/functions/baselib.xml | ●●●●● patch | view | raw | blame | history | |
| opends/tests/functional-tests/shared/functions/dsadm.xml | ●●●●● patch | view | raw | blame | history | |
| opends/tests/functional-tests/shared/functions/environment.xml | ●●●●● patch | view | raw | blame | history | |
| opends/tests/functional-tests/shared/functions/stafcmd.xml | ●●●●● patch | view | raw | blame | history | |
| opends/tests/functional-tests/shared/python/common.py | ●●●●● patch | view | raw | blame | history | |
| opends/tests/functional-tests/shared/xsl/gen-alltests-report.xsl | ●●●●● patch | view | raw | blame | history | |
| opends/tests/functional-tests/testcases/runTestJob.xml | ●●●●● patch | view | raw | blame | history |
opends/tests/functional-tests/shared/functions/baselib.xml
New file @@ -0,0 +1,133 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE stax SYSTEM "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 ! ! Portions Copyright 2007 Sun Microsystems, Inc. ! --> <stax> <function name="GetDirectoryServerVars"> <function-prolog> This function gets variables associated with the Directory Server </function-prolog> <function-map-args> <function-arg-def name="location" type="optional" default="'%s' % STAXServiceMachine"> <function-arg-description> Location of target host </function-arg-description> <function-arg-property name="type" value="hostname"/> </function-arg-def> <function-arg-def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)"> <function-arg-description> Pathname to installation root </function-arg-description> <function-arg-property name="type" value="hostname"/> </function-arg-def> </function-map-args> <sequence> <script> mylocation=location mypath=dsPath DSInfo=directory_server_information() </script> <message>'Get Information about server %s' % dsPath</message> <!-- Obtain the variables for the system from start-ds --> <call function="'StartDsWithScript'"> { 'location' : mylocation, 'dsPath' : mypath, 'dsSystemInfo' : 'true' } </call> <script> DSInfo.SystemList=STAXResult[1].split('\n') DSInfo.ServerDict['server version']= \ DSInfo.getServerVersion(DSInfo.SystemList[0]) for DSInfo.line in DSInfo.SystemList: DSInfo.key=DSInfo.line[0:DSInfo.line.find(':')].strip() DSInfo.value= \ DSInfo.line[DSInfo.line.find(':')+1:len(DSInfo.line)].strip() DSInfo.SystemDict[DSInfo.key]=DSInfo.value DSInfo.ServerDict['server buildid']= \ DSInfo.getServerValueFromKey('Build ID',DSInfo.SystemDict) DSInfo.ServerDict['java version']= \ DSInfo.getServerValueFromKey('Java Version',DSInfo.SystemDict) DSInfo.ServerDict['java vendor']= \ DSInfo.getServerValueFromKey('Java Vendor',DSInfo.SystemDict) DSInfo.ServerDict['jvm version']= \ DSInfo.getServerValueFromKey('JVM Version',DSInfo.SystemDict) DSInfo.ServerDict['jvm vendor']= \ DSInfo.getServerValueFromKey('JVM Vendor',DSInfo.SystemDict) DSInfo.ServerDict['system os']= \ DSInfo.getServerValueFromKey('Operating System',DSInfo.SystemDict) DSInfo.ServerDict['system name']= \ DSInfo.getServerValueFromKey('System Name',DSInfo.SystemDict) DSInfoServersDict[dsPath]=DSInfo.ServerDict </script> <!-- Obtain the secret variables for the system from start-ds --> <call function="'StartDsWithScript'"> { 'location' : mylocation, 'dsPath' : mypath, 'dsBuildInfo' : 'true' } </call> <script> DSInfo.SystemList=STAXResult[1].split('\n') for DSInfo.line in DSInfo.SystemList: DSInfo.key=DSInfo.line[0:DSInfo.line.find(':')].strip() DSInfo.value= \ DSInfo.line[DSInfo.line.find(':')+1:len(DSInfo.line)].strip() DSInfo.SystemDict[DSInfo.key]=DSInfo.value DSInfo.ServerDict['svn revision']= \ DSInfo.getServerValueFromKey('Revision Number',DSInfo.SystemDict) DSInfo.ServerDict['major version']= \ DSInfo.getServerValueFromKey('Major Version',DSInfo.SystemDict) DSInfo.ServerDict['minor version']= \ DSInfo.getServerValueFromKey('Minor Version',DSInfo.SystemDict) DSInfo.ServerDict['point version']= \ DSInfo.getServerValueFromKey('Point Version',DSInfo.SystemDict) DSInfo.ServerDict['version qualifier']= \ DSInfo.getServerValueFromKey('Version Qualifier',DSInfo.SystemDict) DSInfo.ServerDict['fix ids']= \ DSInfo.getServerValueFromKey('Fix IDs',DSInfo.SystemDict) DSInfo.ServerDict['debug build']= \ DSInfo.getServerValueFromKey('Debug Build',DSInfo.SystemDict) </script> </sequence> </function> </stax> opends/tests/functional-tests/shared/functions/dsadm.xml
@@ -26,7 +26,7 @@ ! Portions Copyright 2006-2007 Sun Microsystems, Inc. ! --> <stax> <!-- This function configures DS using the configure-ds script --> <function name="ConfigureDsWithScript"> <function-prolog> @@ -189,7 +189,13 @@ Help option </function-arg-description> <function-arg-property name="type" value="option"/> </function-arg-def> </function-arg-def> <function-arg-def name="dsBuildInfo" type="optional"> <function-arg-description> Directory server build information </function-arg-description> <function-arg-property name="type" value="option"/> </function-arg-def> </function-map-args> <sequence> @@ -214,6 +220,9 @@ if dsHelp: STAFCmdParamsList.append('-H') if dsBuildInfo: STAFCmdParamsList.append('-F') STAFCmdParams=' '.join(STAFCmdParamsList) </script> @@ -234,12 +243,19 @@ <stderr mode="'stdout'"/> <returnstdout/> </process> <script> startRC=RC startResult=STAXResult </script> <call function="'checkRC'"> { 'returncode' : RC , 'result' : STAXResult } { 'returncode' : startRC , 'result' : startResult } </call> <return>startResult[0]</return> </sequence> </function> opends/tests/functional-tests/shared/functions/environment.xml
@@ -36,6 +36,9 @@ <!--- Import all the shared xml libraries --> <import machine="'%s' % (STAF_LOCAL_HOSTNAME)" file="'%s/baselib.xml' % (TESTS_FUNCTIONS_DIR)" /> <import machine="'%s' % (STAF_LOCAL_HOSTNAME)" file="'%s/utils.xml' % (TESTS_FUNCTIONS_DIR)" /> <import machine="'%s' % (STAF_LOCAL_HOSTNAME)" @@ -139,6 +142,7 @@ <!-- Initialize any global variables --> <script> CurrentTestPath={} DSInfoServersDict={} True = 1 False = 0 </script> @@ -147,8 +151,45 @@ </sequence> </function> <function name="GetDirectoryServerInformation"> <function-prolog> This function gets information about the Directory Server </function-prolog> <sequence> <!-- Install DS into temporary folder --> <message> 'Extract temporary DS zip archive to %s.' % (TMPDIR) </message> <call function="'unZipFile'"> { 'location' : STAF_LOCAL_HOSTNAME, 'zipfile' : '%s/%s' % (ZIPPATH,ZIPNAME), 'unzipdir' : '%s' % TMPDIR } </call> <!-- Get Directory Server Variables --> <call function="'GetDirectoryServerVars'"> { 'location' : STAF_LOCAL_HOSTNAME, 'dsPath' : '%s/%s' % (TMPDIR,OPENDSNAME) } </call> <!-- Set Directory Server Variables --> <call function="'SetVar'"> { 'location' : STAF_LOCAL_HOSTNAME, 'type' : 'shared', 'variable' : 'ServerInfo=%s' % DSInfoServersDict } </call> <!-- Uninstall DS from temporary folder --> <message>'Remove temporary DS zip archive'</message> <call function="'deleteFolder'"> { 'location' : STAF_LOCAL_HOSTNAME , 'foldername' : '%s/%s' % (TMPDIR,OPENDSNAME) } </call> </sequence> </function> <function name="loadEnvironment"> @@ -173,7 +214,8 @@ <call function="'prepareInstanceCreation'"></call> --> <call function="'GetDirectoryServerInformation'"/> <call function="'checkRC'"> { 'returncode' : RC , 'result' : STAXResult } opends/tests/functional-tests/shared/functions/stafcmd.xml
@@ -402,7 +402,6 @@ </function> <function name="queryLogs"> <function-prolog> @@ -448,4 +447,127 @@ </function> <function name="SetVar"> <function-prolog> Sets a variable in the staf var service </function-prolog> <function-map-args> <function-arg-def name="location" type="optional" default="'%s' % STAXServiceMachine"> <function-arg-description> Location of target host </function-arg-description> <function-arg-property name="type" value="hostname"/> </function-arg-def> <function-arg-def name="type" type="required"> <function-arg-description> Name of file to be deleted </function-arg-description> <function-arg-property name="type" value="variable"/> </function-arg-def> <function-arg-def name="variable" type="required"> <function-arg-description> Name of file to be deleted </function-arg-description> <function-arg-property name="type" value="variable"/> </function-arg-def> </function-map-args> <sequence> <message>'Set %s Variable %s' % (type,variable)</message> <stafcmd name="'STAF Command: Set Var.'"> <location>'%s' % location</location> <service>'var'</service> <request>'SET %s VAR %s' % (type,variable)</request> </stafcmd> </sequence> </function> <function name="GetVar"> <function-prolog> Gets a variable in the staf var service </function-prolog> <function-map-args> <function-arg-def name="location" type="optional" default="'%s' % STAXServiceMachine"> <function-arg-description> Location of target host </function-arg-description> <function-arg-property name="type" value="hostname"/> </function-arg-def> <function-arg-def name="type" type="required"> <function-arg-description> Name of file to be deleted </function-arg-description> <function-arg-property name="type" value="variable"/> </function-arg-def> <function-arg-def name="variable" type="required"> <function-arg-description> Name of file to be deleted </function-arg-description> <function-arg-property name="type" value="variable"/> </function-arg-def> </function-map-args> <sequence> <message>'Get %s Variable %s' % (type,variable)</message> <stafcmd name="'STAF Command: Get Var.'"> <location>'%s' % location</location> <service>'var'</service> <request>'GET %s VAR %s' % (type,variable)</request> </stafcmd> </sequence> </function> <function name="ResolveVar"> <function-prolog> Resolve a variable in the staf var service </function-prolog> <function-map-args> <function-arg-def name="location" type="optional" default="'%s' % STAXServiceMachine"> <function-arg-description> Location of target host </function-arg-description> <function-arg-property name="type" value="hostname"/> </function-arg-def> <function-arg-def name="type" type="required"> <function-arg-description> Name of file to be deleted </function-arg-description> <function-arg-property name="type" value="variable"/> </function-arg-def> <function-arg-def name="string" type="required"> <function-arg-description> Name of file to be deleted </function-arg-description> <function-arg-property name="type" value="string"/> </function-arg-def> </function-map-args> <sequence> <message>'Resolve %s Variable %s' % (type,string)</message> <stafcmd name="'STAF Command: Resolve Var.'"> <location>'%s' % location</location> <service>'var'</service> <request>'RESOLVE %s STRING {%s}' % (type,string)</request> </stafcmd> </sequence> </function> </stax> opends/tests/functional-tests/shared/python/common.py
@@ -29,7 +29,7 @@ # $Source$ # public symbols __all__ = [ "format_testcase" ] __all__ = [ "format_testcase", "directory_server_information" ] class format_testcase: "Format the Test name objects" @@ -46,3 +46,27 @@ self.name=string.strip() self.name=self.name.replace(' ','-') return '%s' % self.name class directory_server_information: "Container for Information about Directory Servers" def __init__(self): self.line='' self.key='' self.value='' self.VersionList=[] self.SystemList=[] self.ServerDict={} self.SystemDict={} def getServerVersion(self,string): return string.replace("OpenDS Directory Server ","") def getServerBuildId(self,string): return string.replace("Build ","") def getServerValueFromString(self,string): return string[string.find(':') +1:len(string)].strip() def getServerValueFromKey(self,string,result): return result[string] opends/tests/functional-tests/shared/xsl/gen-alltests-report.xsl
@@ -4,6 +4,17 @@ <xsl:template match="/"> <!--- Test Report Header Variables --> <xsl:variable name="identification" select="qa/functional-tests/identification"/> <xsl:variable name="version" select="$identification/version"/> <xsl:variable name="buildid" select="$identification/buildid"/> <xsl:variable name="revision" select="$identification/revision"/> <xsl:variable name="testcase" select="qa/functional-tests/results/testgroup/testsuite/testcase"/> <xsl:variable name="total-tests" select="count($testcase)"/> <xsl:variable name="pass-tests" select="count($testcase[@result='pass'])"/> <xsl:variable name="fail-tests" select="count($testcase[@result='fail'])"/> <xsl:variable name="inconc-tests" select="count($testcase[@result='unknown'])"/> <xsl:element name="html"> <xsl:element name="head"> @@ -19,28 +30,20 @@ <link rel="stylesheet" href="https://opends.dev.java.net/public/css/opends.css" type="text/css" /> <xsl:element name="title"> <xsl:value-of select="'Test Report'"/> <xsl:value-of select="concat('Test Report for OpenDS ',$version)"/> </xsl:element> </xsl:element> </xsl:element> <table class="tertmasttable" width="100%" cellspacing="0"> <tbody> <tr> <td><div class="collectionheader">Test Report</div></td> <td><div class="collectionheader"><xsl:value-of select="concat('Test Report for OpenDS ',$version)"/></div></td> <td width="10%"><a href="https://opends.dev.java.net/"><img src="https://opends.dev.java.net/public/images/opends_logo_sm.png" alt="OpenDS Logo" width="104" height="33" border="0" align="middle" /></a> </td> </tr> </tbody> </table> <!--- Test Report Header Variables --> <xsl:variable name="identification" select="qa/functional-tests/identification"/> <xsl:variable name="testcase" select="qa/functional-tests/results/testgroup/testsuite/testcase"/> <xsl:variable name="total-tests" select="count($testcase)"/> <xsl:variable name="pass-tests" select="count($testcase[@result='pass'])"/> <xsl:variable name="fail-tests" select="count($testcase[@result='fail'])"/> <xsl:variable name="inconc-tests" select="count($testcase[@result='unknown'])"/> <!-- Overall Test Percentage --> <xsl:variable name="percent-tests"> <xsl:choose> @@ -117,6 +120,22 @@ <xsl:value-of select="'center'"/> </xsl:attribute> <xsl:element name="b"> <xsl:value-of select="'Build'"/> </xsl:element> </xsl:element> <xsl:element name="td"> <xsl:attribute name="align"> <xsl:value-of select="'center'"/> </xsl:attribute> <xsl:element name="b"> <xsl:value-of select="'Revision'"/> </xsl:element> </xsl:element> <xsl:element name="td"> <xsl:attribute name="align"> <xsl:value-of select="'center'"/> </xsl:attribute> <xsl:element name="b"> <xsl:value-of select="'Platform'"/> </xsl:element> </xsl:element> @@ -125,7 +144,7 @@ <xsl:value-of select="'center'"/> </xsl:attribute> <xsl:element name="b"> <xsl:value-of select="'Hardware'"/> <xsl:value-of select="'JVM Version'"/> </xsl:element> </xsl:element> <xsl:element name="td"> @@ -133,9 +152,9 @@ <xsl:value-of select="'center'"/> </xsl:attribute> <xsl:element name="b"> <xsl:value-of select="'Java Version'"/> <xsl:value-of select="'JVM Vendor'"/> </xsl:element> </xsl:element> </xsl:element> <xsl:element name="td"> <xsl:attribute name="align"> <xsl:value-of select="'center'"/> @@ -175,6 +194,22 @@ <xsl:value-of select="'center'"/> </xsl:attribute> <xsl:element name="b"> <xsl:value-of select="$identification/buildid"/> </xsl:element> </xsl:element> <xsl:element name="td"> <xsl:attribute name="align"> <xsl:value-of select="'center'"/> </xsl:attribute> <xsl:element name="b"> <xsl:value-of select="$identification/revision"/> </xsl:element> </xsl:element> <xsl:element name="td"> <xsl:attribute name="align"> <xsl:value-of select="'center'"/> </xsl:attribute> <xsl:element name="b"> <xsl:value-of select="$identification/platform"/> </xsl:element> </xsl:element> @@ -183,7 +218,7 @@ <xsl:value-of select="'center'"/> </xsl:attribute> <xsl:element name="b"> <xsl:value-of select="$identification/hardware"/> <xsl:value-of select="$identification/jvm-version"/> </xsl:element> </xsl:element> <xsl:element name="td"> @@ -191,9 +226,9 @@ <xsl:value-of select="'center'"/> </xsl:attribute> <xsl:element name="b"> <xsl:value-of select="$identification/jvm"/> <xsl:value-of select="$identification/jvm-vendor"/> </xsl:element> </xsl:element> </xsl:element> <xsl:element name="td"> <xsl:attribute name="align"> <xsl:value-of select="'center'"/> @@ -359,7 +394,7 @@ </xsl:element> </xsl:element> </xsl:element> </xsl:template> opends/tests/functional-tests/testcases/runTestJob.xml
@@ -59,6 +59,84 @@ </else> </if> <!--- Import required shared xml libraries --> <import machine="'%s' % (STAF_LOCAL_HOSTNAME)" file="'%s/stafcmd.xml' % (TESTS_FUNCTIONS_DIR)" /> <!-- Get Directory Server Variables --> <call function="'GetVar'"> { 'location' : STAF_REMOTE_HOSTNAME, 'type' : 'shared', 'variable' : 'ServerInfo' } </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' % (TMPDIR,OPENDSNAME)): ServerInfoDict=ServersInfoDict['%s/%s' % (TMPDIR,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)' % (TMPDIR,OPENDSNAME) </script> <message>'Server= %s' % ServerInfoDict </message> <stafcmd name="'STAF Command: Log Query All'"> <location>'%s' % STAF_LOCAL_HOSTNAME </location> <service>'log'</service> @@ -219,15 +297,24 @@ xmlfh.write('<qa>\n') xmlfh.write(' <functional-tests>\n') xmlfh.write(' <identification>\n') xmlfh.write(' <version>\n') xmlfh.write(' %s\n' % ServerVersion) xmlfh.write(' </version>\n') xmlfh.write(' <buildid>\n') xmlfh.write(' %s\n' % ServerBuildId) xmlfh.write(' </buildid>\n') xmlfh.write(' <revision>\n') xmlfh.write(' %s\n' % ServerSvnRevision) xmlfh.write(' </revision>\n') xmlfh.write(' <platform>\n') xmlfh.write(' %s\n' % TEST_OS_STRING) xmlfh.write(' %s\n' % ServerSystemOS) xmlfh.write(' </platform>\n') xmlfh.write(' <hardware>\n') xmlfh.write(' %s\n' % TEST_HW_STRING) xmlfh.write(' </hardware>\n') xmlfh.write(' <jvm>\n') xmlfh.write(' %s\n' % TEST_JVM_STRING) xmlfh.write(' </jvm>\n') xmlfh.write(' <jvm-version>\n') xmlfh.write(' %s\n' % ServerJVMVersion) xmlfh.write(' </jvm-version>\n') xmlfh.write(' <jvm-vendor>\n') xmlfh.write(' %s\n' % ServerJVMVendor) xmlfh.write(' </jvm-vendor>\n') xmlfh.write(' </identification>\n') xmlfh.write(' <results>\n') </script>