Skip to content

relax passing conditions for dispatch_concur #117

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

Merged
merged 1 commit into from
Jul 21, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions tests/dispatch_concur.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
static volatile size_t done, concur;
static int use_group_async;
static uint32_t activecpu;
static int32_t xfail = 0;
static uint32_t min_acceptable_concurrency;

static dispatch_queue_t q;
static dispatch_group_t g, gw;
Expand Down Expand Up @@ -96,8 +96,8 @@ test_concur_async(size_t n, size_t qw)

if (qw > 1) {
size_t concurrency = MIN(n * workers, qw);
if (concurrency > done && done >= activecpu) {
xfail++;
if (done > min_acceptable_concurrency) {
test_long_less_than_or_equal("concurrently completed workers", done, concurrency);
} else {
test_long("concurrently completed workers", done, concurrency);
}
Expand All @@ -111,8 +111,8 @@ test_concur_async(size_t n, size_t qw)
free(mcs);

size_t expect = MIN(n, qw);
if (expect > max_concur && max_concur >= activecpu) {
xfail++;
if (max_concur > min_acceptable_concurrency) {
test_long_less_than_or_equal("max submission concurrency", max_concur, expect);
} else {
test_long("max submission concurrency", max_concur, expect);
}
Expand Down Expand Up @@ -154,8 +154,8 @@ test_concur_sync(size_t n, size_t qw)
free(mcs);

size_t expect = qw == 1 ? 1 : n;
if (expect > max_concur && max_concur >= activecpu) {
xfail++;
if (max_concur > min_acceptable_concurrency) {
test_long_less_than_or_equal("max sync concurrency", max_concur, expect);
} else {
test_long("max sync concurrency", max_concur, expect);
}
Expand Down Expand Up @@ -185,8 +185,8 @@ test_concur_apply(size_t n, size_t qw)
free(mcs);

size_t expect = MIN(n, qw);
if (expect > max_concur && max_concur >= activecpu) {
xfail++;
if (max_concur > min_acceptable_concurrency) {
test_long_less_than_or_equal("max apply concurrency", max_concur, expect);
} else {
test_long("max apply concurrency", max_concur, expect);
}
Expand Down Expand Up @@ -233,6 +233,7 @@ main(int argc __attribute__((unused)), char* argv[] __attribute__((unused)))
sysctlbyname("hw.activecpu", &activecpu, &s, NULL, 0);
#endif
size_t n = activecpu / 2 > 1 ? activecpu / 2 : 1, w = activecpu * 2;
min_acceptable_concurrency = n;
dispatch_queue_t tq, ttq;
long qw, tqw, ttqw;
const char *ql, *tql, *ttql;
Expand Down Expand Up @@ -274,8 +275,6 @@ main(int argc __attribute__((unused)), char* argv[] __attribute__((unused)))
dispatch_release(ttq);
}

test_long_less_than_or_equal("6 failures for this test is acceptable", xfail, 6);

dispatch_release(g);
dispatch_release(gw);

Expand Down