Author: paul
Date: 2008-08-29 17:51:56 +0200 (Fri, 29 Aug 2008)
New Revision: 11625
Log:
r33552@frost: paul | 2008-08-29 10:53:06 -0500
General revisions to mysqltest manual
Modified:
trunk/mysqltest/writing-tests.xml
Property changes on: trunk
___________________________________________________________________
Name: svk:merge
- 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:35828
7d8d2c4e-af1d-0410-ab9f-b038ce55645b:/mysqldoc-local/mysqldoc:33550
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:14218
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:32819
+ 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:35828
7d8d2c4e-af1d-0410-ab9f-b038ce55645b:/mysqldoc-local/mysqldoc:33552
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:14218
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:32819
Modified: trunk/mysqltest/writing-tests.xml
===================================================================
--- trunk/mysqltest/writing-tests.xml 2008-08-29 00:31:08 UTC (rev 11624)
+++ trunk/mysqltest/writing-tests.xml 2008-08-29 15:51:56 UTC (rev 11625)
Changed blocks: 19, Lines Added: 105, Lines Deleted: 74; 14345 bytes
@@ -1251,9 +1251,9 @@
<para>
<command>mysql-test-run.pl</command> supports several options that
- enable you to pass options to <command>mysqld</command> or
- <command>mysqltest</command>. Each of these options takes a value
- consisting of one or more comma-separated options.
+ enable you to pass options to other programs. Each of these
+ options takes a value consisting of one or more comma-separated
+ options:
</para>
<itemizedlist>
@@ -1262,11 +1262,14 @@
<para>
The <option>--mysqld</option> option tells
<command>mysql-test-run.pl</command> to start the
- <command>mysqld</command> server with the named options.
+ <command>mysqld</command> server with the named options. The
+ following command causes <option>--skip-innodb</option> and
+ <option>--key_buffer_size=16384</option> to be passed to
+ <command>mysqld</command>:
</para>
<programlisting>
-shell> <userinput>mysql-test-run.pl
--mysqld=<replaceable>opt1</replaceable>,<replaceable>opt2</replaceable>,...</userinput>
+shell> <userinput>mysql-test-run.pl
--mysqld=--skip-innodb,--key_buffer_size=16384</userinput>
</programlisting>
</listitem>
@@ -1276,21 +1279,31 @@
<option>--mysqld</option>, but should be specified two or more
times. <command>mysql-test-run.pl</command> executes multiple
test runs, using the options for each instance of
- <option>--combination</option> in successive runs. If
- <option>--combination</option> is given only once, it has no
- effect.
+ <option>--combination</option> in successive runs. The
+ following command passes <option>--skip-innodb</option> to
+ <command>mysqld</command> for the first test run, and
+ <option>--innodb</option> and
+ <option>--innodb-file-per-table</option> for the second test
+ run:
</para>
<programlisting>
-shell> <userinput>mysql-test-run.pl
--combination=<replaceable>opt1</replaceable>,<replaceable>opt2</replaceable>,...
--combination=<replaceable>opt1</replaceable>,<replaceable>opt2</replaceable>,...</userinput>
+shell> <userinput>mysql-test-run.pl</userinput>
+ <userinput>--combination=--skip-innodb</userinput>
+
<userinput>--combination=--innodb,--innodb-file-per-table</userinput>
</programlisting>
<para>
+ If <option>--combination</option> is given only once, it has
+ no effect.
+ </para>
+
+ <para>
For test runs specific to a given test suite, an alternative
- to the use of <option>--combination</option> is to create a
- <filename>combinations</filename> file in the suite directory.
- The file should contain a section of options for each test
- run. For an example, see
+ to the use of the <option>--combination</option> option is to
+ create a <filename>combinations</filename> file in the suite
+ directory. The file should contain a section of options for
+ each test run. For an example, see
<xref linkend="writing-tests-binlog-control-global"/>.
</para>
@@ -1305,11 +1318,15 @@
<para>
The <option>--mysqltest</option> option tells
<command>mysql-test-run.pl</command> to start
- <command>mysqltest</command> with the named options.
+ <command>mysqltest</command> with the named options. The
+ following command passes <option>--quiet</option>,
+ <option>--sleep=5</option>, and
+ <option>--mark-progress</option> to
+ <command>mysqltest</command>:
</para>
<programlisting>
-shell> <userinput>mysql-test-run.pl
--mysqltest=<replaceable>opt1</replaceable>,<replaceable>opt2</replaceable>,...</userinput>
+shell> <userinput>mysql-test-run.pl
--mysqltest=--quiet,--sleep=5,--mark-progress</userinput>
</programlisting>
<para>
@@ -1327,7 +1344,7 @@
<title>Specifying Test Case-Specific Server Options</title>
<para>
- Many server options can be set from within test cases by using
+ Within a test case, many system variables can be set by using
statements such as these:
</para>
@@ -1337,9 +1354,9 @@
</programlisting>
<para>
- But sometimes you need to restart the server to use options in the
- form of extra command-line options. You can specify these options
- in a file named
+ But sometimes you need to restart the server to use command-line
+ options that are specific to a given test case. You can specify
+ these options in a file named
<filename>mysql-test/t/<replaceable>test_name</replaceable>-master.opt</filename>.
When a file named
<filename>t/<replaceable>test_name</replaceable>-master.opt</filename>
@@ -1370,9 +1387,10 @@
<para>
The <filename>include</filename> directory contains many files
- intended for inclusion into test case files. For example, to
- verify that the server supports the <literal>CSV</literal> storage
- engine, do this:
+ intended for inclusion into test case files. For example, if a
+ test case needs to verify that the server supports the
+ <literal>CSV</literal> storage engine, use this line in the test
+ case file:
</para>
<programlisting>
@@ -1422,7 +1440,7 @@
<listitem>
<para>
- Control the binary logging format. See
+ Control the binary log format. See
<xref linkend="writing-tests-binlog-control"/>.
</para>
</listitem>
@@ -1443,7 +1461,7 @@
<title>Controlling the Binary Log Format Used for Tests</title>
<indexterm>
- <primary>binary logging</primary>
+ <primary>binary log format</primary>
<secondary>controlling</secondary>
</indexterm>
@@ -1452,23 +1470,22 @@
statement-based logging (SBL), which logs events as statements
that produce data changes. As of MySQL 5.1, the server also
supports row-based logging (RBL), which logs events as changes to
- individual rows, and mixed logging, which switches between SBL and
- RBL automatically as necessary. Some tests require the use of a
- particular binary logging format. This section describes how to
- control the format for testing purposes.
+ individual rows. It also supports mixed logging, which switches
+ between SBL and RBL automatically as necessary. Some tests require
+ the use of a particular binary log format. This section describes
+ how to control the format for testing purposes.
</para>
<para>
The server's global <literal>binlog_format</literal> system
- variable indicates which logging format is in effect. It has
- possible values of <literal>STATEMENT</literal>,
- <literal>ROW</literal>, and <literal>MIXED</literal> (not
case
- sensitive). This system variable can be set at server startup by
- specifying
+ variable indicates which log format is in effect. It has possible
+ values of <literal>STATEMENT</literal>,
<literal>ROW</literal>,
+ and <literal>MIXED</literal> (not case sensitive). This system
+ variable can be set at server startup by specifying
<option>--binlog_format=<replaceable>value</replaceable></option>
on the command line or in an option file. A user who has the
- <literal>SUPER</literal> privilege can change the logging format
- at runtime. For example:
+ <literal>SUPER</literal> privilege can change the log format at
+ runtime. For example:
</para>
<programlisting>
@@ -1476,30 +1493,36 @@
</programlisting>
<para>
- For tests, you can exercise control over the binary logging
- format:
+ For tests, you can exercise control over the binary log format in
+ two ways:
</para>
<itemizedlist>
<listitem>
<para>
- To control the format the server uses for an entire test run,
- you can pass options to <command>mysql-test-run.pl</command>.
+ To control the log format that the server uses for an entire
+ test run, you can pass options to
+ <command>mysql-test-run.pl</command> that tell it which format
+ <command>mysqld</command> should use.
</para>
</listitem>
<listitem>
<para>
- To verify that a particular format is in effect for a specific
- test case, you can use an appropriate include file that checks
- the current format and exits if the format is other than what
- is required.
+ To verify that a particular log format is in effect for a
+ specific test case, you can use an appropriate include file
+ that checks the current format and exits if the format is
+ other than what is required.
</para>
</listitem>
</itemizedlist>
+ <para>
+ The following sections describe how to use these techniques.
+ </para>
+
<section id="writing-tests-binlog-control-global">
<title>Controlling the Binary Log Format Used for an Entire Test
Run</title>
@@ -1581,8 +1604,10 @@
<para>
The format of the <filename>combinations</filename> file is
similar to that of <filename>my.cnf</filename> files (section
- names followed by options for each section), but options are
- given with the leading dashes.
+ names followed by options for each section), but options listed
+ in the <filename>combinations</filename> file should include the
+ leading dashes. (Options in <filename>my.cnf</filename> files
+ are given without the leading dashes.)
</para>
<para>
@@ -1624,8 +1649,8 @@
</programlisting>
<para>
- The following files can be used for tests that support two
- logging formats:
+ The following files can be used for tests that support two log
+ formats:
</para>
<programlisting>
@@ -1645,9 +1670,9 @@
</para>
<para>
- If a test supports all binary logging formats, none of the
- preceding include files should be used in the test file. A test
- that includes no <filename>have_binlog_format_*.inc</filename>
+ If a test supports all binary log formats, none of the
+ <filename>have_binlog_format_*.inc</filename> include files
+ should be used in the test file. A test that includes no such
file is assumed to support all formats.
</para>
@@ -1664,22 +1689,30 @@
</indexterm>
<para>
- This section provides guidelines specific to writing replication
- tests.
+ If you are writing a replication test case, the test case file
+ should begin with this command:
</para>
+<programlisting>
+--source include/master-slave.inc
+</programlisting>
+
<para>
- If you are writing a replication test case, the first line of the
- test file should be <literal>source
- include/master-slave.inc;</literal>. To switch between master and
- slave, use <literal>connection master;</literal> and
- <literal>connection slave;</literal>. If you need to do something
- on an alternative connection, you can do <literal>connection
- master1;</literal> for the master, and <literal>connection
- slave1;</literal> for the slave.
+ To switch between the master and slave, use these commands:
</para>
+<programlisting>
+connection master;
+connection slave;
+</programlisting>
+
<para>
+ If you need to do something on an alternative connection, you can
+ use <literal>connection master1;</literal> for the master, and
+ <literal>connection slave1;</literal> for the slave.
+ </para>
+
+ <para>
To run the master with additional options for your test case, put
them in the command-line format in
<filename>t/<replaceable>test_name</replaceable>-master.opt</filename>.
@@ -1700,20 +1733,20 @@
</para>
<para>
- Several include files are available for use in tests to enable
+ Several include files are available for use in tests that enable
better control over the behavior of slave server I/O and SQL
- threads. These files are located in the
- <filename>include</filename> directory and have names of the form
- <filename>wait_for_slave_*.inc</filename>. By using them, you can
- help make replication tests more stable because it will be more
- likely that test failures are due to replication failure, not due
- to problems with the tests themselves.
+ threads. The files are located in the <filename>include</filename>
+ directory and have names of the form
+ <filename>wait_for_slave_*.inc</filename>. By using these files,
+ you can help make replication tests more stable because it will be
+ more likely that test failures are due to replication failures,
+ not due to problems with the tests themselves.
</para>
<para>
- The include files address the issue that it is not always
- sufficient to use a <literal>START SLAVE</literal> or
- <literal>STOP SLAVE</literal> statement by itself because when the
+ The slave-control include files address the issue that it is not
+ always sufficient to use a <literal>START SLAVE</literal> or
+ <literal>STOP SLAVE</literal> statement by itself: When the
statement returns, the slave may not have reached the desired
operational state. For example, with <literal>START
SLAVE</literal>, the following considerations apply:
@@ -1753,7 +1786,7 @@
<programlisting>
START SLAVE;
-source include/wait_for_slave_to_start.inc;
+--source include/wait_for_slave_to_start.inc
</programlisting>
<para>
@@ -1762,7 +1795,7 @@
<programlisting>
STOP SLAVE;
-source include/wait_for_slave_to_stop.inc;
+--source include/wait_for_slave_to_stop.inc
</programlisting>
<para>
@@ -1949,9 +1982,7 @@
<para>
Performing filesystem operations
</para>
- </listitem>
- <listitem>
<para>
Avoid using <literal>exec</literal> or
<literal>system</literal> to execute operating system commands
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r11625 - in trunk: . mysqltest | paul.dubois | 29 Aug |