From 11bc51ab0ec882cd8445dfe59b2bb9159a62e683 Mon Sep 17 00:00:00 2001
From: al_xipe <al_xipe@localhost>
Date: Mon, 27 Aug 2007 22:29:10 +0000
Subject: [PATCH] 1 - runCommand wraps output lines longer than 100 characters 2 - fix in runTestJob: removed copy of results.html in tmp folder 3 - fix in staf-installer.xml removed references to results.html     only rely on my-report.html now 4 - attach my-report.html to the in place of results.html 5 - added knowIssue facility to allow to tag tests failing because of known issues 6 - updated the XSL style sheet to show known issue 7 - added testcase coloring based on status pass/fail/unknown/known 8 - added table of contents title row to make it easier for newcomers to read the     report 9 - added known bugs calls in backends group 10- added known bugs calls in security group 11- added known bugs call in logging group 12- fix in utils for default windows environment variables

---
 opends/tests/functional-tests/testcases/runFuncTests.xml                               |    5 +
 opends/tests/functional-tests/staf-installer.xml                                       |   17 +++--
 opends/tests/functional-tests/shared/xsl/my-report.xsl                                 |   54 +++++++++++++++--
 opends/tests/functional-tests/testcases/logging/logging.xml                            |    3 
 opends/tests/functional-tests/testcases/logging/logging_properties.xml                 |    3 
 opends/tests/functional-tests/shared/functions/environment.xml                         |    4 +
 opends/tests/functional-tests/testcases/backends/import.xml                            |    6 +
 opends/tests/functional-tests/shared/functions/utils.xml                               |   44 ++++++++++----
 opends/tests/functional-tests/testcases/backends/export.xml                            |    4 +
 opends/tests/functional-tests/testcases/schema/schema_rfc_tests.xml                    |    4 +
 opends/tests/functional-tests/testcases/security/pwd_validator/security_dictionary.xml |    7 ++
 opends/tests/functional-tests/testcases/runTestJob.xml                                 |    7 --
 12 files changed, 115 insertions(+), 43 deletions(-)

diff --git a/opends/tests/functional-tests/shared/functions/environment.xml b/opends/tests/functional-tests/shared/functions/environment.xml
index 5ae83b3..892e57e 100755
--- a/opends/tests/functional-tests/shared/functions/environment.xml
+++ b/opends/tests/functional-tests/shared/functions/environment.xml
@@ -133,12 +133,14 @@
         if isWindows:
           fileExt='.bat'
           fileFolder='bat'
+          pathSeparator=';'
         else:
           fileExt=''
           fileFolder='bin'
+          pathSeparator=':'
       </script>
       
-      <!-- Set the signal handlers -->          
+      <!-- Set the signal handlers -->
       <call function="'signals'"/>
       
       <!-- Initialize any global variables -->
diff --git a/opends/tests/functional-tests/shared/functions/utils.xml b/opends/tests/functional-tests/shared/functions/utils.xml
index 9a2b0b6..a6ad166 100755
--- a/opends/tests/functional-tests/shared/functions/utils.xml
+++ b/opends/tests/functional-tests/shared/functions/utils.xml
@@ -554,6 +554,7 @@
       <sequence>
         <script>
           testcaseStartTime=strftime("%Y%m%d@%H:%M:%S",localtime())
+          issuesList=[]
         </script>
         <call function="'testCase_StartBanner'" />
     </sequence>
@@ -616,7 +617,7 @@
       </call>
       <script>
         class Test:
-          def __init__(self, group, suite, fullname, start, stop, failures, successes):
+          def __init__(self, group, suite, fullname, start, stop, failures, successes, issues):
             self.log=''
             self.group=group
             self.suite=suite
@@ -630,13 +631,18 @@
             else:
               self.name=fullname
             self.duration = 0
-            if failures == 0:
-              if successes == 0:
-                self.result='inconclusive'
+            if len(issues) == 0:
+              if failures == 0:
+                if successes == 0:
+                  self.result='inconclusive'
+                else:
+                  self.result='pass'
               else:
