Skip to content

Adjust pass/fail criteria in dispatch_concur #83

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
Jun 16, 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
38 changes: 32 additions & 6 deletions tests/dispatch_concur.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

static volatile size_t done, concur;
static int use_group_async;
static uint32_t activecpu;
static int32_t xfail = 0;

static dispatch_queue_t q;
static dispatch_group_t g, gw;
Expand Down Expand Up @@ -92,15 +94,28 @@ test_concur_async(size_t n, size_t qw)

dispatch_group_wait(g, DISPATCH_TIME_FOREVER);

test_long("concurrently completed workers", done,
MIN(n * workers, qw >= n ? qw - n : 0));
if (qw > 1) {
size_t concurrency = MIN(n * workers, qw);
if (concurrency > done && done >= activecpu) {
xfail++;
} else {
test_long("concurrently completed workers", done, concurrency);
}
} else {
test_long_less_than_or_equal("concurrently completed workers", done, 1);
}

for (i = 0, mc = mcs; i < n; i++, mc++) {
if (*mc > max_concur) max_concur = *mc;
}
free(mcs);

test_long("max submission concurrency", max_concur, MIN(n, qw));
size_t expect = MIN(n, qw);
if (expect > max_concur && max_concur >= activecpu) {
xfail++;
} else {
test_long("max submission concurrency", max_concur, expect);
}

dispatch_group_wait(gw, DISPATCH_TIME_FOREVER);
usleep(1000);
Expand Down Expand Up @@ -138,7 +153,12 @@ test_concur_sync(size_t n, size_t qw)
}
free(mcs);

test_long("max sync concurrency", max_concur, qw == 1 ? 1 : n);
size_t expect = qw == 1 ? 1 : n;
if (expect > max_concur && max_concur >= activecpu) {
xfail++;
} else {
test_long("max sync concurrency", max_concur, expect);
}
}

static void
Expand All @@ -164,7 +184,12 @@ test_concur_apply(size_t n, size_t qw)
}
free(mcs);

test_long("max apply concurrency", max_concur, MIN(n, qw));
size_t expect = MIN(n, qw);
if (expect > max_concur && max_concur >= activecpu) {
xfail++;
} else {
test_long("max apply concurrency", max_concur, expect);
}
}

static dispatch_queue_t
Expand Down Expand Up @@ -201,7 +226,6 @@ main(int argc __attribute__((unused)), char* argv[] __attribute__((unused)))
{
dispatch_test_start("Dispatch Private Concurrent/Wide Queue"); // <rdar://problem/8049506&8169448&8186485>

uint32_t activecpu;
#ifdef __linux__
activecpu = sysconf(_SC_NPROCESSORS_ONLN);
#else
Expand Down Expand Up @@ -250,6 +274,8 @@ 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