README BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/xsl/README

mysqltest.xsl	BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/xsl/mysqltest.xsl
sel000001.xml	BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000001.xml
README  	BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/README
parent f9588a3d
This directory contains all of the test cases for the MySQL Test Suite
marked up in XML.
To convert these test cases from XML into 'mysqltest' format, one needs
an XSL translator installed on their system. At MySQL, we use Sablotron
(http://www.gingerall.com/). Once installed, conversion happens with a
command like this:
sabcmd xsl/mysqltest.xsl < tests/sel000001.xml > sel000001.test
The file 'sel000001.test' contains the plain text conversion that is
to be fed into the 'mysqltest' program.
Below is an example of a test case marked up in XML; illustrating all
of the XML mark-up currently supported in our 'mysqltest.xsl' stylesheet.
----------------------------------------------------
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000001">
<version value="3.22"/>
<version value="3.23"/>
<description>This test will monkey around trying to kill mysqld.</description>
<connect name="Test_Connect1"
host="MyHostName"
user="Matt"
pass="MattPass"
db="MyDB"
port="3306"
sock="MyDB.sock"
/>
<connection name="Test_Connect1">
<resultfile name="sel000001.result">
<sql>SELECT y FROM foo WHERE bar='2'</sql>
</resultfile>
<sql>INSERT INTO foo VALUES (y='2') WHERE bar='1'</sql>
</connection>
</test>
----------------------------------------------------
The converted (mysqltest format) output of this source XML file looks
like:
----------------------------------------------------
# sel000001
#
# Versions
# --------
# 3.22
# 3.23
#
# Description
# -----------
# This test will monkey around trying to kill mysqld.
#
connect(Test_Connect1, MyHostName, Matt, MattPass, MyDB, 3306, MyDB.sock)
connection Test_Connect1
INSERT INTO foo VALUES (y='2') WHERE bar='1';
@sel000001.result SELECT y FROM foo WHERE bar='2';
----------------------------------------------------
<?xml version="1.0" standalone="no"?>
<!-- This file is maintained by matt@mysql.com -->
<test name="sel000001">
<version value="3.22"/>
<version value="3.23"/>
<description>This test is just a simple select.</description>
<sql>DROP TABLE IF EXISTS t</sql>
<sql>CREATE TABLE t (s CHAR(20) PRIMARY KEY, id INT)</sql>
<sql>INSERT INTO t VALUES ('cat', 1), ('mouse', 3), ('dog', 2), ('snake', 77)</sql>
<resultfile name="r/3.23/sel000001.result">
<sql>SELECT s, id FROM t WHERE s = 'mouse'</sql>
</resultfile>
</test>
XML Stylesheets for converting test cases in XML to other forms.
- mysqltest.xsl -> mysqltest format (text)
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/"><xsl:apply-templates /></xsl:template>
<!-- Main Template -->
<xsl:template match="/test"># <xsl:apply-templates select="@name"/>
#
# Versions
# --------<xsl:apply-templates select="version"/>
#
# Description
# -----------<xsl:apply-templates select="description"/>
#
<xsl:apply-templates select="connect"/>
<xsl:apply-templates select="connection"/>
<xsl:apply-templates select="sql"/>
<xsl:apply-templates select="resultfile"/>
</xsl:template>
<!-- End Main Template -->
<xsl:template match="version">
# <xsl:apply-templates select="@value"/>
</xsl:template>
<xsl:template match="description">
# <xsl:apply-templates />
</xsl:template>
<xsl:template match="connect">
connect(<xsl:apply-templates select="@name"/>, <xsl:apply-templates select="@host"/>, <xsl:apply-templates select="@user"/>, <xsl:apply-templates select="@pass"/>, <xsl:apply-templates select="@db"/>, <xsl:apply-templates select="@port"/>, <xsl:apply-templates select="@sock"/>)
</xsl:template>
<xsl:template match="connection">
<xsl:text>
connection </xsl:text><xsl:apply-templates select="@name"/>
<xsl:text>
</xsl:text>
<xsl:apply-templates select="sql"/>
<xsl:apply-templates select="resultfile"/>
</xsl:template>
<xsl:template match="resultfile">@<xsl:apply-templates select="@name"/><xsl:text> </xsl:text><xsl:apply-templates select="sql"/>
</xsl:template>
<xsl:template match="sql">
<xsl:apply-templates />;
</xsl:template>
</xsl:stylesheet>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment