Fix running isolated tests on a clean build
ClosedPublic

Authored by nalvarez on Aug 13 2016, 4:50 AM.

Details

Summary

The add_akonadi_isolated_test CMake macro was searching for akonaditest using find_program. This is the right thing to do when the macro is called by a separate project that uses akonadi, since then it is already in the system as a required dependency.

However, this will not work when building akonadi itself for the first time, where akonadi is not installed in the system yet. akonaditest will not be found, since it will be built and installed by this same project, and that's at make time, long after this macro runs.

This patch checks if we're building akonadi itself, and if so, it sets the test runner as just "akonaditest". When using the add_test(NAME foo COMMAND akonaditest) syntax, CMake will detect that it's a target name and replace it with the location of the executable that will be built.

Test Plan

I only tried building and testing Akonadi itself, in a very clean environment. It's still necessary to test if I didn't break building (and running tests in) other projects that depend on Akonadi, and if the warning is printed properly if akonaditest is missing.

Diff Detail

Repository
R165 Akonadi
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
nalvarez updated this revision to Diff 5886.Aug 13 2016, 4:50 AM
nalvarez retitled this revision from to Fix running isolated tests on a clean build.
nalvarez updated this object.
nalvarez edited the test plan for this revision. (Show Details)
nalvarez set the repository for this revision to R165 Akonadi .
nalvarez added a project: KDE PIM.
Restricted Application added a subscriber: kde-pim. · View Herald TranscriptAug 13 2016, 4:50 AM
dvratil accepted this revision.Aug 13 2016, 8:21 PM
dvratil added a reviewer: dvratil.
dvratil added a subscriber: dvratil.

Looks good to me, thanks for the patch!

This revision is now accepted and ready to land.Aug 13 2016, 8:21 PM
This revision was automatically updated to reflect the committed changes.