Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the develop branch, built from commit adcd4c09f0.
PrevUpHomeNext

Building and running the tests

This section explains how to build and run this library's tests. It is not intended for the regular user.

This library has both unit and integration tests. Considering the different flavors the MySQL server has (v5.x, v8.x and MariaDB, with sutile differences) and the complex nature of the client/server protocol, we have given certain weight to the latter. Additionally, all examples are also built and run as integration tests, too (as they require access to a real database server).

By default, the build will only compile and run unit tests (i.e. if you run b2 libs/mysql/test or cmake with no special args). If you want to run the integration tests and the examples, you need a real database server.

If you are using docker, you can use one of the following images:

You can run the containers as follows:

# If you're on a system supporting UNIX sockets. Note that /var/run/mysqld
# should be empty for this to work; you can specify a different directory, if it's not
> docker run -p 3306:3306 -v /var/run/mysqld:/var/run/mysqld -d <IMAGE_NAME> # replace by the image you've chosen

# If you're on a system that does not support UNIX sockets
> docker run -p 3306:3306 -d ghcr.io/anarthal-containers/mysql8

You then need to run the following setup files, e.g. by running mysql -u root < path/to/setup.sql:

If you are using your own database server, you will need to install the SSL certificates in tools/ssl in your MySQL server and change your config file so that your server uses them. More information here.

Next, define the following environment variables:

If you are using b2, you can build the targets boost/mysql/example//boost_mysql_all_examples, boost/mysql/test/integration//boost_mysql_integrationtests and boost/mysql/test to build and run the tests.

If you are using cmake, add -DBOOST_MYSQL_INTEGRATION_TESTS=ON to enable building and running integration tests and examples, and then test regularly with ctest.


PrevUpHomeNext