32
32
static volatile size_t done , concur ;
33
33
static int use_group_async ;
34
34
static uint32_t activecpu ;
35
- static int32_t xfail = 0 ;
35
+ static uint32_t min_acceptable_concurrency ;
36
36
37
37
static dispatch_queue_t q ;
38
38
static dispatch_group_t g , gw ;
@@ -96,8 +96,8 @@ test_concur_async(size_t n, size_t qw)
96
96
97
97
if (qw > 1 ) {
98
98
size_t concurrency = MIN (n * workers , qw );
99
- if (concurrency > done && done >= activecpu ) {
100
- xfail ++ ;
99
+ if (done > min_acceptable_concurrency ) {
100
+ test_long_less_than_or_equal ( "concurrently completed workers" , done , concurrency ) ;
101
101
} else {
102
102
test_long ("concurrently completed workers" , done , concurrency );
103
103
}
@@ -111,8 +111,8 @@ test_concur_async(size_t n, size_t qw)
111
111
free (mcs );
112
112
113
113
size_t expect = MIN (n , qw );
114
- if (expect > max_concur && max_concur >= activecpu ) {
115
- xfail ++ ;
114
+ if (max_concur > min_acceptable_concurrency ) {
115
+ test_long_less_than_or_equal ( "max submission concurrency" , max_concur , expect ) ;
116
116
} else {
117
117
test_long ("max submission concurrency" , max_concur , expect );
118
118
}
@@ -154,8 +154,8 @@ test_concur_sync(size_t n, size_t qw)
154
154
free (mcs );
155
155
156
156
size_t expect = qw == 1 ? 1 : n ;
157
- if (expect > max_concur && max_concur >= activecpu ) {
158
- xfail ++ ;
157
+ if (max_concur > min_acceptable_concurrency ) {
158
+ test_long_less_than_or_equal ( "max sync concurrency" , max_concur , expect ) ;
159
159
} else {
160
160
test_long ("max sync concurrency" , max_concur , expect );
161
161
}
@@ -185,8 +185,8 @@ test_concur_apply(size_t n, size_t qw)
185
185
free (mcs );
186
186
187
187
size_t expect = MIN (n , qw );
188
- if (expect > max_concur && max_concur >= activecpu ) {
189
- xfail ++ ;
188
+ if (max_concur > min_acceptable_concurrency ) {
189
+ test_long_less_than_or_equal ( "max apply concurrency" , max_concur , expect ) ;
190
190
} else {
191
191
test_long ("max apply concurrency" , max_concur , expect );
192
192
}
@@ -233,6 +233,7 @@ main(int argc __attribute__((unused)), char* argv[] __attribute__((unused)))
233
233
sysctlbyname ("hw.activecpu" , & activecpu , & s , NULL , 0 );
234
234
#endif
235
235
size_t n = activecpu / 2 > 1 ? activecpu / 2 : 1 , w = activecpu * 2 ;
236
+ min_acceptable_concurrency = n ;
236
237
dispatch_queue_t tq , ttq ;
237
238
long qw , tqw , ttqw ;
238
239
const char * ql , * tql , * ttql ;
@@ -274,8 +275,6 @@ main(int argc __attribute__((unused)), char* argv[] __attribute__((unused)))
274
275
dispatch_release (ttq );
275
276
}
276
277
277
- test_long_less_than_or_equal ("6 failures for this test is acceptable" , xfail , 6 );
278
-
279
278
dispatch_release (g );
280
279
dispatch_release (gw );
281
280
0 commit comments