better debugging for CI failures of std.atomic

This commit is contained in:
Andrew Kelley 2018-06-12 15:14:32 -04:00
parent 259413251d
commit fdd9cf0928
2 changed files with 24 additions and 4 deletions

View File

@ -94,8 +94,18 @@ test "std.atomic.queue" {
for (getters) |t| for (getters) |t|
t.wait(); t.wait();
std.debug.assert(context.put_sum == context.get_sum); if (context.put_sum != context.get_sum) {
std.debug.assert(context.get_count == puts_per_thread * put_thread_count); 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 { fn startPuts(ctx: *Context) u8 {

View File

@ -97,8 +97,18 @@ test "std.atomic.stack" {
for (getters) |t| for (getters) |t|
t.wait(); t.wait();
std.debug.assert(context.put_sum == context.get_sum); if (context.put_sum != context.get_sum) {
std.debug.assert(context.get_count == puts_per_thread * put_thread_count); 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 { fn startPuts(ctx: *Context) u8 {