Skip to content

RandomQueryGeneratorIntegration

philip-stoev edited this page Jul 17, 2012 · 1 revision

Category:RandomQueryGenerator

Using the Random Query Generator with MTRv2 - mysql-test-run.pl

MTRv2 provides the capability to start a server and then run an external script against it, in this case, the RQG. A sample .test file looks like this:

 --exec perl $RQG_HOME/gentest.pl --dsn=dbi:mysql:host=127.0.0.1:port=$MASTER_MYPORT:user=root:database=test --grammar=$RQG_HOME/conf/example.yy > $MYSQL_TMP_DIR/rqg.out 2>&1
 
 DROP DATABASE test;
 CREATE DATABASE test;
 --exit

Unless RQG_HOME is set, the test will be skipped. Otherwise, an RQG scenario will run against the server that has already been stated by MTR. Since the output of a concurrent RQG run is not deterministic, we pipe it to a temporary file. If you want RQG output to be displayed on your std.out along with other MTR output, use --system instead of --exec and remove the redirection part of the command.

The final statements recreate an empty test database so that MTRv2 does not complain that the test had side effects and did not clean up properly.

NOTE that if the statements generated by the RQG may result in warnings being printed to the server's error log, and you want to accept such warnings as being valid, you may need to add the option --nowarnings to your MTR command line (depending on which version of MTR you use). Otherwise MTR will check the error log after the test and proclaim failure if warnings (such as deadlocks) are found.

Using RQG with PushBuild2

More information is available here https://inside.mysql.com/wiki/Pushbuild2ExternalTests (authorization required)