Ver código fonte

add XSL based reports

[SVN r19188]
Aleksey Gurtovoy 23 anos atrás
pai
commit
e53afebc73

+ 5 - 0
tools/regression/xsl_reports/empty_expected_results.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+<expected-failures>
+</expected-failures>
+</root>

+ 256 - 0
tools/regression/xsl_reports/report.py

@@ -0,0 +1,256 @@
+# (C) Copyright MetaCommunications, Inc. 2003.
+#
+# Permission to use, copy, modify, distribute and sell this software
+# and its documentation for any purpose is hereby granted without fee, 
+# provided that the above copyright notice appears in all copies and 
+# that both the copyright notice and this permission notice appear in 
+# supporting documentation. No representations are made about the 
+# suitability of this software for any purpose. It is provided "as is" 
+# without express or implied warranty.
+
+import shutil
+import sys
+import os
+import os.path
+import string
+import time
+import inspect
+import getopt
+
+run_dir = os.path.abspath( os.path.dirname( sys.argv[ 0 ] ) )
+
+class failure_exception:
+    def __init__( self, rc ):
+        self.rc_ = rc
+
+def log_level():
+   frames = inspect.stack()
+   level = 0
+   for i in frames[ 3: ]:
+       if i[0].f_locals.has_key( "__log__" ):
+           level = level + i[0].f_locals[ "__log__" ]
+   return level
+ 
+
+def stdlog( message ):
+    sys.stderr.write( "# " + "    " * log_level() +  message + "\n" );
+    sys.stderr.flush()
+
+log = stdlog
+# log = lambda x: x
+
+def system( commands ):
+    f = open( "tmp.cmd", "w" )
+    f.write( string.join( commands, "\n" ) )
+    f.close()
+    rc = os.system( "tmp.cmd" )
+    return rc
+
+
+def checked_system( commands ):
+    rc = system( commands ) 
+    if 0 != rc : raise failure_exception( rc )
+    return rc
+
+
+def set_char( str, index, char ):
+    return str[ 0 : index ] + char + str[ index + 1: ]
+
+
+def process_xml_file( input_file, output_file ):
+    log( "Processing test log \"%s\"" % input_file )
+    
+    f = open( input_file, "r" )
+    xml = f.readlines();
+    f.close()
+    
+    ascii_chars = ''.join(map(chr, range(0,128)))
+    nonascii_chars = ''.join(map(chr, range(128,256)))
+    translated_ascii_chars = ''.join( map( lambda x: "?", range(128,256)))
+    for i in string.printable:
+        if ( ord( i ) < 128 and ord(i) not in ( 12, ) ):
+            translated_ascii_chars = set_char( translated_ascii_chars, ord(i), i )
+        
+    translated_nonascii_chars = ''.join( map( lambda x: "?", range(128,256) ) )
+    
+    mask_nonascii_translation_table = string.maketrans( ascii_chars + nonascii_chars
+                                                        , translated_ascii_chars + translated_nonascii_chars
+                                                        )
+    for i in range( 0, len(xml)):
+        xml[i] = string.translate( xml[i], mask_nonascii_translation_table )
+    output_file.writelines( xml )
+
+
+def process_test_log_files( output_file, dir, names ):
+    for file in names:
+        if os.path.basename( file ) == "test_log.xml":
+            process_xml_file( os.path.join( dir, file ), output_file )
+
+
+def collect_test_logs( input_dirs, output_file ):
+    __log__ = 1
+    log( "Collecting test logs ..." )
+    f = open( output_file, "w+" )
+    f.write( "<tests>\n" );
+    for input_dir in input_dirs:
+        os.path.walk( input_dir, process_test_log_files, f );
+    f.write( "</tests>\n" );
+    f.close()
+
+
+def xalan( xml_file, xsl_file,output_file, parameters = None ):
+    transform_command = "xalan"
+    transform_command = transform_command  + ' -o "%s" ' %  output_file
+    if parameters is not None:
+         for i in parameters: 
+              transform_command = transform_command + ' -p %s "\'%s\'" ' % ( i, parameters[ i ] )
+    transform_command = transform_command  + ' "%s"' %  xml_file
+    transform_command = transform_command  + ' "%s"' %  xsl_file
+    log( transform_command )
+    os.system( transform_command )    
+                  
+
+def msxsl( xml_file, xsl_file, output_file, parameters = None ):
+    transform_command = "msxsl"
+    transform_command = transform_command  + ' "%s"' %  xml_file
+    transform_command = transform_command  + ' "%s"' %  xsl_file
+    transform_command = transform_command  + ' -o  "%s" ' %  output_file
+
+    if parameters is not None:
+         for i in parameters: 
+              transform_command = transform_command + ' %s="%s" ' % ( i, parameters[ i ] )
+
+    log( transform_command )
+    os.system( transform_command )    
+
+
+registered_xsltprocs = {   "msxsl": msxsl
+                         , "xalan": xalan
+                         }
+
+def xsl_path( xsl_file_name ):
+    return os.path.join( run_dir, "xsl", xsl_file_name ) 
+
+
+def make_result_pages( test_results_file
+                       , expected_results_file
+                       , source
+                       , run_date
+                       , comment_file
+                       , result_prefix
+                       , output_dir
+                       , xslt_proc_name
+                       ):
+    log( "Producing the reports..." )
+    __log__ = 1
+    xslt_proc = registered_xsltprocs[ xslt_proc_name ]
+    extended_test_results = os.path.join( output_dir, "extended_test_results.xml" )
+    log( "    Merging with expected results..." )
+    xslt_proc( test_results_file
+               , xsl_path( "add_expected_results.xsl" )
+               , extended_test_results
+               , { "expected_results_file": os.path.abspath( expected_results_file ) }
+           )
+
+    log( "    Making detailed reports..." )
+    for mode in ( "developer", "user" ):
+        xslt_proc(  extended_test_results
+                    , xsl_path( "result_page.xsl" )
+                    , os.path.join( output_dir, "%s_%s" % ( mode, "result_page.html" ) )
+                    , { "links_file": result_prefix + "-links.html"
+                        , "mode": mode
+                        , "source": source
+                        , "run_date": run_date 
+                        , "comment_file": os.path.abspath( comment_file )
+                        , "expected_results_file": os.path.abspath( expected_results_file )
+                        }
+                    );
+
+    log( "    Making summary reports..." )
+    for mode in ( "developer", "user" ):
+        xslt_proc(  extended_test_results
+                    , xsl_path( "summary_page.xsl" )
+                    , os.path.join( output_dir, "%s_%s" % ( mode, "summary_page.html" ) )
+                    , { "mode" : mode 
+                        , "source": source
+                        , "run_date": run_date 
+                        , "comment_file": os.path.abspath( comment_file )
+                        }
+                    );
+    
+    log( "    Generating expected_results ..." )
+    xslt_proc( extended_test_results
+               , xsl_path( "produce_expected_results.xsl" )
+               , os.path.join( output_dir, "expected_results.xml" )
+               )
+    
+    shutil.copyfile( xsl_path( "master.css" ),  os.path.join( output_dir, "master.css" ) )
+
+
+def build_experimental_reports( results_dir
+                                , source
+                                , expected_results_file
+                                , comment_file
+                                , result_file_prefix
+                                , xslt_proc_name
+                                ):
+    ( run_date ) = time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime() )
+    test_results_file = os.path.join( results_dir, "test_results.xml" )
+    collect_test_logs( [ os.path.join( results_dir, "libs" ), os.path.join( results_dir, "status" ) ]
+                       , test_results_file
+                       )
+
+    make_result_pages( test_results_file
+                       , expected_results_file
+                       , source
+                       , run_date
+                       , comment_file
+                       , result_file_prefix
+                       , results_dir
+                       , xslt_proc_name
+                       )
+
+
+def accept_args( args ):
+    ( option_pairs, rest_args ) = getopt.getopt( sys.argv[1:], "", [ "locate-root="
+                                                                     , "tag="
+                                                                     , "expected-results="
+                                                                     , "comment="
+                                                                     , "results-prefix="
+                                                                     , "xsltproc="
+                                                                     , "help"
+                                                                     ] )
+#    options = { "--expected-results": "" }
+    options = {}
+    map( lambda x: options.__setitem__( x[0], x[1] ), option_pairs )
+
+    if ( options.has_key( "--help" ) or len( options.keys() ) == 0 ):
+        usage()
+        sys.exit( 1 )
+
+    return ( options[ "--locate-root" ]
+             , options[ "--tag" ]
+             , options[ "--expected-results" ]
+             , options[ "--comment" ]
+             , options[ "--results-prefix" ]
+             , options[ "--xsltproc" ]
+             )
+
+def usage():
+    print "Usage: %s [options]" % os.path.basename( sys.argv[0] )
+    print    """
+\t--locate-root       the regression results directory
+\t--tag               the tag for the results (i.e. "CVS main trunk")
+\t--expected-results  the file with the results to be compared with
+\t                    the current run 
+\t--comment           an html comment file (will be inserted in the reports)
+\t--results-prefix    the prefix of -links.html, -fail.html
+\t                    files produced by compiler_status
+\t--xsltproc          the name of xslt processor (msxsl, xalan)
+    """
+
+def main():
+    apply( build_experimental_reports, accept_args( sys.argv[ 1 : ] ) )
+    
+if __name__ == '__main__':
+    main()