-                self.result='pass'
+                self.result='fail'
             else:
-              self.result='fail'
+              self.result='known'
+            self.issues=issues
+              
             
           def toXML(self):
             xml  = '      &lt;test&gt;\n'
@@ -647,6 +653,10 @@
             xml += '        &lt;stop&gt;%s&lt;/stop&gt;\n'         % self.stop
             xml += '        &lt;result&gt;%s&lt;/result&gt;\n'     % self.result
             xml += '        &lt;duration&gt;%d&lt;/duration&gt;\n' % self.duration
+            xml += '        &lt;issues&gt;\n'
+            for issue in self.issues:
+              xml += '          &lt;issue&gt;%s&lt;/issue&gt;\n' % issue
+            xml += '        &lt;/issues&gt;\n'
             xml += '        &lt;log&gt;\n&lt;![CDATA['
             xml += '%s' % self.log
             xml += '        ]]&gt;&lt;/log&gt;\n'
@@ -654,15 +664,18 @@
             return xml
             
           def appendLog(self, log):
-            #log=log.replace('&lt;','')
-            #log=log.replace('&gt;','')
-            #log=log.replace('&amp;','&amp;amp;')
-            self.log +='%s\n' % log
+            _leftPadding=''
+            while len(log)>100:
+              _logChunk=log[:100]
+              log=log[100:]
+              self.log+='%s%s\n' % (_leftPadding,_logChunk)
+              _leftPadding='...    '
+            self.log += '%s%s\n' % (_leftPadding,log)
             
           def getName(self):
             return self.name
          
-        thisTest = Test(CurrentTestPath['group'],CurrentTestPath['suite'],STAXCurrentTestcase, testcaseStartTime,testcaseEndTime,numFail,numPass)
+        thisTest = Test(CurrentTestPath['group'],CurrentTestPath['suite'],STAXCurrentTestcase, testcaseStartTime,testcaseEndTime,numFail,numPass,issuesList)
             
         doLog = False
         testlog=open('%s/tests-log.xml' % TMPDIR,'a')
@@ -1243,8 +1256,7 @@
         </function-arg-description>
       </function-arg-def>
       <function-arg-def name="env" 
-                        type="optional" 
-                        default="['PATH=/bin:/usr/bin:%s' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME]">
+                        type="optional">
         <function-arg-description>
           the environment variables to set. The default set here should just
           work for OpenDS commands
@@ -1286,6 +1298,12 @@
         import java.util.Date
         random.seed(java.util.Date().getTime())
         _id = '%s#%d' % (strftime('%Y-%m-%d %H:%M:%S',localtime()),random.randint(0,999))
+        
+        if not env:
+          if isWindows:
+            env=['PATH=C:\Windows;C:\Windows\system32;%s' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME]
+          else:
+            env=['PATH=/bin:/usr/bin:%s' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME]
       </script>
       <message>
         '%s: Running command:\n %s %s\nlocation: %s\nenv: %s\nworkdir: %s' % (_id,command,arguments,location,env,path)
diff --git a/opends/tests/functional-tests/shared/xsl/my-report.xsl b/opends/tests/functional-tests/shared/xsl/my-report.xsl
index 4eb935b..99198b0 100644
--- a/opends/tests/functional-tests/shared/xsl/my-report.xsl
+++ b/opends/tests/functional-tests/shared/xsl/my-report.xsl
@@ -195,6 +195,16 @@
     
     <!-- table of contents -->
     <center><h2>Table of Contents</h2></center>
+    <table width="100%">
+      <tr>
+        <td>Description</td>
+        <td width="5%">Success Rate</td>
+        <td width="5%">Pass</td>
+        <td width="5%">Fail</td>
+        <td width="5%">Inc.</td>
+        <td width="5%">Cov.</td>
+      </tr>
+    </table>
     <ul class="myCollapsible">
       <xsl:for-each select="$tests">
         <xsl:sort select="group" order="ascending"/>
@@ -316,15 +326,45 @@
                       </tr>
                     </table>
                     <ul>
