Skip to content

Commit

Permalink
better debugging for CI failures of std.atomic
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewrk committed Jun 12, 2018
1 parent 2594132 commit fdd9cf0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
14 changes: 12 additions & 2 deletions std/atomic/queue.zig
Expand Up @@ -94,8 +94,18 @@ test "std.atomic.queue" {
for (getters) |t|
t.wait();

std.debug.assert(context.put_sum == context.get_sum);
std.debug.assert(context.get_count == puts_per_thread * put_thread_count);
if (context.put_sum != context.get_sum) {
std.debug.panic("failure\nput_sum:{} != get_sum:{}", context.put_sum, context.get_sum);
}

if (context.get_count != puts_per_thread * put_thread_count) {
std.debug.panic(
"failure\nget_count:{} != puts_per_thread:{} * put_thread_count:{}",
context.get_count,
u32(puts_per_thread),
u32(put_thread_count),
);
}
}

fn startPuts(ctx: *Context) u8 {
Expand Down
14 changes: 12 additions & 2 deletions std/atomic/stack.zig
Expand Up @@ -97,8 +97,18 @@ test "std.atomic.stack" {
for (getters) |t|
t.wait();

std.debug.assert(context.put_sum == context.get_sum);
std.debug.assert(context.get_count == puts_per_thread * put_thread_count);
if (context.put_sum != context.get_sum) {
std.debug.panic("failure\nput_sum:{} != get_sum:{}", context.put_sum, context.get_sum);
}

if (context.get_count != puts_per_thread * put_thread_count) {
std.debug.panic(
"failure\nget_count:{} != puts_per_thread:{} * put_thread_count:{}",
context.get_count,
u32(puts_per_thread),
u32(put_thread_count),
);
}
}

fn startPuts(ctx: *Context) u8 {
Expand Down

0 comments on commit fdd9cf0

Please sign in to comment.