From 75ace4eb028a63acfc8d6933eaa4f209400ace8f Mon Sep 17 00:00:00 2001
From: andrug <andrug@localhost>
Date: Thu, 22 May 2008 11:06:00 +0000
Subject: [PATCH] use percentage result for specific phase (scheduler,verdict)
---
opends/tests/system-tests/phases/scheduler/scheduler.xml | 35 +++
opends/tests/system-tests/phases/shared/functions/ldap.xml | 8
opends/tests/system-tests/phases/verdict/verdict.xml | 127 ++++++++++++-
opends/tests/system-tests/phases/generateLdif/generateLdif.xml | 13 +
opends/tests/system-tests/phases/installation/installation.xml | 13 +
opends/tests/system-tests/phases/shared/functions/opendstools.xml | 5
opends/tests/system-tests/phases/parser/parser.py | 48 +++++
opends/tests/system-tests/phases/shared/functions/utils.xml | 43 ++--
opends/tests/system-tests/phases/configuration/configuration.xml | 13 +
opends/tests/system-tests/report/result.xsl | 42 +++-
opends/tests/system-tests/report/clientDetails.xsl | 1
opends/tests/system-tests/scenario/sample2/pre_configuration.xml | 13 +
opends/tests/system-tests/scenario/sample2/post_configuration.xml | 13 +
opends/tests/system-tests/phases/log/log.xml | 54 ++---
opends/tests/system-tests/phases/main_run.xml | 70 ++++---
15 files changed, 362 insertions(+), 136 deletions(-)
diff --git a/opends/tests/system-tests/phases/configuration/configuration.xml b/opends/tests/system-tests/phases/configuration/configuration.xml
index 19aae17..799a983 100755
--- a/opends/tests/system-tests/phases/configuration/configuration.xml
+++ b/opends/tests/system-tests/phases/configuration/configuration.xml
@@ -33,6 +33,11 @@
<!-- ************************************************************ -->
<function name="configuration" scope="local">
<function-map-args>
+ <function-arg-def name="phase" type="required">
+ <function-arg-description>
+ phase object
+ </function-arg-description>
+ </function-arg-def>
<function-arg-def name="instances" type="required">
<function-arg-description>
list of instances classes
@@ -48,8 +53,8 @@
<sequence>
<!-- == Call preambule == -->
<call function="'phasePreamble'">
- { 'phaseName' : 'configuration' ,
- 'fileFd' : LOG_MAIN_FD }
+ { 'phase' : PHASE_CONFIGURATION,
+ 'fileFd' : LOG_MAIN_FD }
</call>
<import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
@@ -105,8 +110,8 @@
<!-- == Call postphase == -->
<call function="'phasePostamble'">
{
- 'phaseName' : 'configuration',
- 'fileFd' : LOG_MAIN_FD
+ 'phase' : PHASE_CONFIGURATION,
+ 'fileFd' : LOG_MAIN_FD
}
</call>
diff --git a/opends/tests/system-tests/phases/generateLdif/generateLdif.xml b/opends/tests/system-tests/phases/generateLdif/generateLdif.xml
index e66d9ec..9abb6ef 100755
--- a/opends/tests/system-tests/phases/generateLdif/generateLdif.xml
+++ b/opends/tests/system-tests/phases/generateLdif/generateLdif.xml
@@ -33,6 +33,11 @@
<!-- ************************************************************ -->
<function name="generateLdif" scope="local">
<function-map-args>
+ <function-arg-def name="phase" type="required">
+ <function-arg-description>
+ phase object
+ </function-arg-description>
+ </function-arg-def>
<function-arg-def name="suffix" type="required">
<function-arg-description>
suffix
@@ -43,8 +48,8 @@
<sequence>
<!--========== Call preambule =========-->
<call function="'phasePreamble'">
- { 'phaseName' : 'generateLdif' ,
- 'fileFd' : LOG_MAIN_FD }
+ { 'phase' : phase,
+ 'fileFd' : LOG_MAIN_FD }
</call>
<!--========== Define variables =========-->
@@ -248,8 +253,8 @@
<!--========== Call postphase =========-->
<call function="'phasePostamble'">
{
- 'phaseName' : 'generateLdif',
- 'fileFd' : LOG_MAIN_FD
+ 'phase' : phase,
+ 'fileFd' : LOG_MAIN_FD
}
</call>
diff --git a/opends/tests/system-tests/phases/installation/installation.xml b/opends/tests/system-tests/phases/installation/installation.xml
index 884b71b..2234203 100755
--- a/opends/tests/system-tests/phases/installation/installation.xml
+++ b/opends/tests/system-tests/phases/installation/installation.xml
@@ -33,6 +33,11 @@
<!-- ************************************************************ -->
<function name="installation" scope="local">
<function-map-args>
+ <function-arg-def name="phase" type="required">
+ <function-arg-description>
+ phase object
+ </function-arg-description>
+ </function-arg-def>
<function-arg-def name="instances" type="required">
<function-arg-description>
list of instances
@@ -49,8 +54,8 @@
<sequence>
<!--========== Call preambule =========-->
<call function="'phasePreamble'">
- { 'phaseName' : 'installation' ,
- 'fileFd' : LOG_MAIN_FD }
+ { 'phase' : phase,
+ 'fileFd' : LOG_MAIN_FD }
</call>
<import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
@@ -93,8 +98,8 @@
<!--========== Call postphase =========-->
<call function="'phasePostamble'">
{
- 'phaseName' : 'installation',
- 'fileFd' : LOG_MAIN_FD
+ 'phase' : phase,
+ 'fileFd' : LOG_MAIN_FD
}
</call>
diff --git a/opends/tests/system-tests/phases/log/log.xml b/opends/tests/system-tests/phases/log/log.xml
index dfb2772..171534a 100755
--- a/opends/tests/system-tests/phases/log/log.xml
+++ b/opends/tests/system-tests/phases/log/log.xml
@@ -114,48 +114,36 @@
</function-map-args>
<sequence>
<script>
+ def writeSummaryTag(objPhase):
+ if objPhase.getRun() == 'true':
+ str = '<phaseSummmary'
+ str = '%s name=\"%s\"' % (str,objPhase.getName())
+ str = '%s errNum=\"%s\"' % (str,objPhase.getErrNum())
+ str = '%s percentage=\"%s\"' % (str,objPhase.getPercentage())
+ str = '%s start=\"%s\"' % (str,objPhase.getStartTime())
+ str = '%s stop=\"%s\"' % (str,objPhase.getStopTime())
+ str = '%s/>\n' % str
+ fileFd.write(str)
+
+
fileFd.write('<summary>\n')
# write scenario informations into summary part
str = '<scenario name=\"%s\"' % scenario.getName()
str = '%s duration=\"%s%s\" >\n' % \
(str,scenario.getDurationTime(),scenario.getDurationUnit())
- str = '%s %s \n</scenario>' % \
+ str = '%s %s \n</scenario>\n' % \
(str,scenario.getDescription())
fileFd.write(str)
- if ERR_NUM_PARSER != '':
- str = '<phaseSummmary name=\"parser\" result=\"%s\"/>\n' % \
- ERR_NUM_PARSER
- fileFd.write(str)
- if ERR_NUM_INSTALL != '':
- str = '<phaseSummmary name=\"installation\" result=\"%s\"/>\n'%\
- ERR_NUM_INSTALL
- fileFd.write(str)
- if ERR_NUM_GEN_LDIF != '':
- str = '<phaseSummmary name=\"generateLdif\" result=\"%s\"/>\n'%\
- ERR_NUM_GEN_LDIF
- fileFd.write(str)
- if ERR_NUM_PRE_CONFIGURATION != '':
- str = '<phaseSummmary name=\"preconfiguration\" result=\"%s\"/>\n'%\
- ERR_NUM_PRE_CONFIGURATION
- fileFd.write(str)
- if ERR_NUM_CONFIGURATION != '':
- str = '<phaseSummmary name=\"configuration\" result=\"%s\"/>\n'%\
- ERR_NUM_CONFIGURATION
- fileFd.write(str)
- if ERR_NUM_POST_CONFIGURATION != '':
- str = '<phaseSummmary name=\"postconfiguration\" result=\"%s\"/>\n'%\
- ERR_NUM_POST_CONFIGURATION
- fileFd.write(str)
- if ERR_NUM_SCHEDULER != '':
- str = '<phaseSummmary name=\"scheduler\" result=\"%s\"/>\n' % \
- ERR_NUM_SCHEDULER
- fileFd.write(str)
- if ERR_NUM_VERDICT != '':
- str = '<phaseSummmary name=\"verdict\" result=\"%s\"/>\n' % \
- ERR_NUM_VERDICT
- fileFd.write(str)
+ writeSummaryTag(PHASE_PARSER)
+ writeSummaryTag(PHASE_INSTALLATION)
+ writeSummaryTag(PHASE_GEN_LDIF)
+ writeSummaryTag(PHASE_PRE_CONFIGURATION)
+ writeSummaryTag(PHASE_CONFIGURATION)
+ writeSummaryTag(PHASE_POST_CONFIGURATION)
+ writeSummaryTag(PHASE_SCHEDULER)
+ writeSummaryTag(PHASE_VERDICT)
fileFd.write('</summary>\n')
</script>
diff --git a/opends/tests/system-tests/phases/main_run.xml b/opends/tests/system-tests/phases/main_run.xml
index 43f0b94..e04a49f 100644
--- a/opends/tests/system-tests/phases/main_run.xml
+++ b/opends/tests/system-tests/phases/main_run.xml
@@ -101,15 +101,7 @@
DOMAIN[0] = ''
ERR_NUM = STAXGlobal([0])
- ERR_NUM_PARSER = ''
- ERR_NUM_INSTALL = ''
- ERR_NUM_GEN_LDIF = ''
- ERR_NUM_PRE_CONFIGURATION = ''
- ERR_NUM_CONFIGURATION = ''
- ERR_NUM_POST_CONFIGURATION = ''
- ERR_NUM_SCHEDULER = ''
- ERR_NUM_VERDICT = ''
- ERR_NUM_TOTAL = 0
+ ERR_NUM_TOTAL = 0
SHARED_FUNC_DIR = '%s/phases/shared/functions' % TESTS_DIR
</script>
@@ -181,6 +173,19 @@
LOG_MAIN_FD.write(str)
</script>
+ <!-- ======= Create object for each phase ====================== -->
+ <script>
+ sys.path.append("%s/phases/parser" % TESTS_DIR )
+ from parser import *
+ PHASE_PARSER = Phase('parser')
+ PHASE_INSTALLATION = Phase('installation')
+ PHASE_GEN_LDIF = Phase('generateldif')
+ PHASE_PRE_CONFIGURATION = Phase('preconfiguration')
+ PHASE_CONFIGURATION = Phase('configuration')
+ PHASE_POST_CONFIGURATION = Phase('postconfiguration')
+ PHASE_SCHEDULER = Phase('scheduler')
+ PHASE_VERDICT = Phase('verdict')
+ </script>
<!-- ============ PARSER ======================================= -->
<import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
@@ -193,10 +198,11 @@
suffix = result[2]
scheduler = result[3]
scenario = result[4]
- ERR_NUM_PARSER = ERR_NUM[0]
+ PHASE_PARSER.setRun('true')
+ PHASE_PARSER.setErrNum(ERR_NUM[0])
ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0]
</script>
- <if expr="ERR_NUM_PARSER != 0">
+ <if expr="PHASE_PARSER.getErrNum() != 0">
<return/>
</if>
@@ -223,13 +229,13 @@
file="'%s/phases/installation/installation.xml' % (TESTS_DIR)"/>
<call function="'installation'">
{
+ 'phase' : PHASE_INSTALLATION,
'instances' : instances,
'suffix' : suffix
}
</call>
<script>
- ERR_NUM_INSTALL = ERR_NUM[0]
- ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0]
+ ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0]
</script>
</sequence>
</if>
@@ -249,15 +255,15 @@
<import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
file="'%s' % preConfigurationFile"/>
<call function="'preConfiguration'">
- {
+ {
+ 'phase' : PHASE_PRE_CONFIGURATION,
'instances' : instances,
'suffix' : suffix,
'scheduler' : scheduler
}
</call>
<script>
- ERR_NUM_PRE_CONFIGURATION = ERR_NUM[0]
- ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0]
+ ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0]
</script>
</sequence>
<else>
@@ -281,11 +287,13 @@
<import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
file="'%s/phases/generateLdif/generateLdif.xml' % (TESTS_DIR)"/>
<call function="'generateLdif'">
- { 'suffix' : suffix }
+ {
+ 'phase' : PHASE_GEN_LDIF,
+ 'suffix' : suffix
+ }
</call>
<script>
- ERR_NUM_GEN_LDIF = ERR_NUM[0]
- ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0]
+ ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0]
</script>
</sequence>
</if>
@@ -298,13 +306,13 @@
file="'%s/phases/configuration/configuration.xml' % TESTS_DIR"/>
<call function="'configuration'">
{
+ 'phase' : PHASE_CONFIGURATION,
'instances' : instances ,
'suffix' : suffix
}
</call>
<script>
- ERR_NUM_CONFIGURATION = ERR_NUM[0]
- ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0]
+ ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0]
</script>
</sequence>
</if>
@@ -325,14 +333,14 @@
file="'%s' % postConfigurationFile"/>
<call function="'postConfiguration'">
{
+ 'phase' : PHASE_POST_CONFIGURATUON,
'instances' : instances,
'suffix' : suffix,
'scheduler' : scheduler
}
</call>
<script>
- ERR_NUM_POST_CONFIGURATION = ERR_NUM[0]
- ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0]
+ ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0]
</script>
</sequence>
<else>
@@ -365,6 +373,7 @@
file="'%s/phases/scheduler/scheduler.xml' % (TESTS_DIR)"/>
<call function="'scheduler'">
{
+ 'phase' : PHASE_SCHEDULER,
'instances' : instances,
'suffix' : suffix,
'scheduler' : scheduler,
@@ -372,8 +381,7 @@
}
</call>
<script>
- ERR_NUM_SCHEDULER = ERR_NUM[0]
- ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0]
+ ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0]
</script>
</sequence>
</if>
@@ -395,20 +403,21 @@
<import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
file="'%s/phases/verdict/verdict.xml' % (TESTS_DIR)"/>
<call function="'verdict'">
- { 'instances' : instances,
+ {
+ 'phase' : PHASE_VERDICT,
+ 'instances' : instances,
'suffix' : suffix,
'runConfiguration' : runConfiguration,
'runScheduler' : runScheduler
}
</call>
<script>
- ERR_NUM_VERDICT = ERR_NUM[0]
- ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0]
+ ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0]
</script>
<!-- ====== Write information phases to xml report ============ -->
<!-- == Write phase summary == -->
- <!-- (this function is in log phase and use ERR_NUM_* variables) -->
+ <!-- this function is in log/log.xml file -->
<call function="'writeSummary'">
{
'scenario' : scenario,
@@ -424,9 +433,10 @@
}
</call>
+
</sequence>
- </function>
+ </function>
</stax>
diff --git a/opends/tests/system-tests/phases/parser/parser.py b/opends/tests/system-tests/phases/parser/parser.py
index 87db426..cbaa8fd 100755
--- a/opends/tests/system-tests/phases/parser/parser.py
+++ b/opends/tests/system-tests/phases/parser/parser.py
@@ -54,6 +54,54 @@
#
+# Class for phases
+#
+class Phase:
+ "Describes the phase of a system test run"
+ def __init__(self, name):
+ self.name = name
+ self.run = 'false'
+ self.start = NOT_DEFINED
+ self.stop = NOT_DEFINED
+ self.errNum = NOT_DEFINED
+ self.percentage = NOT_DEFINED
+
+ def getName(self):
+ return self.name
+
+ def setRun(self,run):
+ self.run = run
+
+ def getRun(self):
+ return self.run
+
+ def setStartTime(self,start):
+ self.start = start
+
+ def getStartTime(self):
+ return self.start
+
+ def setStopTime(self,stop):
+ self.stop = stop
+
+ def getStopTime(self):
+ return self.stop
+
+ def setErrNum(self,errNum):
+ self.errNum = errNum
+
+ def getErrNum(self):
+ return self.errNum
+
+ def setPercentage(self,percentage):
+ self.percentage = percentage
+
+ def getPercentage(self):
+ return self.percentage
+
+
+
+#
# Class for suffix
#
diff --git a/opends/tests/system-tests/phases/scheduler/scheduler.xml b/opends/tests/system-tests/phases/scheduler/scheduler.xml
index 947c6a2..471bb67 100755
--- a/opends/tests/system-tests/phases/scheduler/scheduler.xml
+++ b/opends/tests/system-tests/phases/scheduler/scheduler.xml
@@ -33,6 +33,11 @@
<!-- ************************************************************ -->
<function name="scheduler" scope="local">
<function-map-args>
+ <function-arg-def name="phase" type="required">
+ <function-arg-description>
+ phase object
+ </function-arg-description>
+ </function-arg-def>
<function-arg-def name="instances" type="required">
<function-arg-description>
instance object
@@ -64,9 +69,9 @@
tagAttr.append(['duration',durationValue])
</script>
<call function="'phasePreamble'">
- { 'phaseName' : 'scheduler' ,
- 'tagAttr' : tagAttr,
- 'fileFd' : LOG_MAIN_FD }
+ { 'phase' : phase,
+ 'tagAttr' : tagAttr,
+ 'fileFd' : LOG_MAIN_FD }
</call>
<!--==== Get the clients list from all modules ==============-->
@@ -85,20 +90,37 @@
'suffix' : suffix
}
</call>
- <!--========== Merge files ==========-->
+ <!--============ Merge files ===========-->
<call function="'mergeClientsFiles'">
{
'scheduler' : scheduler,
'fileFd' : LOG_MAIN_FD
}
</call>
+ <!--==== Calculate phase percentage ==========-->
+ <script>
+ nbClients = len(clients)
+ nbClientSuccess = 0
+ percentageResult = 0
+ </script>
+ <iterate in="clients" var="client">
+ <script>
+ if client.getResult() == 'SUCCESS':
+ nbClientSuccess += 1
+ </script>
+ </iterate>
+ <script>
+ percentageResult = nbClientSuccess * 100
+ percentageResult = percentageResult / nbClients
+ phase.setPercentage(percentageResult)
+ </script>
</sequence>
</if>
<!--========== Call postphase =========-->
<call function="'phasePostamble'">
{
- 'phaseName' : 'scheduler',
- 'fileFd' : LOG_MAIN_FD
+ 'phase' : phase,
+ 'fileFd' : LOG_MAIN_FD
}
</call>
</sequence>
@@ -417,6 +439,7 @@
<else>
<script>
result = 'FAIL'
+ ERR_NUM[0] += 1
</script>
</else>
</if>
diff --git a/opends/tests/system-tests/phases/shared/functions/ldap.xml b/opends/tests/system-tests/phases/shared/functions/ldap.xml
index dcbb138..8ced8cf 100755
--- a/opends/tests/system-tests/phases/shared/functions/ldap.xml
+++ b/opends/tests/system-tests/phases/shared/functions/ldap.xml
@@ -262,6 +262,8 @@
if instanceIndex != lastIndex:
instance2 = instances[instanceIndex + 1]
</script>
+
+
<if expr="instance2 != NOT_DEFINED">
<sequence>
<call function="'writeStartTagStep'">
@@ -323,12 +325,12 @@
ldapSearchRC = STAXResult[0]
</script>
- <if expr="(ldapSearchRC == 0) or (ldapSearchRC == 4)">
+ <if expr="ldapSearchRC != 0">
<!-- == If the reference tree could not be retrieved, == -->
<!-- == return an error == -->
<sequence>
<call function="'writeEndTagStep'">{ 'fileFd' : fileFd}</call>
- <return> [1, None] </return>
+ <return> [FALSE, None] </return>
</sequence>
</if>
@@ -354,7 +356,7 @@
ldapSearchRC = STAXResult[0]
</script>
- <if expr="(ldapSearchRC == 0) or (ldapSearchRC == 4)">
+ <if expr="ldapSearchRC == 0">
<sequence>
<!-- == Check if file is empty == -->
<call function="'isEmptyFile'">
diff --git a/opends/tests/system-tests/phases/shared/functions/opendstools.xml b/opends/tests/system-tests/phases/shared/functions/opendstools.xml
index c69f501..156ab2b 100644
--- a/opends/tests/system-tests/phases/shared/functions/opendstools.xml
+++ b/opends/tests/system-tests/phases/shared/functions/opendstools.xml
@@ -100,7 +100,9 @@
'fileFd' : fileFd
}
</call>
- <script> _errNum += STAXResult[0] </script>
+ <if expr="STAXResult[0] == FALSE">
+ <script> _errNum += 1 </script>
+ </if>
<!--== Check error/access logs =========-->
@@ -113,6 +115,7 @@
</call>
<script> _errNum += STAXResult </script>
+
<return> _errNum </return>
</sequence>
</function>
diff --git a/opends/tests/system-tests/phases/shared/functions/utils.xml b/opends/tests/system-tests/phases/shared/functions/utils.xml
index 1bc18af..2d85546 100755
--- a/opends/tests/system-tests/phases/shared/functions/utils.xml
+++ b/opends/tests/system-tests/phases/shared/functions/utils.xml
@@ -120,7 +120,10 @@
</function-prolog>
<function-map-args>
- <function-arg-def name="phaseName" type="required">
+ <function-arg-def name="phase" type="required">
+ <function-arg-description>
+ phase object
+ </function-arg-description>
</function-arg-def>
<function-arg-def name="tagAttr" type="optional" default='[]'>
<function-arg-description>
@@ -134,23 +137,24 @@
<sequence>
<!-- Start time of test suite -->
<script>
- phaseStartTime=strftime("%Y%m%d@%H:%M:%S",localtime())
+ phase.setStartTime(strftime("%Y%m%d@%H:%M:%S",localtime()))
ERR_NUM[0] = 0
if tagAttr == []:
- tagAttr = [['date',phaseStartTime]]
+ tagAttr = [['date',phase.getStartTime()]]
else:
- tagAttr.append(['date',phaseStartTime])
+ tagAttr.append(['date',phase.getStartTime()])
+
</script>
<message log="1">''</message>
<message log="1">
'=================== START PHASE %s @ %s ========================='\
- % (phaseName,phaseStartTime)
+ % (phase.getName(),phase.getStartTime())
</message>
<call function="'writeStartTagPhase'">
{
- 'tagName' : phaseName ,
+ 'tagName' : phase.getName(),
'tagAttr' : tagAttr,
'fileFd' : fileFd
}
@@ -167,9 +171,9 @@
Performs all the post operations for a phase
</function-prolog>
<function-map-args>
- <function-arg-def name="phaseName" type="required">
+ <function-arg-def name="phase" type="required">
<function-arg-description>
- Name of the phase
+ phase object
</function-arg-description>
</function-arg-def>
<function-arg-def name="fileFd" type="required">
@@ -181,25 +185,24 @@
<sequence>
- <if expr="phaseName == 'verdict'">
- <message log="1">
- '== Found a TOTAL of %s Error(s)' % (ERR_NUM[0])
- </message>
- <else>
- <message log="1">
- '== Found %s Error(s) during this phase' % (ERR_NUM[0])
- </message>
- </else>
- </if>
+ <script>
+ phase.setRun('true')
+ phase.setStopTime(strftime("%Y%m%d@%H:%M:%S",localtime()))
+ phase.setErrNum(ERR_NUM[0])
+ </script>
+
+ <message log="1">
+ '== Found %s Error(s) during this phase' % (phase.getErrNum())
+ </message>
<message log="1">
'=================== STOP PHASE %s ============================' \
- % (phaseName)
+ % (phase.getName())
</message>
<call function="'writeTag'">
{
'tagName' : 'phaseResult',
- 'tagAttr' : [['errNum',ERR_NUM[0]]] ,
+ 'tagAttr' : [['errNum',phase.getErrNum()]] ,
'fileFd' : LOG_MAIN_FD
}
</call>
diff --git a/opends/tests/system-tests/phases/verdict/verdict.xml b/opends/tests/system-tests/phases/verdict/verdict.xml
index 70e03da..50cebf4 100755
--- a/opends/tests/system-tests/phases/verdict/verdict.xml
+++ b/opends/tests/system-tests/phases/verdict/verdict.xml
@@ -33,6 +33,11 @@
<!-- ************************************************************ -->
<function name="verdict" scope="local">
<function-map-args>
+ <function-arg-def name="phase" type="required">
+ <function-arg-description>
+ phase object
+ </function-arg-description>
+ </function-arg-def>
<function-arg-def name="instances" type="required">
<function-arg-description>
list of instance objects
@@ -58,25 +63,56 @@
<sequence>
<!--========== Call preambule =========-->
<call function="'phasePreamble'">
- { 'phaseName' : 'verdict',
- 'fileFd' : LOG_MAIN_FD }
+ { 'phase' : phase,
+ 'fileFd' : LOG_MAIN_FD }
</call>
-
+ <script>
+ items = STAXGlobal([])
+ </script>
<!--== Check if previous phases raised some errors ==-->
- <if expr="ERR_NUM_INSTALL != 0 and ERR_NUM_INSTALL != ''">
- <script> ERR_NUM[0] += 1 </script>
+ <!-- installation -->
+ <call function="'checkPhaseResult'">
+ { 'phase' : PHASE_INSTALLATION }
+ </call>
+ <if expr="STAXResult != []">
+ <script> items.append(STAXResult) </script>
</if>
- <if expr="ERR_NUM_GEN_LDIF != 0 and ERR_NUM_GEN_LDIF != ''">
- <script> ERR_NUM[0] += 1 </script>
+ <!-- pre-configuration -->
+ <call function="'checkPhaseResult'">
+ { 'phase' : PHASE_PRE_CONFIGURATION }
+ </call>
+ <if expr="STAXResult != []">
+ <script> items.append(STAXResult) </script>
</if>
- <if expr="ERR_NUM_CONFIGURATION != 0 and ERR_NUM_CONFIGURATION != ''">
- <script> ERR_NUM[0] += 1 </script>
+ <!-- gen-ldif -->
+ <call function="'checkPhaseResult'">
+ { 'phase' : PHASE_GEN_LDIF }
+ </call>
+ <if expr="STAXResult != []">
+ <script> items.append(STAXResult) </script>
</if>
- <if expr="ERR_NUM_SCHEDULER != 0 and ERR_NUM_SCHEDULER != ''">
- <script> ERR_NUM[0] += 1 </script>
+ <!-- configuration -->
+ <call function="'checkPhaseResult'">
+ { 'phase' : PHASE_CONFIGURATION }
+ </call>
+ <if expr="STAXResult != []">
+ <script> items.append(STAXResult) </script>
</if>
-
+ <!-- post-configuration -->
+ <call function="'checkPhaseResult'">
+ { 'phase' : PHASE_POST_CONFIGURATION }
+ </call>
+ <if expr="STAXResult != []">
+ <script> items.append(STAXResult) </script>
+ </if>
+ <!-- scheduler -->
+ <call function="'checkPhaseResult'">
+ { 'phase' : PHASE_SCHEDULER }
+ </call>
+ <if expr="STAXResult != []">
+ <script> items.append(STAXResult) </script>
+ </if>
<!--== If configuration/schedulers phases have been run ==-->
<!--== then do some basic checks : isalive ==-->
@@ -136,6 +172,9 @@
'fileFd' : cFileFd
}
</call>
+ <script>
+ items.append(['instance %s' % instance.getName(),STAXResult])
+ </script>
</sequence>
</if>
@@ -165,11 +204,30 @@
</sequence>
</if>
+
+ <!--==== Calculate phase percentage ==========-->
+ <script>
+ nbItems = len(items)
+ nbItemSuccess = 0
+ percentageResult = 0
+ </script>
+ <iterate in="items" var="item">
+ <script>
+ if item[1] == 0:
+ nbItemSuccess += 1
+ </script>
+ </iterate>
+ <script>
+ percentageResult = nbItemSuccess * 100
+ percentageResult = percentageResult / nbItems
+ phase.setPercentage(percentageResult)
+ </script>
+
<!--========== Call postphase =========-->
<call function="'phasePostamble'">
{
- 'phaseName' : 'verdict',
- 'fileFd' : LOG_MAIN_FD
+ 'phase' : phase,
+ 'fileFd' : LOG_MAIN_FD
}
</call>
@@ -179,6 +237,47 @@
+ <!-- ************************************************************ -->
+ <function name="checkPhaseResult" scope="local">
+ <function-map-args>
+ <function-arg-def name="phase" type="required">
+ <function-arg-description>
+ phase object
+ </function-arg-description>
+ </function-arg-def>
+ </function-map-args>
+ <sequence>
+ <script>
+ result = []
+ </script>
+ <if expr="phase.getRun() == 'true'">
+ <sequence>
+ <call function="'writeStartTagOperation'">
+ { 'tagName' : 'checkPhaseResult',
+ 'fileFd' : LOG_MAIN_FD }
+ </call>
+ <call function="'writeMessage'">
+ { 'content' : 'Check number of error for %s phase' % phase.getName(),
+ 'fileFd' : LOG_MAIN_FD }
+ </call>
+ <call function="'checkRC'">
+ {
+ 'returncode' : phase.getErrNum(),
+ 'result' : '',
+ 'fileFd' : LOG_MAIN_FD
+ }
+ </call>
+ <call function="'writeEndTagOperation'">
+ {'fileFd' : LOG_MAIN_FD}
+ </call>
+ <script>
+ result = [ 'phase %s' % phase.getName() , phase.getErrNum() ]
+ </script>
+ </sequence>
+ </if>
+ <return> result </return>
+ </sequence>
+ </function>
</stax>
diff --git a/opends/tests/system-tests/report/clientDetails.xsl b/opends/tests/system-tests/report/clientDetails.xsl
index 70a5edf..624609e 100644
--- a/opends/tests/system-tests/report/clientDetails.xsl
+++ b/opends/tests/system-tests/report/clientDetails.xsl
@@ -20,6 +20,7 @@
<xsl:apply-templates select="instance"/>
<xsl:apply-templates select="operation"/>
<xsl:apply-templates select="message"/>
+ <xsl:apply-templates select="operationResult"/>
</p>
</body>
</html>
diff --git a/opends/tests/system-tests/report/result.xsl b/opends/tests/system-tests/report/result.xsl
index 1ef66d8..7d4612f 100755
--- a/opends/tests/system-tests/report/result.xsl
+++ b/opends/tests/system-tests/report/result.xsl
@@ -88,7 +88,7 @@
<xsl:with-param name="phaseName" select="'Installation'" />
</xsl:call-template>
</xsl:when>
- <xsl:when test="$phaseName = 'generateLdif'">
+ <xsl:when test="$phaseName = 'generateldif'">
<a name="generateLdif"/>
<xsl:call-template name="parsePhase">
<xsl:with-param name="phaseName" select="'GenerateLdif'" />
@@ -169,18 +169,42 @@
<a href="#{$name}"><xsl:value-of select="$name" /> </a>
</td>
<td>
- <xsl:variable name="result" select="normalize-space(@result)"/>
- <b>
+ <xsl:variable name="percentage" select="normalize-space(@percentage)"/>
<xsl:choose>
- <xsl:when test="$result='0'">
- <span class="pass">PASS</span>
+ <!-- Display percentage first if exist else the number of error -->
+ <xsl:when test="$percentage != 'ERROR_not_defined'">
+ <xsl:choose>
+ <xsl:when test="$percentage > '90'">
+ <b>
+ <span class="pass"><xsl:value-of select="$percentage"/>%</span>
+ </b>
+ </xsl:when>
+ <xsl:otherwise>
+ <b>
+ <span class="fail"><xsl:value-of select="$percentage"/>%</span>
+ </b>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:when>
+
+ <!-- Display number of error -->
<xsl:otherwise>
- <span class="fail">FAIL</span>
+ <xsl:variable name="errNum" select="normalize-space(@errNum)"/>
+ <b>
+ <xsl:choose>
+ <xsl:when test="$errNum='0'">
+ <span class="pass">PASS</span>
+ </xsl:when>
+ <xsl:otherwise>
+ <span class="fail">FAIL</span>
+ </xsl:otherwise>
+ </xsl:choose>
+ </b>
</xsl:otherwise>
- </xsl:choose>
- </b>
- </td></tr>
+ </xsl:choose>
+ </td>
+
+ </tr>
</xsl:template>
diff --git a/opends/tests/system-tests/scenario/sample2/post_configuration.xml b/opends/tests/system-tests/scenario/sample2/post_configuration.xml
index 5389031..538b31f 100644
--- a/opends/tests/system-tests/scenario/sample2/post_configuration.xml
+++ b/opends/tests/system-tests/scenario/sample2/post_configuration.xml
@@ -31,6 +31,11 @@
<function name="postConfiguration" scope="local">
<function-map-args>
+ <function-arg-def name="phase" type="required">
+ <function-arg-description>
+ phase object
+ </function-arg-description>
+ </function-arg-def>
<function-arg-def name="instances" type="required">
<function-arg-description>
list of instances classes
@@ -57,8 +62,8 @@
<!-- ================= Call preambule ======================== -->
<call function="'phasePreamble'">
- { 'phaseName' : 'postconfiguration',
- 'fileFd' : LOG_MAIN_FD }
+ { 'phase' : phase,
+ 'fileFd' : LOG_MAIN_FD }
</call>
@@ -149,8 +154,8 @@
<!-- ================= Call postambule ======================= -->
<call function="'phasePostamble'">
{
- 'phaseName' : 'postconfiguration',
- 'fileFd' : LOG_MAIN_FD
+ 'phase' : phase,
+ 'fileFd' : LOG_MAIN_FD
}
</call>
</sequence>
diff --git a/opends/tests/system-tests/scenario/sample2/pre_configuration.xml b/opends/tests/system-tests/scenario/sample2/pre_configuration.xml
index 5bec185..9f80981 100644
--- a/opends/tests/system-tests/scenario/sample2/pre_configuration.xml
+++ b/opends/tests/system-tests/scenario/sample2/pre_configuration.xml
@@ -31,6 +31,11 @@
<function name="preConfiguration" scope="local">
<function-map-args>
+ <function-arg-def name="phase" type="required">
+ <function-arg-description>
+ phase object
+ </function-arg-description>
+ </function-arg-def>
<function-arg-def name="instances" type="required">
<function-arg-description>
list of instances classes
@@ -51,8 +56,8 @@
<sequence>
<!-- ================= Call preambule ======================== -->
<call function="'phasePreamble'">
- { 'phaseName' : 'preconfiguration',
- 'fileFd' : LOG_MAIN_FD }
+ { 'phase' : phase,
+ 'fileFd' : LOG_MAIN_FD }
</call>
@@ -115,8 +120,8 @@
<!-- ================= Call postambule ======================= -->
<call function="'phasePostamble'">
{
- 'phaseName' : 'preconfiguration',
- 'fileFd' : LOG_MAIN_FD
+ 'phase' : phase,
+ 'fileFd' : LOG_MAIN_FD
}
</call>
--
Gitblit v1.10.0