From c6ab616512c401e11942d8127757882940547f8b Mon Sep 17 00:00:00 2001
From: al_xipe <al_xipe@localhost>
Date: Sun, 29 Jul 2007 23:07:35 +0000
Subject: [PATCH]  1. addition of a 10 second sleep to fix a windows file lock issue on restart  2. a property to bypass proxy detection when running tests  3. display of the functional tests success rate in the ant text output  4. declaration of NO_CHECK variable in runTestJob.xml  5. fool proofing runTestJob.xml in the way it parses the testcase name (in case it does not conform to the implicit naming convention)  6. fix the testcase name for the sample test suite

---
 opends/tests/functional-tests/staf-installer.xml          |   18 ++++++++++++++++--
 opends/tests/functional-tests/testcases/sample/sample.xml |    2 +-
 opends/tests/functional-tests/testcases/runTestJob.xml    |   29 ++++++++++++++++++++++-------
 3 files changed, 39 insertions(+), 10 deletions(-)

diff --git a/opends/tests/functional-tests/staf-installer.xml b/opends/tests/functional-tests/staf-installer.xml
index ea0747b..b2b66d8 100644
--- a/opends/tests/functional-tests/staf-installer.xml
+++ b/opends/tests/functional-tests/staf-installer.xml
@@ -109,7 +109,7 @@
 <!-- Usage section - bottom  -->
 	
 <!-- Downloader section - top    -->
-  <target name="download-do-prepare-check-proxy">
+  <target name="download-do-prepare-check-proxy" unless="proxy.disabled">
     <echo>Checking for proxy [${proxy.host}:${proxy.port}] as user [${proxy.user}].</echo>
     <echo>Note: If these values do not match your environment, </echo>
     <echo>      please use the 'configure' target</echo>
@@ -716,6 +716,7 @@
       </filterchain>
     </copy>
     <property file="${staf.tmp.dir}/percentage.properties"/>
+    <echo>Test Success Rate: ${test.percentage}%</echo>
   </target>
 
   <target name="send-mail" if="email.send" depends="send-mail-get-percentage">
@@ -1111,7 +1112,8 @@
 	</target>
 
   <target name="restart">
-    <antcall target="stop" inheritAll="false" />
+    <antcall target="stop"  inheritAll="false" />
+    <sleep seconds="10"                        />
     <antcall target="start" inheritAll="false" />
   </target>
 <!--  Macros section - bottom -->
@@ -1166,4 +1168,16 @@
       <replacevalue></replacevalue>
     </replace>
   </target>
+  
+  <target name="generate-report">
+    <tstamp>
+      <format property="tstamp.today" pattern="yyyyMMdd"/>
+    </tstamp>
+    <fileset id="resultxml" file="${tstamp.today}-*/**/reports/results.xml" />
+    <xslt processor="trax"
+          in="C:\Users\arnaud\.hudson\jobs\opends-vista-functional-tests\workspace\opends\tests\functional-run\tmp\20070726-234928\Windows-x86-jvm1.5\reports\results.xml" 
+          out="${staf.tmp.dir}/results.html"
+          style="shared/xsl/gen-alltests-report.xsl">
+    </xslt>
+  </target>
 </project>
diff --git a/opends/tests/functional-tests/testcases/runTestJob.xml b/opends/tests/functional-tests/testcases/runTestJob.xml
index 97e4454..debc6bc 100644
--- a/opends/tests/functional-tests/testcases/runTestJob.xml
+++ b/opends/tests/functional-tests/testcases/runTestJob.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!DOCTYPE stax SYSTEM "../../shared/stax.dtd">
+<!DOCTYPE stax SYSTEM "../shared/stax.dtd">
 <!--
  ! CDDL HEADER START
  !
@@ -62,6 +62,15 @@
       <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
         file="'%s/stafcmd.xml' % (TESTS_FUNCTIONS_DIR)" />
         
+      <!--
+        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="'%s' % (STAF_LOCAL_HOSTNAME)"
         file="'%s/utils.xml' % (TESTS_FUNCTIONS_DIR)" />        
         
@@ -222,7 +231,7 @@
 
       <!-- Write XML File for results -->
       <script>
-        import re 
+        import re
         xmlfile= '%s/results.xml' % logsReportDir
         xmlfh=open(xmlfile,'w') 
         errorfile= '%s/results.errors' % logsReportDir
@@ -235,7 +244,7 @@
         testCaseList=[]
       </script>
 
-      <iterate var="element" in="resultQuery"> 
+      <iterate var="element" in="resultQuery">
         <script>
           level=element['level']
           message=element['message']
@@ -352,16 +361,22 @@
         xmlfh.write('    &lt;/identification&gt;\n')
         xmlfh.write('    &lt;results&gt;\n')
       </script>
-
+      
       <!-- XML Report Results -->
       <script>
         for tcname in testCaseList:
 
           if testDict.has_key(tcname):
-
             tcnamesplit=tcname.split(":")
-            testgroup=tcnamesplit[0]
-            testsuite=tcnamesplit[1]
+            if tcnamesplit[0]:
+              testgroup=tcnamesplit[0]
+              if tcnamesplit[1]:
+                testsuite=tcnamesplit[1]
+              else:
+                testsuite=testgroup
+            else:
+              testgroup=tcname
+              testsuite=tcname
             
             if testDict[tcname].has_key('pass'):
               tcpass=testDict[tcname]['pass']
diff --git a/opends/tests/functional-tests/testcases/sample/sample.xml b/opends/tests/functional-tests/testcases/sample/sample.xml
index 0182690..aadeb89 100644
--- a/opends/tests/functional-tests/testcases/sample/sample.xml
+++ b/opends/tests/functional-tests/testcases/sample/sample.xml
@@ -96,7 +96,7 @@
       #@TestPostamble             none
       #@TestResult                Success if OpenDS returns 0
     -->
-    <testcase name="'%s' % STAXCurrentFunction">
+    <testcase name="'%s: %s: %s' % (CurrentTestPath['group'],CurrentTestPath['suite'],STAXCurrentFunction)">
       <sequence>
         <call function="'testCase_Preamble'" />
         <call function="'SearchObject'">

--
Gitblit v1.10.0