+ 86 - 0
tools/regression/xsl_reports/xsl/add_expected_results.xsl

@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ (C) Copyright MetaCommunications, Inc. 2003.
+
+ Permission to use, copy, modify, distribute and sell this software
+ and its documentation for any purpose is hereby granted without fee, 
+ provided that the above copyright notice appears in all copies and 
+ that both the copyright notice and this permission notice appear in 
+ supporting documentation. No representations are made about the 
+ suitability of this software for any purpose. It is provided "as is" 
+ without express or implied warranty.
+
+-->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
+  <xsl:output method="xml" encoding="utf-8"/>
+  
+  <xsl:param name="expected_results_file"/>
+  <xsl:variable name="expected_results" select="document( $expected_results_file )" />
+
+  <xsl:template match="/">
+    <xsl:apply-templates/>
+  </xsl:template>
+  
+  <xsl:template match="test-log">
+    <xsl:variable name="library" select="@library"/>
+    <xsl:variable name="test-name" select="@test-name"/>
+    <xsl:variable name="toolset" select="@toolset"/>
+
+    <xsl:element name="{local-name()}">
+      <xsl:apply-templates select="@*"/>
+
+      <xsl:variable name="actual_result">
+        <xsl:choose>
+          <xsl:when test="./*/@result = 'fail'" >
+            <xsl:text>fail</xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:text>success</xsl:text>
+          </xsl:otherwise>
+        </xsl:choose>                     
+      </xsl:variable>
+
+      <xsl:variable name="expected_results_test_case" select="$expected_results//*/test-result[ @library=$library and @test-name=$test-name and @toolset = $toolset]"/>
+
+      <xsl:variable name="expected_result">
+        <xsl:choose>
+          <xsl:when test="$expected_results_test_case">
+            <xsl:text>fail</xsl:text>
+          </xsl:when>
+          <xsl:otherwise>success</xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+
+      <xsl:variable name="status">
+        <xsl:choose>
+          <xsl:when test="$expected_result = $actual_result">expected</xsl:when>
+          <xsl:otherwise>unexpected</xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+
+      <xsl:variable name="note">
+        <xsl:copy-of select="$expected_results_test_case/node()"/>
+      </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="status"><xsl:value-of select="$status"/></xsl:attribute>
+      <xsl:element name="note"><xsl:copy-of select="$note"/></xsl:element>
+      <xsl:apply-templates select="node()" />
+    </xsl:element>
+  </xsl:template>
+
+  <xsl:template match="*">
+    <xsl:element name="{local-name()}">
+      <xsl:apply-templates select="@*"/>
+      <xsl:apply-templates select="node()" />
+    </xsl:element>
+  </xsl:template>
+
+  <xsl:template match="@*">
+    <xsl:copy-of select="." />
+  </xsl:template>
+
+</xsl:stylesheet>

