DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(mysql.info.gz) extending mysqltest

Info Catalog (mysql.info.gz) running mysqltest (mysql.info.gz) MySQL test suite (mysql.info.gz) Reporting mysqltest bugs
 
 25.1.2.2 Extending the MySQL Test Suite
 .......................................
 
 You can use the `mysqltest' language to write your own test cases.
 Unfortunately, we have not yet written full documentation for it.  You
 can, however, look at our current test cases and use them as an
 example.  The following points should help you get started:
 
    * The tests are located in `mysql-test/t/*.test'
 
    * A test case consists of `;' terminated statements and is similar
      to the input of `mysql' command-line client.  A statement by
      default is a query to be sent to MySQL server, unless it is
      recognized as internal command (eg. `sleep').
 
    * All queries that produce results--for example, `SELECT', `SHOW',
      `EXPLAIN', etc., must be preceded with @/PATH/TO/RESULT/FILE.  The
      file must contain the expected results.  An easy way to generate
      the result file is to run `mysqltest -r < t/test-case-name.test'
      from the `mysql-test' directory, and then edit the generated
      result files, if needed, to adjust them to the expected output.
      In that case, be very careful about not adding or deleting any
      invisible characters -- make sure to only change the text and/or
      delete lines.  If you have to insert a line, make sure that the
      fields are separated by a hard tab, and that there is a hard tab
      at the end.  You may want to use `od -c' to make sure that your
      text editor has not messed anything up during edit.  We hope that
      you will never have to edit the output of `mysqltest -r' as you
      only have to do it when you find a bug.
 
    * To be consistent with our setup, you should put your result files
      in the `mysql-test/r' directory and name them `test_name.result'.
      If the test produces more than one result, you should use
      `test_name.a.result', `test_name.b.result', etc.
 
    * If a statement returns an error, you should specify it with
      `--error error-number' on the line before the statement.  The
      error number can be a list of possible error numbers separated by
      `,'.
 
    * If you are writing a replication test case, you should on the
      first line of the test file, put `source
      include/master-slave.inc;'.  To switch between master and slave,
      use `connection master;' and `connection slave;'.  If you need to
      do something on an alternate connection, you can do `connection
      master1;' for the master, and `connection slave1;' for the slave.
 
    * If you need to do something in a loop, you can use something like
      this:
           let $1=1000;
           while ($1)
           {
            # do your queries here
            dec $1;
           }
 
    * To sleep between queries, use the `sleep' command. It supports
      fractions of a second, so you can use `sleep 1.3;', for example,
      to sleep 1.3 seconds.
 
    * To run the slave with additional options for your test case, put
      them in the command-line format in
      `mysql-test/t/test_name-slave.opt'. For the master, put them in
      `mysql-test/t/test_name-master.opt'.
 
    * If you have a question about the test suite, or have a test case
      to contribute, send an email message to the MySQL `internals'
      mailing list.   Mailing-list.  As this list does not accept
      attachments, you should ftp all the relevant files to:
      `ftp://ftp.mysql.com/pub/mysql/upload/'
 
 
Info Catalog (mysql.info.gz) running mysqltest (mysql.info.gz) MySQL test suite (mysql.info.gz) Reporting mysqltest bugs
automatically generated byinfo2html