Преглед изворни кода

Add diagnostics for incomplete test cases' XML

[SVN r36726]
Aleksey Gurtovoy пре 19 година
родитељ
комит
665972f6ab

+ 14 - 12
tools/regression/xsl_reports/test/common.py

@@ -59,25 +59,27 @@ def make_test_log( xml_generator
                                   , "target-directory": target_directory
                                   , "show-run-output": show_run_output
                                   } )
-    if test_type ==  "run":
+
+    if test_type != "lib":
         xml_generator.startElement( "compile", { "result": "success" } );
         xml_generator.characters( "Compiling in %s" % target_directory )
         xml_generator.endElement( "compile" )
 
-        
-        xml_generator.startElement( "lib", { "result": test_result } );
-        xml_generator.characters( make_library_target_directory( library_idx, toolset_idx ) )
-        xml_generator.endElement( "lib" )
+        if test_type.find( "link" ) == 0 or test_type.find( "run" ) == 0:
+            xml_generator.startElement( "lib", { "result": test_result } );
+            xml_generator.characters( make_library_target_directory( library_idx, toolset_idx ) )
+            xml_generator.endElement( "lib" )
 
-        xml_generator.startElement( "link", { "result": "success" } );
-        xml_generator.characters( "Linking in %s" % target_directory )
-        xml_generator.endElement( "link" )
+            xml_generator.startElement( "link", { "result": "success" } );
+            xml_generator.characters( "Linking in %s" % target_directory )
+            xml_generator.endElement( "link" )
 
-        xml_generator.startElement( "run", { "result": test_result } );
-        xml_generator.characters( "Running in %s" % target_directory )
-        xml_generator.endElement( "run" )
+        if test_type.find( "run" ) == 0:
+            xml_generator.startElement( "run", { "result": test_result } );
+            xml_generator.characters( "Running in %s" % target_directory )
+            xml_generator.endElement( "run" )
 
-    if test_type ==  "lib":
+    else:
         xml_generator.startElement( "compile", { "result": test_result } );
         xml_generator.characters( "Compiling in %s" % make_library_target_directory( library_idx, toolset_idx ) )
         xml_generator.endElement( "compile" )

+ 29 - 10
tools/regression/xsl_reports/xsl/v2/add_expected_results.xsl

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
 
-Copyright MetaCommunications, Inc. 2003-2006.
+Copyright MetaCommunications, Inc. 2003-2007.
 
 Distributed under the Boost Software License, Version 1.0. (See
 accompanying file LICENSE_1_0.txt or copy at
@@ -11,8 +11,10 @@ http://www.boost.org/LICENSE_1_0.txt)
 
 <xsl:stylesheet 
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+    xmlns:func="http://exslt.org/functions"
     xmlns:meta="http://www.meta-comm.com"
-    exclude-result-prefixes="meta"
+    extension-element-prefixes="func"
+    exclude-result-prefixes="func meta"
     version="1.0">
 
     <xsl:import href="common.xsl"/>
@@ -23,6 +25,16 @@ http://www.boost.org/LICENSE_1_0.txt)
     <xsl:param name="failures_markup_file"/>
     <xsl:variable name="expected_results" select="document( $expected_results_file )" />
 
+    <func:function name="meta:is_test_log_complete">
+        <xsl:param name="test_log"/>
+        <xsl:variable name="type" select="$test_log/@test-type"/>
+        <func:result select="( ( $type='compile' or $type='compile_fail' ) and count( $test_log/compile ) > 0 )
+                          or ( ( $type='link' or $type='link_fail' ) and count( $test_log/compile ) > 0 and count( $test_log/link ) > 0 )
+                          or ( count( $test_log/compile ) > 0 and count( $test_log/link ) > 0 and count( $test_log/run ) > 0 )
+                          "/>
+    </func:function>
+
+
     <xsl:key name = "trk" match = "test-result" use = "concat( ../../@name, '-', ../@name, '-', @test-name )" />
     <xsl:key name = "tak" match = "toolset-alias" use = "@name" />
 
@@ -37,23 +49,20 @@ http://www.boost.org/LICENSE_1_0.txt)
         <xsl:variable name="test-name" select="@test-name"/>
         <xsl:variable name="toolset" select="@toolset"/>
 
+        <xsl:variable name="is_complete" select="meta:is_test_log_complete( $test_log )"/>
+
         <xsl:element name="{local-name()}">
             <xsl:apply-templates select="@*"/>
 
-
             <xsl:variable name="actual_result">
                 <xsl:choose>
-                    <!-- Hack: needs to be researched (and removed). See M.Wille's incident. -->
-                    <xsl:when test="run/@result='succeed' and lib/@result='fail'">
-                        <xsl:text>success</xsl:text>
-                    </xsl:when>
-                    <xsl:when test="./*/@result = 'fail'" >
+                    <xsl:when test="./*/@result = 'fail' or not( $is_complete )" >
                         <xsl:text>fail</xsl:text>
                     </xsl:when>
                     <xsl:otherwise>
                         <xsl:text>success</xsl:text>
                     </xsl:otherwise>
-                </xsl:choose>                     
+                </xsl:choose>
             </xsl:variable>
             
             <!-- 
@@ -206,9 +215,19 @@ http://www.boost.org/LICENSE_1_0.txt)
                             </xsl:otherwise>
                         </xsl:choose>
                     </xsl:if>
+
+                    <xsl:if test="not( $is_complete )">
+                        <note>
+                            <span class="internal-error-note">
+                                <b>[Reporting Tools Internal Error]</b> This test case's XML is missing one or more log entries
+                                of the regression run's steps associated with the test case's type ("<xsl:value-of select="$test_log/@test-type"/>").
+                                Please <a href="mailto:mailto:boost-testing@lists.boost.org">contact reporting tools 
+                                maintainers</a> about this problem.
+                            </span>
+                        </note>
+                    </xsl:if>
                 </xsl:variable>
                 
-                
                 <xsl:attribute name="result"><xsl:value-of select="$actual_result"/></xsl:attribute>
                 <xsl:attribute name="expected-result"><xsl:value-of select="$expected_result"/></xsl:attribute>
                 <xsl:attribute name="expected-reason"><xsl:value-of select="$expected_reason"/></xsl:attribute>

+ 5 - 0
tools/regression/xsl_reports/xsl/v2/html/master.css

@@ -568,6 +568,11 @@ span.auto-note
     font-style: italic;
 }
 
+span.internal-error-note
+{
+    color: red;
+}
+
 /* Log */
 
 div.log-test-title

粤ICP备19079148号