+ 204 - 0
tools/regression/xsl_reports/xsl/master.css

@@ -0,0 +1,204 @@
+body
+{
+    background-color: white;
+}
+
+h1.page-title
+{ 
+  text-align: left;
+  text-transform: capitalize;
+  margin-bottom: 10pt;
+}
+
+div.acknowledgement
+{
+  text-align: left;
+  margin-top: 10pt;
+  margin-left: 5pt;
+  margin-bottom: 10pt;
+}
+
+div.purpose
+{ 
+  text-align: left;
+  margin-left: 5pt;
+  margin-top: 10pt;
+}
+
+div.legend
+{ 
+  text-align: left;
+  margin-left: 15pt;
+}
+
+table.header-table
+{
+  margin-left: 10pt;
+  margin-top: 20pt;
+  margin-bottom: 10pt;
+  width: 800px;
+}
+
+td.header-item
+{ 
+  text-align: left;
+  vertical-align: top;
+  font-weight: bold;
+}
+
+td.header-item-content
+{ 
+  padding-left: 20pt;
+  padding-bottom: 10pt;
+}
+
+td.legend-item
+{ 
+    padding-left: 5pt;
+    padding-top: 2pt;
+}
+
+div.toc
+{ 
+  margin: 5pt;
+}
+
+li.toc-entry
+{ 
+  margin-left: 5pt;
+  list-style-type: square;
+}
+
+div.library-name
+{ 
+  margin-top: 20pt;
+  margin-bottom: 10pt;
+  text-align: left;
+  font-size: 125%;
+  font-weight: bold;
+}
+
+div.footer
+{ 
+  margin: 5px;
+}
+
+ table.summary-table
+,table.detail-table
+{ 
+  border-collapse: collapse;
+  border: 2px solid black;
+  margin: 5px;
+}
+
+ table.summary-table td
+,table.detail-table td
+{ 
+  text-align: center;
+  border-left: 1px solid black;
+  border-right: 1px solid black;
+}
+
+
+ a.log-link:link
+,a.log-link:visited
+{
+  color: black; 
+/*  text-decoration: none; */
+}
+
+ a.log-link:active
+,a.log-link:hover
+,a.legend-link:link
+,a.legend-link:visited
+,a.legend-link:active
+,a.legend-link:hover
+{
+  color: black; 
+  text-decoration: underline;
+}
+
+table.summary-table td.library-name
+{
+  width: 100pt;
+  padding: 0pt;
+}
+
+table.detail-table td.test-name
+{
+  width: 150pt;
+  padding: 0pt;
+  border-right: 0;
+}
+
+table.detail-table td.test-type
+{
+  padding-right: 5px;
+  border-left: 0;
+  border-right: 0;
+  text-align: right;
+}
+
+ td.result-success-expected
+,td.result-fail-expected
+,td.result-user-success
+,td.summary-expected
+,td.summary-user-fail-expected
+,td.summary-user-success
+{ 
+  width: 60pt;
+  text-align: center;
+  background-color: lightgreen;
+  color: black;
+  border: 0px solid black;
+}
+
+ td.result-success-unexpected
+,td.summary-success-unexpected
+{ 
+  width: 60pt;
+  text-align: center;
+  background-color: green;
+  font-weight: bold;
+  color: white;
+  border: 0px;
+}
+
+ td.summary-fail-unexpected
+,td.summary-user-fail-unexpected
+,td.result-user-fail-unexpected
+{ 
+  width: 60pt;
+  text-align: center;
+  background-color: red;
+  color: black;
+  border: 2px solid black; 
+}
+
+td.summary-user-fail-unexpected
+{ 
+  width: 60pt;
+  text-align: center;
+  background-color: yellow;
+  color: black;
+  border: 2px solid black; 
+}
+
+td.result-fail-unexpected
+{ 
+  width: 60pt;
+  text-align: center;
+  background-color: red;
+  font-weight: bold;
+  color: black;
+  border: 2px solid black; 
+}
+
+td.result-user-fail-expected
+{ 
+  width: 60pt;
+  text-align: center;
+  background-color: yellow;
+  color: black;
+  border: 0px solid black; 
+}