-                      <xsl:for-each select="$tests[group=$group][suite=$suite][result='fail' or result='inconclusive']">
+                      <xsl:for-each select="$tests[group=$group][suite=$suite][result='fail' or result='inconclusive' or result='known']">
                         <xsl:variable name="name" select="name"/>
                         <li>
-                          <a>
-                            <xsl:attribute name="href">
-                              <xsl:value-of select="concat(concat(concat(concat(concat('#',$group),'-'),$suite),'-'),$name)"/>
-                            </xsl:attribute>
-                            <xsl:value-of select="name"/>
-                          </a>
+                          <table>
+                            <tr>
+                              <xsl:attribute name="class">
+                                <xsl:choose>
+                                  <xsl:when test="result='fail'">
+                                    <xsl:value-of select="'unacceptable'" />
+                                  </xsl:when>
+                                  <xsl:when test="result='known'">
+                                    <xsl:value-of select="'acceptable'" />
+                                  </xsl:when>
+                                  <xsl:otherwise>
+                                    <xsl:value-of select="'perfect'" />
+                                  </xsl:otherwise>
+                                </xsl:choose>
+                              </xsl:attribute>
+                              <td>
+                                <a>
+                                  <xsl:attribute name="href">
+                                    <xsl:value-of select="concat(concat(concat(concat(concat('#',$group),'-'),$suite),'-'),$name)"/>
+                                  </xsl:attribute>
+                                  <xsl:value-of select="name"/>
+                                </a>
+                              </td>
+                              <td width="10%">
+                                <xsl:for-each select="./issues">
+                                  <xsl:variable name="issue" select="issue" />
+                                  <a target="issue">
+                                    <xsl:attribute name="href">
+                                      <xsl:value-of select="concat('https://opends.dev.java.net/issues/show_bug.cgi?id=',$issue)" />
+                                    </xsl:attribute>
+                                    <xsl:value-of select="$issue" />
+                                  </a><br />
+                                </xsl:for-each>
+                              </td>
+                            </tr>
+                          </table>
                           <ul>
                             <li>
                               <pre><xsl:value-of select="log" /></pre>
diff --git a/opends/tests/functional-tests/staf-installer.xml b/opends/tests/functional-tests/staf-installer.xml
index 272e03d..ce18f25 100644
--- a/opends/tests/functional-tests/staf-installer.xml
+++ b/opends/tests/functional-tests/staf-installer.xml
@@ -618,7 +618,7 @@
       </fileset>
     </copy>
     <echo>You may access the tests report at</echo>
-    <echo>${tests.run.dir}/${tests.run.time}/report/results.html</echo>
+    <echo>${tests.run.dir}/${tests.run.time}/report/my-report.html</echo>
     <antcall target="send-mail"/>
   </target>
   
@@ -694,7 +694,7 @@
   
   <target name="send-mail-prepare">
     <condition property="test.successful">
-      <available file="${staf.tmp.dir}/results.html"/>
+      <available file="${staf.tmp.dir}/my-report.html"/>
     </condition>
     <condition property="email.send">
       <equals arg1="${email.enabled}" arg2="y"
@@ -705,7 +705,7 @@
   <target name="send-mail-get-percentage" depends="send-mail-prepare" if="test.successful">
     <echo>test report found.Proceeding...</echo>
     <delete file="${staf.tmp.dir}/percentage.properties"/>
-    <copy file="${staf.tmp.dir}/results.html" tofile="${staf.tmp.dir}/percentage.properties">
+    <copy file="${staf.tmp.dir}/my-report.html" tofile="${staf.tmp.dir}/percentage.properties">
       <filterchain>
         <linecontains>
          <contains value='font size="+2'/>
@@ -732,14 +732,14 @@
       </or>
     </condition>
     <condition property="email.file" 
-               value="${staf.tmp.dir}/results.html" 
+               value="${staf.tmp.dir}/my-report.html" 
                else="staf-installer/failure.html">
