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 +++++++++++++++++++++++++++++------
 1 files changed, 29 insertions(+), 6 deletions(-)

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>

--
Gitblit v1.10.0