+ 21 - 0
tools/regression/xsl_reports/xsl/produce_expected_results.xsl

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+
+  <xsl:output method="xml" encoding="utf-8"/>
+
+  <xsl:template match="/">
+    <root>
+      <expected-failures>
+        <xsl:apply-templates select="*/test-log[@result != 'success']"/>
+      </expected-failures>
+    </root>
+  </xsl:template>
+  
+  <xsl:template match="test-log">
+    <xsl:if test="@result != 'success'">
+      <test-result library="{@library}" test-name="{@test-name}" toolset="{@toolset}" />
+    </xsl:if>
+  </xsl:template>
+
+</xsl:stylesheet>

+ 362 - 0
tools/regression/xsl_reports/xsl/result_page.xsl

@@ -0,0 +1,362 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ (C) Copyright MetaCommunications, Inc. 2003.
+
+ Permission to use, copy, modify, distribute and sell this software
+ and its documentation for any purpose is hereby granted without fee, 
+ provided that the above copyright notice appears in all copies and 
+ that both the copyright notice and this permission notice appear in 
+ supporting documentation. No representations are made about the 
+ suitability of this software for any purpose. It is provided "as is" 
+ without express or implied warranty.
+
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+  <xsl:output method="html" 
+    doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" 
+    encoding="utf-8" 
+    indent="yes"
+    />
+
+  <xsl:param name="links_file"/>
+  <xsl:param name="mode"/>
+  <xsl:param name="source"/>
+  <xsl:param name="run_date"/>
+  <xsl:param name="comment_file"/>
+  <xsl:param name="expected_results_file"/>
+
+  <!-- the author-specified expected test results -->
+  <xsl:variable name="expected_results" select="document( $expected_results_file )" />
+
+  <!-- necessary indexes -->
+  <xsl:key 
+    name="test_name_key" 
+    match="test-log" 
+    use="concat( @library, '&gt;@&lt;', @test-name )"/>
+  <xsl:key 
+    name="library_key" 
+    match="test-log" 
+    use="@library"/>
+  <xsl:key name="toolset_key" match="test-log" use="@toolset"/>
+
+  <!-- -->
+  <xsl:variable name="toolsets" select="//test-log[generate-id(.) = generate-id( key('toolset_key',@toolset)[1] )]/@toolset"/>
+  <xsl:variable name="libraries" select="//test-log[ generate-id(.) = generate-id( key('library_key',@library)[1] ) and @library != '' ]/@library"/>
+
+  <xsl:template name="toolsets_row">
+    <tr>
+      <td class="head" colspan="2">test / toolset</td>
+      <xsl:for-each select="$toolsets">
+        <xsl:sort select="." order="ascending" />
+        <td class="toolset-name"><xsl:value-of select="."/></td>
+      </xsl:for-each>
+      <td class="head">toolset / test</td>
+    </tr>
+  </xsl:template>
+
+  <xsl:template name="test_type_col">
+    <td class="test-type">
+      <a href="#legend" class="legend-link">
+        <xsl:variable name="test_type" select="./@test-type"/>
+        <xsl:choose>
+          <xsl:when test="$test_type='run'">
+            <xsl:text>r</xsl:text>
+          </xsl:when>
+          <xsl:when test="$test_type='run_fail'">
+            <xsl:text>rf</xsl:text>
+          </xsl:when>
+          <xsl:when test="$test_type='compile'">
+            <xsl:text>c</xsl:text>
+          </xsl:when>
+          <xsl:when test="$test_type='compile_fail'">
+            <xsl:text>cf</xsl:text>
+          </xsl:when>
+        </xsl:choose>
+      </a>
+    </td>
+  </xsl:template>
+
+
+  <xsl:template match="/">
+    <html>
+      <head>
+        <link rel="stylesheet" type="text/css" href="master.css" title="master" />
+        <title>Boost regression - <xsl:value-of select="$mode"/> detailed report: <xsl:value-of select="$source"/></title>
+      </head>
+      <body>
+
+        <!-- header -->
+
+        <xsl:variable name="legend">
+          <xsl:choose>
+            <xsl:when test="$mode='user'">
+              <tr>
+                <td class="header-item">Legend</td>
+                <td class="header-item-content">
+
+                  <table border="0" class="legend-table">
+                    <tr>
+                      <td><table><tr><td class="result-user-success">pass</td></tr></table></td>
+                      <td class="legend-item">the test passes</td>
+                    </tr>
+                    <tr>
+                      <td><table><tr><td class="result-user-fail-expected">fail</td></tr></table></td>
+                      <td class="legend-item">
+                        a known test failure; click on the link to see the log
+                      </td>
+                    </tr>
+                    <tr>
+                      <td><table><tr><td class="result-user-fail-unexpected">unexp.</td></tr></table></td>
+                      <td class="legend-item">
+                        the test is known to pass, but is currently failing; 
+                        click on the link to see the log
+                      </td>
+                    </tr>
+                  </table>
+
+                </td>
+              </tr>
+            </xsl:when>
+            <xsl:when test="$mode='developer'">
+              <tr>
+                <td class="header-item">Legend</td>
+                <td class="header-item-content">
+                  <table border="0" class="legend-table">
+                    <tr>
+                      <td><table><tr><td class="result-success-expected">pass</td></tr></table></td>
+                      <td>
+                        success
+                      </td>
+                    </tr>
+                    <tr>
+                      <td><table><tr><td class="result-success-unexpected">pass</td></tr></table></td>
+                      <td>
+                        unexpected success
+                      </td>
+                    </tr>
+                    <tr>
+                      <td><table><tr><td class="result-fail-expected">fail</td></tr></table></td>
+                      <td>
+                        expected failure
+                      </td>
+                    </tr>
+                    <tr>
+                      <td><table><tr><td class="result-fail-unexpected">fail</td></tr></table></td>
+                      <td>unexpected failure</td>
+                    </tr>
+                  </table>
+                </td>
+              </tr>
+            </xsl:when>
+          </xsl:choose>
+        </xsl:variable>
+
+        <div>
+          <table border="0">
+            <tr>
+              <td><img border="0" src="../c++boost.gif" width="277" height="86" alt="Boost logo"></img></td>
+              <td>
+                <h1 class="page-title">
+                  <xsl:value-of select="$mode"/>
+                  <xsl:text> detailed report: </xsl:text>
+                  <xsl:value-of select="$source"/>
+                </h1>
+
+                <b>Report Time: </b> <!--<xsl:value-of select="$run_date"/>-->
+                <xsl:copy-of select="document( $comment_file )"/>
+              </td>
+            </tr>
+          </table>
+          <table border="0" class="header-table">
+            <tr>
+              <td class="header-item">Purpose</td>
+              <td class="header-item-content">
+                Provides detailed explanation of the results reported on the
+                <a href="{$mode}_summary_page.html"><xsl:value-of select="$mode"/> summary</a> page.
+              </td>
+            </tr>
+            <xsl:copy-of select="$legend"/>
+          </table>
+          <div class="legend">
+            To specify the expected failures for specific test cases create an .xml file 
+            "boost/status/&lt;your library&gt;/expected_results.xml" along these lines:
+<pre>
+&lt;expected-failures&gt;
+&lt;!-- Example:
+&lt;test-result library="mpl" test-name="is_sequence" toolset="bcc-5.5.1" /&gt;
+&lt;test-result library="mpl" test-name="is_sequence" toolset="cwpro-8.3" /&gt;
+--&gt;
+            
+&lt;/expected-failures&gt;
+</pre>
+         </div>
+      </div>
+
+      <!-- TOC -->
+      <div class="toc">
+        <a name="toc"></a>
+        <ul>
+          <xsl:for-each select="$libraries">
+            <xsl:sort select="." order="ascending" />
+            <li class="toc-entry">
+              <a href="#{.}" class="toc-entry">
+                <xsl:value-of select="."/>
+              </a>
+            </li>
+          </xsl:for-each>
+        </ul>
+      </div>
+      
+      <!-- for each library -->
+      <xsl:for-each select="$libraries">
+        <xsl:sort select="." order="ascending" />
+        <xsl:variable name="library" select="." />
+        <div class="library-name">
+            <a name="{$library}" href="../libs/{$library}" class="library-link">
+              <xsl:value-of select="$library" />
+            </a>
+          </div>
+
+          <table border="1" cellspacing="0" cellpadding="0" class="detail-table">
+
+            <thead><xsl:call-template name="toolsets_row"/></thead>
+            <tfoot><xsl:call-template name="toolsets_row"/></tfoot>
+      
+            <tbody>
+              <xsl:variable name="lib_tests" select="//test-log[@library = $library]" />
+              <xsl:variable name="lib_unique_test_names" 
+                select="$lib_tests[ generate-id(.) = generate-id( key('test_name_key', concat( @library, '&gt;@&lt;', @test-name ) ) ) ]" />
+            
+              <xsl:for-each select="$lib_unique_test_names">
+                <xsl:variable name="test_name" select="./@test-name"/>
+                <xsl:variable name="test_program" select="./@test-program"/>
+                <xsl:variable name="test_header">
+                  <td class="test-name">
+                    <a href="../{$test_program}" class="test-link">
+                      <xsl:value-of select="$test_name"/>
+                    </a>
+                  </td>
+                </xsl:variable>
+                <tr>
+                  <xsl:copy-of select="$test_header"/>
+                  <xsl:call-template name="test_type_col"/>
+
+                  <xsl:for-each select="$lib_tests[ @test-name = $test_name ]">
+                    <xsl:sort select="@toolset" order="ascending" />
+                    <xsl:variable name="toolset" select="@toolset" />
+
+                    <xsl:choose>
+                      <xsl:when test="$mode='user'">
+                        <xsl:call-template name="insert_cell_user">
+                          <xsl:with-param name="test_log" select="."/>
+                          <xsl:with-param name="log_link" select="concat( $links_file, '#', $test_name, '%20', $toolset )"/>
+                        </xsl:call-template>
+                      </xsl:when>
+                      <xsl:when test="$mode='developer'">
+                        <xsl:call-template name="insert_cell_developer">
+                          <xsl:with-param name="test_log" select="."/>
+                          <xsl:with-param name="log_link" select="concat( $links_file, '#', $test_name, '%20', $toolset )"/>
+                        </xsl:call-template>
+                      </xsl:when>
+                    </xsl:choose>
+
+                  </xsl:for-each>
+                  <xsl:copy-of select="$test_header"/>
+                </tr>
+              </xsl:for-each>
+            </tbody>
+          </table>
+          <div class="footer">
+            <a href="#toc" class="back-link">toc</a>
+            <xsl:text>&#160;|&#160;</xsl:text>
+            <a href="{$mode}_summary_page.html" class="back-link">summary</a>
+          </div>
+        </xsl:for-each>
+        <div class="acknowledgement">Provided by <a href="http://www.meta-comm.com/engineering">MetaCommunications Engineering</a></div>
+        <div>
+          <a href="http://validator.w3.org/check/referer">
+            <img border="0" src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" height="31" width="88"/>
+          </a>
+        </div>
+
+      </body>
+    </html>
+    
+  </xsl:template>
+  
+
+  <!-- report developer status -->
+  <xsl:template name="insert_cell_developer">
+    <xsl:param name="test_log"/>
+    <xsl:param name="log_link"/>
+    
+    <td class="result-{$test_log/@result}-{$test_log/@status}">
+      <xsl:choose>
+        <xsl:when test="$test_log/@result != 'success' and $test_log/@status = 'expected'">
+          <a href="{$log_link}" class="log-link">
+            fail
+          </a>
+        </xsl:when>
+        <xsl:when test="$test_log/@result != 'success' and $test_log/@status = 'unexpected'">
+          <a href="{$log_link}" class="log-link">
+            fail
+          </a>
+        </xsl:when>
+        <xsl:when test="$test_log/@result = 'success' and $test_log/@status = 'unexpected'">
+            pass
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>pass</xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>  
+    </td>
+  </xsl:template>
+
+  <!-- report user status -->
+  <xsl:template name="insert_cell_user">
+    <xsl:param name="test_log"/>
+    <xsl:param name="log_link"/>
+    
+    <xsl:variable name="class">
+      <xsl:choose>
+        <xsl:when test="$test_log[@result='fail' and @status='unexpected']">
+          <xsl:text>result-user-fail-unexpected</xsl:text>
+        </xsl:when>
+        <xsl:when test="$test_log[ @result='fail' and @status='expected' ]">
+        <xsl:text>result-user-fail-expected</xsl:text>
+      </xsl:when>
+      <xsl:when test="$test_log[ @result='success']">
+        <xsl:text>result-user-success</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:message terminate="yes">
+          Unknown status
+        </xsl:message>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+    <td class="{$class}">
+      <xsl:choose>
+        <xsl:when test="$test_log/@result != 'success' and $test_log/@status = 'expected'">
+          <a href="{$log_link}" class="log-link">
+            fail
+          </a>
+        </xsl:when>
+        <xsl:when test="$test_log/@result != 'success'">
+          <a href="{$log_link}" class="log-link">
+            unexp.
+          </a>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>pass</xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>  
+    </td>
+  </xsl:template>
+
+
+</xsl:stylesheet>