-      <available file="${staf.tmp.dir}/results.html"/>
+      <available file="${staf.tmp.dir}/my-report.html"/>
     </condition>
     <condition property="email.subject"
                value="FT - Run - ${daily.date} - ${os.name} - ${os.arch} - ${test.percentage}%"
                else="FT - Failed -${daily.date} - ${os.name} - ${os.arch}">
-      <available file="${staf.tmp.dir}/results.html"/>
+      <available file="${staf.tmp.dir}/my-report.html"/>
     </condition>
     <antcall target="send-mail-noauth"/>
     <antcall target="send-mail-withauth"/>
@@ -1123,7 +1123,7 @@
     <java jar="${staf.install.dir}/services/stax/STAXDoc.jar" fork="true">
       <arg value="-d"/> 
       <arg value="${staf.home}/doc"/>
-      <arg value="testcases"/>
+      <!--<arg value="testcases"/>
       <arg value="testcases/aci"/>
       <arg value="testcases/backends"/>
       <arg value="testcases/core"/>
@@ -1139,8 +1139,9 @@
       <arg value="testcases/security/pwd_storage"/>
       <arg value="testcases/security/pwd_validator"/>
       <arg value="testcases/security/sasl"/>
-      <arg value="testcases/security/startTLS"/>
+      <arg value="testcases/security/startTLS"/>-->
       <arg value="shared/functions"/>
+      <arg value="testcases/sample" />
     </java>
   </target>
   
diff --git a/opends/tests/functional-tests/testcases/backends/export.xml b/opends/tests/functional-tests/testcases/backends/export.xml
index 863e604..1497089 100644
--- a/opends/tests/functional-tests/testcases/backends/export.xml
+++ b/opends/tests/functional-tests/testcases/backends/export.xml
@@ -199,7 +199,9 @@
                   'dsPath'      : '%s/server2/%s' % (DIRECTORY_INSTANCE_DIR, OPENDSNAME)
                 }
               </call>
-              
+              <script>
+                knownIssue(2173)
+              </script>
               <call function="'checktestRC'">
                 { 'returncode' : RC ,
                   'result'     : STAXResult
diff --git a/opends/tests/functional-tests/testcases/backends/import.xml b/opends/tests/functional-tests/testcases/backends/import.xml
index e7fdb83..5c2fec5 100644
--- a/opends/tests/functional-tests/testcases/backends/import.xml
+++ b/opends/tests/functional-tests/testcases/backends/import.xml
@@ -113,7 +113,7 @@
           #@TestResult
           -->
     
-          <!--  Not clear how to create a second backend    
+          <!--  Not clear how to create a second backend
           <testcase name="getTestCaseName('LDIF Non Default')">
     
             <sequence>
@@ -1030,7 +1030,6 @@
                   'dsBackEnd'          : 'userRoot'
                   }
               </call>
-    
               <call function="'checktestRC'">
                 { 'returncode' : RC ,
                   'result'     : STAXResult }
@@ -1091,6 +1090,9 @@
               <message log="1" level="'Error'">
                 'Error: Known bug. Issue 839: Encrypted LDIF export is not implemented'
               </message>
+              <script>
+                knownIssue(839)
+              </script>
     
               <call function="'testCase_Postamble'"/>
     
diff --git a/opends/tests/functional-tests/testcases/logging/logging.xml b/opends/tests/functional-tests/testcases/logging/logging.xml
index f160f83..c69c675 100755
--- a/opends/tests/functional-tests/testcases/logging/logging.xml
+++ b/opends/tests/functional-tests/testcases/logging/logging.xml
@@ -36,7 +36,8 @@
            </script>
           
           <call function="'testGroup_Preamble'" />
-          <iterate var="_test" in="['setup','rotation','properties','writer','retention','cleanup']" >
+          <!--<iterate var="_test" in="['setup','rotation','properties','writer','retention','cleanup']" >-->
+          <iterate var="_test" in="['setup','properties','cleanup']" >
             <sequence>
               <import machine="STAF_LOCAL_HOSTNAME"
                       file="'%s/testcases/logging/logging_%s.xml' % (TESTS_DIR,_test)"/>
