-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cmake labels (take-over #2690) #2832
base: devel
Are you sure you want to change the base?
Conversation
This allows people running `cmake -L 'tag'` to run tests matching the tags
Signed-off-by: Cristian Le <[email protected]>
Replying to the comments in the other PR. @horenmar, when you have the time:
What is the procedure of the minimal CMake requirement? My suggestion is to support the latest distro LTS. Are there stricter packaging/usage requirements otherwise?
Not sure what is meant there.
Fair point, not sure how to improve on this. My intuition is to use |
Re CMake JSON handling: As I mentioned before, this is not needed on tags, as there won't be many of them, but for test cases this is likely to make significant difference. And for tags it should be actually easy, unlike for test cases, so it might as well be done there. Note that trying the For context, my current job has over 1k tests for the main project. Imagine reparsing the whole JSON with 1k tests 1k times. Re
Re CMake minimum version: For the helper scripts, a survey of currently supported LTS versions of common Linux distros would be a nice starting point. However I suspect that the result is that CMake <3.19 is still common, so there are two options that I see here.
I don't want to just tell people that they have to keep around the scripts from the older releases, because the newer ones won't work for them, so I think the second option is preferable. Especially since with some work, the discovery methods can be encapsulated into simple functions -> it takes the binary, arguments and then returns list of tests+tags+other relevant data. The old discovery method will use the same approximate parsing it does now, new discovery code will use JSON for perfect parsing, but the actual registration code that generates the CTest scripts can be shared. |
Yeah, I think I can clean that up a bit and make it more version dependent. I'll try to look into it a bit later in the week. If you have the time to test any of the recent changes, that will help things there.
Interesting I will look into it. From how I read the documentation, it seemed to populate as a JSON list, which would defeat the purpose there. My intuition about About why I choose LTS version minimum, it is because for the user, they should do |
Oh, I misunderstood how it works as well, and the actual answer is kinda stupid. set(INDICES "0" "0")
string(JSON tags GET "[[10, 12], 1, 2, 3]" ${INDICES})
message(STATUS ${tags})
so the list is actually nested indices/keys. That's... not great. But also it means that all that can be skipped for now. |
Actually maybe using those will speed up the script part if it means CMake does not need to copy so much string back-and-forth and it can all be handled on the |
Are there any updates on this? I made a quick CMake reporter to generate CMake-style lists and then parse that output in CMake to add the tags as CTest labels. It seems to work reasonably well and does not appear to be too slow. Is this an acceptable implementation or would you still prefer to see this JSON version work? |
Interesting, can you elaborate on how that works? I think having a CMake native format will be preferred, and the main thing we are worried here is the performance of CMake's json parsing |
For the
It is structured, effectively, as a list of lists. The first element of the outer list (in this case) is
If there are no tags for a particular test case then the tags will be empty as well. You can then just |
It looks like it could work more efficiently until CMake provides more efficient Json parsing. The only comment is about manually escaping vs |
Continuing where @uyha left off