I'm not against this, but I am curious as to why this is being done.
I would think that packagers should be building the tests and running them on their platform and make sure everything passes. We have a strict policy that all tests must always pass.
Not sure why this is suddenly triggering many philosophical discussions about what users should be doing (IMHO, give them choice, this is opensource).
Similar changes have been done in most other frameworks long ago, this is most certainly consistent.
(see e.g. kcoreaddons - the find_package(Qt5Test) is being done in the autotests subfolder, the same could be done here).
Let me get this straight.
This patch makes the option BUILD_TESTING work, i.e. skip testing if not set.
The solution that was committed to kwin, additionally sets BUILD_TESTING to false if Qt5Test isn't available. This doesn't prevent setting the option to false manually if someone has Qt5Test but doesn't want to build the tests.
Is this an accurate description of the issue?
I would add that, IMHO, all frameworks should handle this the same way.
I had a further look and they currently don't.
kservice, kimageformats, ktexteditor... do it like this patch (manual option).
kcoreaddons, karchive... don't have the option, they just skip autotests if Qt5Test is not found.
* ki18n, kguiaddons, kdbusaddons, threadweaver compile autotests unconditionally.
I'm confused - how did anyone without Qt5Test make it all the way to kio, which depends on kdbusaddons and ki18n, then?
Unless I missed something, I would say that by default tests should be compiled if Qt5Test is present (developers) and should not be compiled if Qt5Test is absent or if it is explicitly desired not to build tests (packagers).
1) doing both steps is good (i.e. doing like kwin).
2) it should be done in all frameworks (that have autotests, which is most of them)
Anyone up to the task?
I know this is merged already but this patch is being applied to every KDE package and I want to keep the discussion in a single place. We already have a toggle option in CMake that is "BUILD_TESTING". If Gentoo wants to not build the tests (I'm not judging if they should, let them be free to do it), they can just set BUILD_TESTING to OFF. I understand that CMake will still try to find Qt5Test and fail, but here is where I think we got it wrong: This patch does the following: if (Qt5Test is not found) BUILD_TESTING = OFF What I think this patch should be doing is this: if (BUILD_TESTING == OFF) Don't look for Qt5Test Did I miss something or this seems more reasonable to you guys as well?