diff --git a/opends/tests/functional-tests/testcases/logging/logging_properties.xml b/opends/tests/functional-tests/testcases/logging/logging_properties.xml
index f7d84b9..aa60d75 100755
--- a/opends/tests/functional-tests/testcases/logging/logging_properties.xml
+++ b/opends/tests/functional-tests/testcases/logging/logging_properties.xml
@@ -60,8 +60,9 @@
           </message>
           
           <!-- DESACTRIVATED : bug 2107]-->
-          <call function="'testFailed'"/>
+          <!--<call function="'testFailed'"/>-->
           <script>
+            knownIssue(2107)
             bug=2107
           </script>
           <if expr="bug == 0">
diff --git a/opends/tests/functional-tests/testcases/runFuncTests.xml b/opends/tests/functional-tests/testcases/runFuncTests.xml
index f448349..977e0a5 100755
--- a/opends/tests/functional-tests/testcases/runFuncTests.xml
+++ b/opends/tests/functional-tests/testcases/runFuncTests.xml
@@ -113,6 +113,11 @@
         # this function return a well-formatted testcase name
         def getTestCaseName(name):
           return '%s: %s: %s' % (CurrentTestPath['group'],CurrentTestPath['suite'],name)
+          
+        # this functions adds a known issue to a testcase's known issues list
+        issuesList=[]
+        def knownIssue(issue):
+          issuesList.append(issue)
         
         class functionToRun:
           def __init__(self, name):
diff --git a/opends/tests/functional-tests/testcases/runTestJob.xml b/opends/tests/functional-tests/testcases/runTestJob.xml
index 2cc9f23..aa8e61a 100644
--- a/opends/tests/functional-tests/testcases/runTestJob.xml
+++ b/opends/tests/functional-tests/testcases/runTestJob.xml
@@ -513,13 +513,6 @@
           </if>
         </sequence>
       </if>
-      
-      <!-- fixMe: Copy the html results file to TMPDIR for Hudson -->
-      <call function="'copyFile'">
-        { 'srcfile'    : htmlfile,
-          'destfile'   : '%s/results.html' % TMPDIR
-        }
-      </call>
     </sequence>
   
   </function>
diff --git a/opends/tests/functional-tests/testcases/schema/schema_rfc_tests.xml b/opends/tests/functional-tests/testcases/schema/schema_rfc_tests.xml
index 92c82a4..e410b6b 100644
--- a/opends/tests/functional-tests/testcases/schema/schema_rfc_tests.xml
+++ b/opends/tests/functional-tests/testcases/schema/schema_rfc_tests.xml
@@ -774,7 +774,9 @@
                     'optionsString'          : '--set enabled:false'
                     }
             </call> 
-    
+            <script>
+              knownIssue(2046)
+            </script>
             <call function="'checktestRC'">
                 { 'returncode' : RC ,
                   'result'     : STAXResult }
diff --git a/opends/tests/functional-tests/testcases/security/pwd_validator/security_dictionary.xml b/opends/tests/functional-tests/testcases/security/pwd_validator/security_dictionary.xml
index 00502e6..16c2985 100755
--- a/opends/tests/functional-tests/testcases/security/pwd_validator/security_dictionary.xml
+++ b/opends/tests/functional-tests/testcases/security/pwd_validator/security_dictionary.xml
@@ -169,7 +169,9 @@
                     'attributeValue'         : 'false' ,
                     'modifyType'             : 'set' }
             </call>
-            
+            <script>
+              knownIssue(2081)
+            </script>
             <call function="'testCase_Postamble'"/>
             
           </sequence>
@@ -193,6 +195,9 @@
                     'newAttributeValue'      : 'sbbad' ,
                     'changetype'             : 'replace' }
             </call>
+            <script>
+              knownIssue(2081)
+            </script>
             <!-- Uncomment when Issue 2081 is resolved.
             <message>
                'Security: Pwd Validator: Dictionary: user binding with valid password'

--
Gitblit v1.10.0