-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[test] Split TestFoundation in smaller tests for CTest reporting. #2521
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
[test] Split TestFoundation in smaller tests for CTest reporting. #2521
Conversation
Will this work correctly for the tests wrapped in |
@spevans: the test names are listed by XCTest, so they will be part of the test suite. If the environment variable is not set, though, the test body is just an empty block, so they will be reported as "Passed". If the variable is set, the test body will be the normal. |
This looks good to me and would be really helpful to have. Each individual test gets passed in the same environment that the single test run does so it'll respect NS_FOUNDATION_ATTEMPT_XFAIL_TESTS. |
@swift-ci please test |
8bf7ffb
to
172d561
Compare
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is horrible. Such is CMake.
@swift-ci please test |
Interesting that the test that failed ( |
Yes, from a fast skim of the test, it seems that the test is checking if the I will rewrite those tests a little bit and send another PR. This PR might be better to merge after @compnerd merges the one about 3.15 anyway. |
@swift-ci please test |
172d561
to
9f8b102
Compare
Fixed that suffix/prefix problem. @swift-ci please test |
@swift-ci please test Linux platform |
9f8b102
to
8e03811
Compare
Rebased on top of a current master and rewritten for the changes introduced by CMake 3.15. Let's see if this works and we can merge it. @swift-ci please test Linux platform |
@drodriguez Just thought of a couple of questions re this PR:
|
|
@spevans, @millenomi: some other concern about this change. I would like to have a LGTM from someone else before going forward with this. Thanks! |
@drodriguez I think its worth merging this, my only concern would be an increased runtime of all of the tests since |
@spevans: I cannot deny the increased runtime is there (I don't see if I left it written somewhere, but I remember that in my machine it was adding around 1 extra minute in a full run). Personally, however, I consider a fair price to pay to have independent tests and more reliability. Grouping the tests by class will improve a little the time, and should avoid most of the problems, but I would rather not do it unless there's a strong opinion for it. I will try to find some time to rebase and recheck these changes, and merge then. Thanks for looking into them. |
@drodriguez Thats fine, we just need to keep an eye on it post merge so the CI folks dont complain. |
At the moment, only one test was created for CTest, which would have run all the test in TestFoundation, and would have reported the final result as the test result, but without details of which test have failed. Following the similar case of GTest and gtest_discover_tests, XCTest can be used to list all the tests in the suite, and execute them as invidual CTest. They will report as different tests in the output, and individual failures will be shown. It will be also a little bit more resilient against crashes, which will only affect one test, and not the full suite. At first I was thinking in doing the parsing in some scripting language, but in order to be platform independent, and because the parsing is easy enough, the parsing of the XCTest output is done in CMake.
8e03811
to
569e423
Compare
From 58 seconds to 167 seconds in a beefy machine. Not sure if the extra time is just all the printing, or the |
@swift-ci please test Linux platform |
1 similar comment
@swift-ci please test Linux platform |
In the CI machines: In a previous PR without this changes:
With the changes:
More or less the same timings I got in my machine. As I wrote before. We can revert easily if somebody feels it is too much time and little benefit. |
I think that this broke the Windows builds at least: https://dev.azure.com/compnerd/swift-build/_build/results?buildId=24334&view=logs&j=231dcdbf-b818-57d0-e791-37f9a41be191&t=8799e978-1854-5f0c-ec22-c3511b5c45aa |
Looks like a missing DLL from the error code. I think because the I would recommend move the |
Running with that change here: https://dev.azure.com/compnerd/swift-build/_build/results?buildId=24343&view=results ... lets see if that fixes it |
Thanks, that does fix it |
Seems that you might need to run |
At the moment, only one test was created for CTest, which would have run
all the test in TestFoundation, and would have reported the final result
as the test result, but without details of which test have failed.
Following the similar case of GTest and gtest_discover_tests, XCTest can
be used to list all the tests in the suite, and execute them as invidual
CTest. They will report as different tests in the output, and individual
failures will be shown. It will be also a little bit more resilient
against crashes, which will only affect one test, and not the full
suite.
At first I was thinking in doing the parsing in some scripting language,
but in order to be platform independent, and because the parsing is easy
enough, the parsing of the XCTest output is done in CMake.
Tested on Linux building Foundation for Linux. I will have to check if the code works on Windows. Cross-compiling and running the tests would be complicated, so I'm not sure about that scenario either. Improvements welcome.