grim/gplate

Parents a024414ebc2c
Children 4ac0ba0da721
Added a stylesheet for the check output as well as a make rule for it...
--- a/configure.ac Sun Feb 10 03:03:30 2008 -0600
+++ b/configure.ac Sun Feb 10 07:40:05 2008 -0600
@@ -169,6 +169,7 @@
jhbuild/Makefile
po/Makefile.in
tests/Makefile
+ tests/html/Makefile
])
dnl #######################################################################
--- a/tests/Makefile.am Sun Feb 10 03:03:30 2008 -0600
+++ b/tests/Makefile.am Sun Feb 10 07:40:05 2008 -0600
@@ -3,6 +3,8 @@
include2.gplate \
test.h
+SUBDIRS=html
+
if BUILD_TESTS
TESTS=test
@@ -27,4 +29,14 @@
$(CHECK_CFLAGS) \
$(GLIB_CFLAGS)
+html: gplate-tests.xml
+ xsltproc \
+ --nonet \
+ --stringparam project GPlate \
+ --stringparam arch `uname -m` \
+ --stringparam version $(VERSION) \
+ -o html/results.html \
+ check.xsl \
+ gplate-tests.xml
+
endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/check.xsl Sun Feb 10 07:40:05 2008 -0600
@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet version="1.1"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:check="http://check.sourceforge.net/ns"
+>
+
+ <xsl:param name="project"/>
+ <xsl:param name="arch"/>
+
+ <xsl:output method="xml"
+ version="1.0"
+ encoding="UTF-8"
+ doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
+ doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+ />
+
+ <xsl:variable name="script">
+ <script type="text/javascript">
+ <xsl:comment>
+ function toggle(div) {
+ element = document.getElementById(div);
+
+ if(element.style.display == 'block') {
+ element.style.display = 'none';
+ } else {
+ element.style.display = 'block';
+ }
+ }
+ </xsl:comment>
+ </script>
+ </xsl:variable>
+
+ <xsl:variable name="css">
+ <style type="text/css">
+ <xsl:comment>
+ ul { list-style-type: none; margin: 0px; padding: 0px; }
+ a, a:hover { color: #000000; text-decoration: none; background-color: #ffffff; }
+ pre { margin: 0px; }
+ img { border: 0px; }
+ div { display: none; padding: 0px; margin: 0px; }
+ div.header { display: block; }
+ div.passed-message { margin: 2px 0px; background-color: #cfffcf; border: solid 1px #7fff7f; color: #000000; }
+ div.failed-message { margin: 2px 0px; background-color: #ffcfcf; border: solid 1px #ff7f7f; color: #000000; }
+ </xsl:comment>
+ </style>
+ </xsl:variable>
+
+ <xsl:variable name="title">
+ <xsl:choose>
+ <xsl:when test="$project">
+ <xsl:value-of select="$project"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>Unnamed Project</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text> - Check Results</xsl:text>
+ </xsl:variable>
+
+ <xsl:template match="check:testsuites">
+ <html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <xsl:copy-of select="$script"/>
+ <xsl:copy-of select="$css"/>
+ <title><xsl:copy-of select="$title"/></title>
+ </head>
+ <body>
+ <div class="header">
+ <h1><xsl:copy-of select="$title"/></h1>
+
+ <table>
+ <tr>
+ <td><strong><xsl:text>Version:</xsl:text></strong></td>
+ <td><xsl:value-of select="$version"/></td>
+ </tr>
+ <tr>
+ <td><strong><xsl:text>Architect:</xsl:text></strong></td>
+ <td><xsl:value-of select="$arch"/></td>
+ </tr>
+ <tr>
+ <td><strong><xsl:text>Ran on:</xsl:text></strong></td>
+ <td><xsl:value-of select="check:datetime"/></td>
+ </tr>
+ <tr>
+ <td><strong><xsl:text>Duration:</xsl:text></strong></td>
+ <td><xsl:value-of select="check:duration"/><xsl:text> seconds</xsl:text></td>
+ </tr>
+ </table>
+ </div>
+ <xsl:apply-templates/>
+ </body>
+ </html>
+ </xsl:template>
+
+ <xsl:template match="check:suite">
+ <xsl:if test="check:test">
+ <h2><xsl:value-of select="check:title"/></h2>
+ <ul>
+ <xsl:for-each select="check:test">
+ <li>
+ <xsl:element name="a">
+ <xsl:attribute name="href">
+ <xsl:text>javascript:toggle('</xsl:text>
+ <xsl:value-of select="check:id"/>
+ <xsl:text>')</xsl:text>
+ </xsl:attribute>
+ <xsl:value-of select="check:id"/>
+ <xsl:text> </xsl:text>
+ <xsl:choose>
+ <xsl:when test="@result='success'">
+ <img src="passed.png" alt="passed"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <img src="failed.png" alt="failed"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="div">
+ <xsl:attribute name="id">
+ <xsl:value-of select="check:id"/>
+ </xsl:attribute>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="@result='success'">
+ <xsl:text>passed-message</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>failed-message</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <pre><xsl:value-of select="check:message"/></pre>
+ </xsl:element>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- these too are handled manually earlier, but need matches to not be
+ rendered separately.
+ -->
+ <xsl:template match="check:datetime"/>
+ <xsl:template match="check:duration"/>
+
+</xsl:stylesheet>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/html/Makefile.am Sun Feb 10 07:40:05 2008 -0600
@@ -0,0 +1,3 @@
+EXTRA_DIST=\
+ failed.png \
+ passed.png
Binary file tests/html/failed.png has changed
Binary file tests/html/passed.png has changed