Skip to main content
This guide covers the test-and-iterate loop for a C++ extension: setting up a local server, installing .veb files, running regression tests, and debugging failures. It is the companion to Creating Extensions in C++, which covers the initial build, and C++ Development, which covers VDF authoring depth.
If you are contributing to the VillageSQL server itself (not building an extension), see Build from Source, which covers the full server developer workflow including running tests with mysql-test-run.pl directly.

Setting Up Your Environment

To develop and test extensions, you need a built VillageSQL server. Follow the Clone and Build from Source guide to compile the server binaries. Once you have a build, use the villagesql CLI to manage a local dev server instance. Run all commands from the directory where VillageSQL was installed.

Starting a Local Dev Server

Initialize and start a server instance:
To set a root password on init:
To enable or disable mysqld features for a test run, pass flags after a -- separator; everything after it is forwarded verbatim to mysqld:
Any unrecognized argument before the -- is rejected, so use -- for every flag you intend for mysqld. Pass --dir <path> before any command to manage multiple independent instances, or use --here to create a server directory in the current working directory:

Managing Extension Files

Before installing an extension via SQL, its .veb file must be present on the server. The CLI manages the server’s lib/veb/ directory:
.veb files placed in lib/veb/ before init are seeded automatically. After adding a file, install the extension via SQL:

Running Regression Tests

Run extension regression tests using the MySQL Test Runner from your VillageSQL build directory.

Running the Full Suite

To run all tests for your extension:

Running Individual Tests

To run a single test case, specify the suite path and test name:

Creating New Tests

When adding new features or fixing bugs, you should add corresponding regression tests.

Test Location

Extension tests live in the extension’s own repository under a mysql-test/ directory — not in the VillageSQL server’s mysql-test/suite/ tree.
  • Test files end with .test and go in mysql-test/t/.
  • Expected result files end with .result and go in mysql-test/r/.
For example, for an extension named my_extension:
  • mysql-test/t/my_new_test.test
  • mysql-test/r/my_new_test.result

Test File Conventions

A typical extension test installs the extension, runs SQL, and uninstalls:
When your test output includes paths from the test runner’s temp directory, add this directive inside your .test file to normalize them — without it, recorded results contain absolute paths that break on other machines:

Steps to Add a Test

  1. Create the .test file in your extension’s mysql-test/t/ directory.
  2. Create an empty .result file in your extension’s mysql-test/r/ directory.
  3. Run the test with --record to generate the expected output:
  4. Verify the output in the generated .result file to ensure it matches your expectations.

Debugging Tests

If a test fails, the test framework provides detailed logs.
  • Test output: Check mysql-test/var/log/mysqltest.log (combined) or mysql-test/var/log/<test_name>/ (per-test directory).
  • Server error log: Check mysql-test/var/log/mysqld.1.err. VillageSQL-specific log messages (emitted via LogVSQL()) only appear when the server runs with --log-error-verbosity=3.
  • Diff: The framework outputs a diff between the actual output and the expected .result file.
To run a test with extra debug information:

See Also