.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 thevillagesql 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:--
separator; everything after it is forwarded verbatim to mysqld:
-- 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 amysql-test/ directory — not in the VillageSQL server’s mysql-test/suite/ tree.
- Test files end with
.testand go inmysql-test/t/. - Expected result files end with
.resultand go inmysql-test/r/.
my_extension:
mysql-test/t/my_new_test.testmysql-test/r/my_new_test.result
Test File Conventions
A typical extension test installs the extension, runs SQL, and uninstalls:.test file to normalize them — without it, recorded results contain absolute paths that break on other machines:
Steps to Add a Test
- Create the
.testfile in your extension’smysql-test/t/directory. - Create an empty
.resultfile in your extension’smysql-test/r/directory. - Run the test with
--recordto generate the expected output: - Verify the output in the generated
.resultfile 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) ormysql-test/var/log/<test_name>/(per-test directory). - Server error log: Check
mysql-test/var/log/mysqld.1.err. VillageSQL-specific log messages (emitted viaLogVSQL()) only appear when the server runs with--log-error-verbosity=3. - Diff: The framework outputs a diff between the actual output and the expected
.resultfile.
See Also
- Testing Network-Dependent Extensions — reliable MTR patterns for extensions that spawn HTTP servers or external listeners
- Creating Extensions in C++ — end-to-end build steps, CMake setup, and installation
- C++ Development — VDF authoring depth, argument and result types, aggregates, varargs
- C++ API Reference — VDF contracts, null handling, and buffer sizing