+ 307 - 0
tools/regression/xsl_reports/xsl/summary_page.xsl

@@ -0,0 +1,307 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ (C) Copyright MetaCommunications, Inc. 2003.
+
+ Permission to use, copy, modify, distribute and sell this software
+ and its documentation for any purpose is hereby granted without fee, 
+ provided that the above copyright notice appears in all copies and 
+ that both the copyright notice and this permission notice appear in 
+ supporting documentation. No representations are made about the 
+ suitability of this software for any purpose. It is provided "as is" 
+ without express or implied warranty.
+
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  version="1.0">
+
+  <xsl:output method="html" 
+    doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" 
+    encoding="utf-8" 
+    indent="yes"
+    />
+
+  <xsl:param name="mode"/>
+  <xsl:param name="source"/>
+  <xsl:param name="run_date"/>
+  <xsl:param name="comment_file"/>
+
+  <xsl:variable name="alternate_mode">
+    <xsl:choose>
+      <xsl:when test="$mode='user'">developer</xsl:when>
+      <xsl:otherwise>user</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <!-- necessary indexes -->
+  <xsl:key 
+    name="test_name_key" 
+    match="test-log" 
+    use="concat( @library, '&gt;@&lt;', @test-name )"/>
+  <xsl:key 
+    name="library_key" 
+    match="test-log" 
+    use="@library"/>
+  <xsl:key name="toolset_key" match="test-log" use="@toolset"/>
+
+  <!-- -->
+  <xsl:variable name="toolsets" select="//test-log[ generate-id(.) = generate-id( key('toolset_key',@toolset)[1] ) ]/@toolset"/>
+  <xsl:variable name="libraries" select="//test-log[ generate-id(.) = generate-id( key('library_key',@library)[1] ) and @library != '' ]/@library"/>
+
+  <xsl:template name="toolsets_row">
+    <tr>
+      <td class="head">library / toolset</td>
+      <xsl:for-each select="$toolsets">
+        <xsl:sort select="." order="ascending" />
+        <td class="toolset-name"><xsl:value-of select="."/></td>
+      </xsl:for-each>
+      <td class="head">toolset / library</td>
+    </tr>
+  </xsl:template>
+
+  <xsl:template match="/">
+    <html>
+      <head>
+        <link rel="stylesheet" type="text/css" href="master.css" title="master" />
+        <title>Boost regression - <xsl:value-of select="$mode"/> summary: <xsl:value-of select="$source"/></title>
+      </head>
+      <body>
+
+        <!-- header -->
+
+        <xsl:variable name="legend">
+          <xsl:choose>
+            <xsl:when test="$mode='user'">
+              <tr>
+                <td class="header-item">Purpose</td>
+                <td class="header-item-content">
+                  The purpose of this page and the <a href="{$mode}_result_page.html">detailed user report</a>
+                  is to help a user to find out whether a particular library works on the particular compiler(s).
+                  For CVS "health report", see <a href="{$alternate_mode}_summary_page.html">developer summary</a>.
+                </td>
+              </tr>
+              <tr>
+                <td class="header-item">Legend</td>
+                <td class="header-item-content">
+                  <table border="0" class="legend-table">
+                    <tr>
+                      <td><table><tr><td class="summary-user-success">&#160;</td></tr></table></td>
+                      <td class="legend-item">all library tests are passing</td>
+                    </tr>
+                    <tr>
+                      <td><table><tr><td class="summary-user-fail-expected">details</td></tr></table></td>
+                      <td class="legend-item">
+                        there are some known failures in the tests, see the detailed report
+                      </td>
+                    </tr>
+                    <tr>
+                      <td><table><tr><td class="summary-user-fail-unexpected">unexp.</td></tr></table></td>
+                      <td class="legend-item">
+                        some tests that the library author expects to pass are currently failing,
+                        see the detailed report
+                      </td>
+                    </tr>
+                  </table>
+                </td>
+              </tr>
+            </xsl:when>
+            <xsl:when test="$mode='developer'">
+              <tr>
+                <td class="header-item">Purpose</td>
+                <td class="header-item-content">
+                  The purpose of this page is to provide boost developers with visual indication
+                  of the CVS "health". 
+                  <a href="{$mode}_result_page.html">Detailed report</a> is available.
+                  For user-level report, see <a href="{$alternate_mode}_summary_page.html">user summary</a>.
+                </td>
+              </tr>
+              <tr>
+                <td class="header-item">Legend</td>
+                <td class="header-item-content">
+                  <table border="0" class="legend-table">
+                    <tr>
+                      <td><table><tr><td class="summary-expected">OK</td></tr></table></td>
+                      <td class="legend-item">all expected tests pass</td>
+                    </tr>
+                    <tr>
+                      <td><table><tr><td class="summary-success-unexpected">OK</td></tr></table></td>
+                      <td class="legend-item">
+                        all expected tests pass, and some other tests that were expected to fail 
+                        unexpectedly pass as well
+                      </td>
+                    </tr>
+                    <tr>
+                      <td><table><tr><td class="summary-fail-unexpected">broken</td></tr></table></td>
+                      <td class="legend-item">
+                        tests that the library author expects to pass are currently failing
+                      </td>
+                    </tr>
+                  </table>
+                </td>
+              </tr>
+            </xsl:when>
+          </xsl:choose>
+        </xsl:variable>
+
+        <div>
+          <table border="0">
+            <tr>
+              <td><img border="0" src="../c++boost.gif" width="277" height="86" alt="Boost logo"></img></td>
+              <td>
+                <h1 class="page-title">
+                  <xsl:value-of select="$mode"/>
+                  <xsl:text> summary: </xsl:text>
+                  <xsl:value-of select="$source"/>
+                </h1>
+                <b>Report Time: </b> <xsl:value-of select="$run_date"/>
+                <xsl:copy-of select="document( $comment_file )"/>
+              </td>
+            </tr>
+          </table>
+          <table border="0" class="header-table">
+            <xsl:copy-of select="$legend"/>
+          </table>
+        </div>
+
+        <!-- summary table -->
+
+        <table border="1" cellspacing="0" cellpadding="0" class="summary-table">
+
+          <thead><xsl:call-template name="toolsets_row"/></thead>
+          <tfoot><xsl:call-template name="toolsets_row"/></tfoot>
+      
+          <tbody>
+            <!-- for each library -->
+            <xsl:for-each select="$libraries">
+              <xsl:sort select="." order="ascending" />
+              <xsl:variable name="library" select="."/>
+              <xsl:variable name="current_row" select="//test-log[ @library=$library]"/>
+
+              <xsl:variable name="library_header">
+                <td class="library-name">
+                  <a href="{$mode}_result_page.html#{.}" class="library-link">
+                    <xsl:value-of select="."/>
+                  </a>
+                </td>
+              </xsl:variable>
+
+              <tr class="summary-row">
+                <xsl:copy-of select="$library_header"/>
+
+                <xsl:for-each select="$toolsets">
+                  <xsl:sort select="." order="ascending" />
+                  <xsl:variable name="toolset" select="."/>
+
+                  <xsl:variable name="current_cell" select="$current_row[ @toolset=$toolset ]"/>
+                  <xsl:choose>
+                    <xsl:when test="$mode='user'">
+                      <xsl:call-template name="insert_cell_user">
+                        <xsl:with-param name="current_cell" select="$current_cell"/>
+                        <xsl:with-param name="library" select="$library"/>
+                      </xsl:call-template>
+                    </xsl:when>
+                    <xsl:when test="$mode='developer'">
+                      <xsl:call-template name="insert_cell_developer">
+                        <xsl:with-param name="current_cell" select="$current_cell"/>
+                        <xsl:with-param name="library" select="$library"/>
+                      </xsl:call-template>
+                    </xsl:when>
+                  </xsl:choose>
+                </xsl:for-each>
+                
+                <xsl:copy-of select="$library_header"/>
+              </tr>          
+            </xsl:for-each>
+          </tbody>
+        </table>
+	<div class="acknowledgement">Provided by <a href="http://www.meta-comm.com/engineering">MetaCommunications Engineering</a></div>
+        <div>
+          <a href="http://validator.w3.org/check/referer">
+            <img border="0" src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" height="31" width="88"/>
+          </a>
+        </div>
+    </body>
+ </html>
+</xsl:template>
+
+<!-- report developer status -->
+<xsl:template name="insert_cell_developer">
+  <xsl:param name="current_cell"/>
+  <xsl:param name="library"/>
+  <xsl:variable name="class">
+    <xsl:choose>
+      <xsl:when test="count( $current_cell[@result='fail' and  @status='unexpected'] )">
+        <xsl:text>summary-fail-unexpected</xsl:text>
+      </xsl:when>
+      <xsl:when test="count( $current_cell[@result='success' and  @status='unexpected'] )">
+        <xsl:text>summary-success-unexpected</xsl:text>
+      </xsl:when>
+      <xsl:when test="count( $current_cell[@status='expected'] )">
+        <xsl:text>summary-expected</xsl:text>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:variable>
+  
+  <td class="{$class}">
+    <xsl:choose>
+      <xsl:when test="$class='summary-fail-unexpected'">
+        <a href="{$mode}_result_page.html#{$library}" class="log-link">
+          <xsl:text>broken</xsl:text>
+        </a>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>OK</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </td>
+  
+</xsl:template>
+
+
+<!-- report user status -->
+<xsl:template name="insert_cell_user">
+  <xsl:param name="current_cell"/>
+  <xsl:param name="library"/>
+  <xsl:variable name="class">
+    <xsl:choose>
+      <xsl:when test="count( $current_cell[@result='fail' and @status='unexpected'] )">
+        <xsl:text>summary-user-fail-unexpected</xsl:text>
+      </xsl:when>
+      <xsl:when test="count( $current_cell[ @result='fail'] )">
+        <xsl:text>summary-user-fail-expected</xsl:text>
+      </xsl:when>
+      <xsl:when test="count( $current_cell[ @result='success'] )">
+        <xsl:text>summary-user-success</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:message terminate="yes">
+          Unknown status
+          <xsl:copy-of select="$current_cell">
+          </xsl:copy-of>
+        </xsl:message>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  
+  <td class="{$class}">
+    <xsl:choose>
+      <xsl:when test="$class='summary-user-fail-unexpected'">
+        <a href="{$mode}_result_page.html#{$library}" class="log-link">
+          <xsl:text>unexp.</xsl:text>
+        </a>
+      </xsl:when>
+      <xsl:when test="$class='summary-user-fail-expected'">
+        <a href="{$mode}_result_page.html#{$library}" class="log-link">
+          <xsl:text>details</xsl:text>
+        </a>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>&#160;</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </td>
+  
+</xsl:template>
+
+</xsl:stylesheet>

粤ICP备19079148号