[feat] Add command line option to set the execution order of independent tests #2575
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a new command line option,
--exec-order, that will impose an order of execution on the independent tests. This is particularly useful when you want to randomise the order of tests that have been generated with either the--repeator the--distributeoption.Although, currently, the order of execution is implementation defined and we could simply shuffle the tests, I decided that it's better introducing a new option for a couple of reasons:
--listand--runhappen after the test processing and after the test DAG is built, shuffling the tests, implies that the listing would also be shuffled, which is not very helpful for two reasons: (a) it's not easy to find a test in a listing (b) break the current expectation that the listing order follows the (serial) execution order.Implementation details
Currently, all the DAG manipulation routines and the topological sorting respect the order of the test cases that are passed as input to them, which means that simply ordering or shuffling the test cases beforehand is enough. However, there is the subtle case we need to exclude some test cases due to unresolved dependencies. We were doing that by subtracting two sets, which randomised the test cases in a new way. By replacing these sets with ordered sets, the problem is solved.
Fixes #2548.