The tests have been overhauled and are in fairly decent shape, so there wasn't as much low-hanging fruit as in some of the other test libraries, but there are still a few notable places we can make improvements and others we can cut back without losing quality of coverage.
Changes:
- Even though some care had been taken to avoid it, at least one DegreeOfParallelismTests was taking an extra ~25s on my machine waiting for the thread pool to ramp up. Fixed via the same helper used in other test libs.
- Removed ReadOnlyCollection as a source. There are special PLINQ code paths for arrays, lists, ParallelEnumerable.Range, and custom partitioners, but not for other collection types, so I've commented out that source until such time as we do have such special cases. This removes ~1/6th of the test cases and an equivalent amount of execution time.
- Improved throughput of the IntegerRangeSet helper, which is used in lots of tests and was a source of significant contention due to a lock used in the main Add method. Replacing it with a SpinLock reduced execution time by ~10%.
- Removed ParallelEnumerable.Range as an "expander" in the SelectSelectManyTests. The delegate is returning an IEnumerable, so subsequent operations performed on the expander aren't continuing the PLINQ execution and are instead starting a new one, making this essentially equivalent to (but more expensive than and duplicative of) the Enumerable.Range expander that already exists.
- Lowered outerloop default iteration count from 64K*ProcCount to 16K*ProcCount
- Lowered OrderByThenByTest outerloop iteration count from 32K to 16K, and removed the additional 1K iteration count being performed.
Commit migrated from https://github.com/dotnet/corefx/commit/2a75aefbe2cd8c951ac3cfb8ab2ea324847ae90c
Peome earlier discussion, I've cut down on the number and running time of the PLINQ tests.
The majority of the cases are still/should be covered, the reductions have generally been in sizes and source types for unordered tests. Overall, OuterLoop tests on my machine are running about 40% faster. The number of tests is down, but the combinatorial tests still represent the majority of the count.
There are also some minor fixes here and there - dealing with an instance of integer overflow in a helper method, for example. some earlier discussion, I've cut down on the number and running time of the PLINQ tests.
The majority of the cases are still/should be covered, the reductions have generally been in sizes and source types for unordered tests. Overall, OuterLoop tests on my machine are running about 40% faster. The number of tests is down, but the combinatorial tests still represent the majority of the count. There are also some minor fixes here and there - dealing with an instance of integer overflow in a helper method, for example.
Commit migrated from https://github.com/dotnet/corefx/commit/bfabc65b3123dee76406dfce6a0ce16a3b89b0c8
* Add missing pre-cancelled combinatorial tests (output options only).
* Change Pre-cancelled tests to get token from Functions.AssertAlreadyCanceled.
* Add missing `Any` existence check pre-cancellation test.
* Wrap usual query cancellation to hide complexity.
* Add base helpers and sources for in-flight cancellation.
* Add Aggregate in-flight cancellation tests.
* Add All in-flight cancellation tests.
* Add Any in-flight cancellation tests.
* Add Average in-flight cancellation tests.
* Add Contains in-flight cancellation tests.
* Add Count/LongCount in-flight cancellation tests.
* Add ElementAt/ElementAtOrDefault in-flight cancellation tests.
* Add First/FirstOrDefault in-flight cancellation tests.
* Add ForAll in-flight cancellation tests.
* Add Last/LastOrDefault in-flight cancellation tests.
* Add Max in-flight cancellation tests.
* Add Min in-flight cancellation tests.
* Add SequenceEqual in-flight cancellation tests.
* Add Single/SingleOrDefault in-flight cancellation tests.
* Add Sum in-flight cancellation tests.
* Add ToArray in-flight cancellation tests.
* Add ToDictionary in-flight cancellation tests.
* Add ToList in-flight cancellation tests.
* Add ToLookup in-flight cancellation tests.
* Add foreach in-flight cancellation tests.
* Add cancellation for inner query of binaries.
* Remove basic pre-canceled token tests from `WithCancellationTests` (handled in combinatorial testing).
* Remove in-flight cancellation tests (handled in combinatorial and elsewhere)
* Move enumerator dispose test to GetEnumeratorTests
* Add/correct multiple WithCancellation test (original called WithDegreesOfParallelism)
* Add tests with not cancelable and pre canceled cancellation tokens.
* Remove SelectMany regression test (covered by existing SelectMany tests).
* Add tests for alternate (canceled) cancellation source throwing wrapped OCE.
* Add non-canceled thrown OCE test.
* Condense dealing with disposing the enumerator.
Original tests were liable to cause deadlock due to calling Dispose in a child thread (using an ordered source in an attempt to expand the tests made it a certainty).
* Update and expand ephemeral ODE test (potentially covered in combinatorial?).
* Update test for canceled-then-disposed enumerator.
* Re-use throws wrapped.
* Tweak comment, correct element counts.
* Replace regression test comment in SelectMany tests, tweak PE.Range expander
This comment was originally for a test in WithCancellationTests, but
that test didn't call WithCancellation at all. Given the nature of the
original test, it was felt that _all_ SelectMany tests would check for
the failure; the original test was thus removed.
* Correct operation.
* Comparers sealed/readonly
* Add missing min/max func cancel combinations.
* Knock down delay time.
* Move (implicit in foreach) MoveNext cancellation test.
* Reduce counts for WithCancellation ProducerBlocked tests.
* Create new AssertThrows helper.
- Cancellation-related throws provide default source
Switch to new cancellation throws.
- GetEnumerator switched to internal methods to explicitly run over all sources.
* Split Single/SingleDefault cancellation tests.
Commit migrated from https://github.com/dotnet/corefx/commit/2d1d84d28e45d1d08179dc5ff7bbe4cacb1d5e64
This wasn't caught previously because System.Linq.Parallel.Tests is depending on the System.Linq.dll NuGet package, not the live bits. Two tests were explicitly verifying object equality. This isn't necessary; I've simply deleted the offending checks.
Commit migrated from https://github.com/dotnet/corefx/commit/a7d743c973b2eea287c5c6dcde807fe640ed491a
Update ExchangeTests
Update PlinqModesTests.
Remove file (contents covered more thoroughly by other tests).
Change Union tests to use custom Comparator similar to other set operations.
Add List to sources used for OuterLoop
Change how empty tests are handled.
Add tests for non-comparable types.
Add tests checking for duplicate compared items.
Describe behavior of common range sources
Describe Zip member data functions.
Describe Union member data functions.
Describe OrderBy member data functions
Describe Max/Min member data functions.
Commit migrated from https://github.com/dotnet/corefx/commit/1c3ecb33008d93d47b2e9a42480ebac50821b617