Quickly testing MySQL builds without “make install”

There is a lot happening in mysql-trunk nowadays, and it’s a pain to have to keep pulling from the tree, building, installing and configuring to some test location etc. (unless you have that scripted, which I used to in the past).

Marc Alff showed me a tip a while ago to not have to do the install/config stage, and I thought it was worth sharing – it’s how I keep up to date with trying out the new things that I see fly by in the commits list.

First, you of course need to be able to build the MySQL Server from source. This is not as hard as it seems on most platforms, don’t be daunted.

Once you have the dependencies in place for this, and the mysql-trunk tree branched:

$ cd ~/
$ mkdir mysql
$ cd mysql
$ bzr init-repo .
$ bzr branch lp:~mysql/mysql-server/mysql-trunk mysql-trunk

And a build done (using your favorite build script, or following some of the above linked instructions):

$ cd ~/mysql/mysql-trunk
$ BUILD/compile-pentinum-debug-max-no-ndb
testing nocona ... ok
+++ /bin/rm -rf configure
+++ /bin/rm -rf CMakeCache.txt CMakeFiles/
+++ path=BUILD
...
Linking CXX shared module ha_example.so
[100%] Built target example
[100%] Building CXX object plugin/semisync/CMakeFiles/semisync_master.dir/semisync_master_plugin.cc.o
Linking CXX shared module semisync_slave.so
[100%] Built target semisync_slave
Linking CXX shared module semisync_master.so
[100%] Built target semisync_master

All you have to do to try out that build now is start the test infrastructure, with the following:

$ cd mysql-test
$ ./mtr --start parser &
[1] 15906
$ Logging: ./mtr  --start parser
110329 13:26:50 [Warning] Setting lower_case_table_names=2 because file system for /var/folders/xl/xl3jnqYbFHOYXXGB0cZuB++++TI/-Tmp-/WA3QLELTBm/ is case insensitive
110329 13:26:50 [Note] Plugin 'FEDERATED' is disabled.
110329 13:26:50 [Note] Binlog end
110329 13:26:50 [Note] Shutting down plugin 'CSV'
110329 13:26:50 [Note] Shutting down plugin 'MyISAM'
MySQL Version 5.6.3
Checking supported features...
 - skipping ndbcluster
 - SSL connections supported
 - binaries are debug compiled
Collecting tests...
vardir: /Users/mark/mysql/lp-mysql-trunk/mysql-test/var
Checking leftover processes...
 - found old pid 50573 in 'mysqld.1.pid', killing it...
   process did not exist!
Removing old var directory...
Creating var directory '/Users/mark/mysql/lp-mysql-trunk/mysql-test/var'...
Installing system database...
Using server port 49463

==============================================================================

TEST                                      RESULT   TIME (ms) or COMMENT
--------------------------------------------------------------------------

worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 13000..13009
worker[1] 
Started [mysqld.1 - pid: 15918, winpid: 15918]
worker[1] Using config for test main.parser
worker[1] Port and socket path for server(s):
worker[1] mysqld.1  13000  /Users/mark/mysql/lp-mysql-trunk/mysql-test/var/tmp/mysqld.1.sock
worker[1] Waiting for server(s) to exit...
$

This starts up an instance, based on your build tree, that will wait around for new interactive connections, rather than running a specific set of tests and exiting. To connect to the instance:

$ ../client/mysql -u root -S ./var/tmp/mysqld.1.sock 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.3-m5-debug-log Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mtr                |
| mysql              |
| performance_schema |
| test               |
+--------------------+
5 rows in set (0.00 sec)

For most testing that doesn’t involve replication I’ve found this the best way to try and keep up to date with the main line. It means you can maintain a “default install” location for more serious testing (the one in which you might “make install” to), whilst continually building and testing with the current tree.