File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
kotlinx-coroutines-core/jvm/test/scheduling Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ package scheduling
2
+
3
+ import kotlinx.coroutines.testing.*
4
+ import org.junit.*
5
+ import org.junit.runner.*
6
+ import org.junit.runners.*
7
+
8
+ @RunWith(Parameterized ::class )
9
+ class RunBlockingLimitedDispatcherLivenessStressTest (private val yieldMask : Int ) : RunBlockingCoroutineSchedulerLivenessTestBase() {
10
+ init {
11
+ corePoolSize = 1
12
+ }
13
+
14
+ companion object {
15
+ @JvmStatic
16
+ @Parameterized.Parameters
17
+ fun data (): Array <Array <Any ?>> {
18
+ return Array (32 * stressTestMultiplierSqrt) { arrayOf(it) }
19
+ }
20
+ }
21
+
22
+ @Test
23
+ fun testLivenessOfLimitedDispatcherOnTopOfDefaultDispatcher () =
24
+ testSchedulerLiveness(dispatcher.limitedParallelism(1 ), yieldMask)
25
+
26
+ @Test
27
+ fun testLivenessOfLimitedDispatcherOnTopOfIoDispatcher () = testSchedulerLiveness(
28
+ // Important: inner limitedDispatcher will be on top of this LimitedDispatcher, so there are two Workers from
29
+ // two different LimitedDispatchers that must coordinate their permits, not just one.
30
+ // In other words, LimitedDispatcher's Worker should also respect BlockingDispatchAware on its inner tasks
31
+ blockingDispatcher.value.limitedParallelism(1 ), yieldMask
32
+ )
33
+ }
You can’t perform that action at this time.
0 commit comments