Bug 345797

Summary: ecm_add_test could use a SERIAL property
Product: [Frameworks and Libraries] extra-cmake-modules Reporter: Harald Sitter <sitter>
Component: generalAssignee: Alex Merry <alex.merry>
Status: RESOLVED FIXED    
Severity: wishlist CC: ecm-bugs-null
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Harald Sitter 2015-04-02 10:26:14 UTC
Every once in a while I run across one or multiple tests in frameworks that can not be run in parallel. Currently setting the RUN_SERIAL property on tests created via ecm_add_test is incredibly cumbersome since the property name is auto-created from the source file name and thus marking the test serial requires hardcoding the name all the same.
e.g.
> ecm_add_test(bearerpropertiestest.cpp LINK_LIBRARIES Qt5::Test)
> set_property(TEST bearerpropertiestest PROPERTY RUN_SERIAL 1)

It would be really cool if we could simply pass test properties to the ecm_add_test function and it automatically sets the test property on the target name it decides to use.
I'd imagine something like:

> ecm_add_test(foo.cpp
>      LINK_LIBRARIES Qt5::Test
>      PROPERTY RUN_SERIAL 1
>      PROPERTY PROCESSORS 2)

Reproducible: Always
Comment 1 Alex Merry 2015-05-11 13:24:46 UTC
https://git.reviewboard.kde.org/r/123722/
Comment 2 Alex Merry 2015-05-13 18:22:44 UTC
Git commit 0c224194ea7f12eaed32af746fc9138537f1919c by Alex Merry.
Committed on 13/05/2015 at 18:22.
Pushed by alexmerry into branch 'master'.

Add PROPERTIES argument to ecm_add_test and ecm_add_tests.

This is particularly useful with ecm_add_tests, where you may want to
force a suite of tests to run in serial, or alter the timeout for
multiple tests at once.
REVIEW: 123722

M  +12   -4    modules/ECMAddTests.cmake
M  +3    -0    tests/ECMAddTests/CMakeLists.txt
M  +76   -20   tests/ECMAddTests/multi_tests/CMakeLists.txt
A  +8    -0    tests/ECMAddTests/multi_tests/test10.cpp     [License: UNKNOWN]  *
A  +8    -0    tests/ECMAddTests/multi_tests/test11.cpp     [License: UNKNOWN]  *
M  +31   -8    tests/ECMAddTests/single_tests/CMakeLists.txt
A  +8    -0    tests/ECMAddTests/single_tests/test7.cpp     [License: UNKNOWN]  *

The files marked with a * at the end have a non valid license. Please read: http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page.


http://commits.kde.org/extra-cmake-modules/0c224194ea7f12eaed32af746fc9138537f1919c
Comment 3 Alex Merry 2015-05-16 13:10:25 UTC
Git commit 70b13693478b296b8a3cd1654baa8013434358c5 by Alex Merry.
Committed on 16/05/2015 at 13:09.
Pushed by alexmerry into branch 'master'.

Revert "Add PROPERTIES argument to ecm_add_test and ecm_add_tests."

This reverts commit 0c224194ea7f12eaed32af746fc9138537f1919c.

Stephen Kelly pointed out that this is probably not the best approach to
the problem, and runs counter to the direction KDE's CMake code has been
going (splitting functions up and using CMake built-ins where possible).

I have a better solution in mind, which I'll post a review for later.

CCMAIL: kde-buildsystem@kde.org

M  +4    -12   modules/ECMAddTests.cmake
M  +0    -3    tests/ECMAddTests/CMakeLists.txt
M  +20   -76   tests/ECMAddTests/multi_tests/CMakeLists.txt
D  +0    -8    tests/ECMAddTests/multi_tests/test10.cpp
D  +0    -8    tests/ECMAddTests/multi_tests/test11.cpp
M  +8    -31   tests/ECMAddTests/single_tests/CMakeLists.txt
D  +0    -8    tests/ECMAddTests/single_tests/test7.cpp

http://commits.kde.org/extra-cmake-modules/70b13693478b296b8a3cd1654baa8013434358c5
Comment 4 Alex Merry 2015-05-18 18:16:38 UTC
New RR: https://git.reviewboard.kde.org/r/123841/
Comment 5 Alex Merry 2015-05-18 19:21:40 UTC
Git commit be390dcc4d77d7faa95d040b1a346ac3c0405eac by Alex Merry.
Committed on 18/05/2015 at 19:21.
Pushed by alexmerry into branch 'master'.

Add arguments to ecm_add_tests for listing added tests.

This makes it convenient to make further modifications to the tests,
such as setting properties on either the tests or the targets.

CHANGELOG: New arguments for ecm_add_tests().
REVIEW: 123841

M  +45   -17   modules/ECMAddTests.cmake
M  +13   -0    tests/ECMAddTests/multi_tests/CMakeLists.txt
M  +28   -0    tests/test_helpers.cmake

http://commits.kde.org/extra-cmake-modules/be390dcc4d77d7faa95d040b1a346ac3c0405eac