How to run mtests in QtCreator/MinGW Windows
I have a setup similar to https://musescore.org/en/handbook/developers-handbook/compilation/compi… for which I'll specify the settings here. This was not a clean local copy, but one that has been around for a while and updated several times.
I worked on the 3.x branch at around the 3.5beta tag; I suspect the steps required for master will be quite similar.
- QtCreator: 4.12.0
- Kit: Qt 5.12.5 MinGW 64-bit
- cmake: 3.16.4
Build target mscore :
cmake.exe --build . --target mscore -- -j3
Build target install :
cmake.exe --build . --target install -- -j3
Assuming https://github.com/musescore/MuseScore/pull/6392 is merged into your local clone
Add an additional build step to build the mtests. As building them all can take quite some time, you might consider building just a selection of tests.
For just one test:
- Add Build Step, type "Build"
- Check the corresponding target (for example
For all tests:
- Add Build Step, type "build"
- Check the target
Disable build steps
You can easily disable a certain build step (for example, disable the mtest build during initial development/debugging to save on compilation time). Do this by clicking the "stop sign" for the corresponding build step (in the screenshot the normal
mscore and the additional
tst_repeat build steps will not be executed as they are disabled):
Build Environment PATH changes
To be able to run the test from their build location, they need to include the build library search path. Rather than painstakingly adjusting each run target, we'll explicitly update the Build Environment Path variable, which by default is also used for the run target environment.
- Click on Details to expand the Build Environment settings
- Select the
Pathentry in the list
Prepend Pathand navigate to the Qt MinGW binary directory (
Prepend Pathagain and navigate to the
dependenciesdirectory of your local clone (
If you don't have
diff into your path, then append it here as well by clicking on
Append Path. This tool is required for many tests to compare the test result against the reference score. I pointed to
C:\Program Files\Git\usr\bin as diff comes along with the Git for Windows install which any windows MuseScore dev should've installed anyway
Running an mtest (or all of them)
- Open QtCreator and the mscore project
- Change from project to test view
- Scan for tests: Tools → Tests → Rescan Tests
- Change the bottom output window to the "Test Results" window
- Right-click any test in the list to Run/Debug just that test, or run only selected tests or run All tests
1033 passes, 0 fails, 1 expected fails, 4 skipped.