authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-06-12 15:14:32-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-06-12 15:14:32-04:00
logfdd9cf09287b5e397ad9b2c960c833a7de075e4c
tree7d77a2af75ae4659b52a28e5ef395a84fb9d1864
parent259413251df478545948fdbc6213669f88f584bd

better debugging for CI failures of std.atomic


2 files changed, 24 insertions(+), 4 deletions(-)

std/atomic/queue.zig+12-2
...@@ -94,8 +94,18 @@ test "std.atomic.queue" {...@@ -94,8 +94,18 @@ test "std.atomic.queue" {
94 for (getters) |t|94 for (getters) |t|
95 t.wait();95 t.wait();
9696
97 std.debug.assert(context.put_sum == context.get_sum);97 if (context.put_sum != context.get_sum) {
98 std.debug.assert(context.get_count == puts_per_thread * put_thread_count);98 std.debug.panic("failure\nput_sum:{} != get_sum:{}", context.put_sum, context.get_sum);
99 }
100
101 if (context.get_count != puts_per_thread * put_thread_count) {
102 std.debug.panic(
103 "failure\nget_count:{} != puts_per_thread:{} * put_thread_count:{}",
104 context.get_count,
105 u32(puts_per_thread),
106 u32(put_thread_count),
107 );
108 }
99}109}
100110
101fn startPuts(ctx: *Context) u8 {111fn startPuts(ctx: *Context) u8 {
std/atomic/stack.zig+12-2
...@@ -97,8 +97,18 @@ test "std.atomic.stack" {...@@ -97,8 +97,18 @@ test "std.atomic.stack" {
97 for (getters) |t|97 for (getters) |t|
98 t.wait();98 t.wait();
9999
100 std.debug.assert(context.put_sum == context.get_sum);100 if (context.put_sum != context.get_sum) {
101 std.debug.assert(context.get_count == puts_per_thread * put_thread_count);101 std.debug.panic("failure\nput_sum:{} != get_sum:{}", context.put_sum, context.get_sum);
102 }
103
104 if (context.get_count != puts_per_thread * put_thread_count) {
105 std.debug.panic(
106 "failure\nget_count:{} != puts_per_thread:{} * put_thread_count:{}",
107 context.get_count,
108 u32(puts_per_thread),
109 u32(put_thread_count),
110 );
111 }
102}112}
103113
104fn startPuts(ctx: *Context) u8 {114fn startPuts(ctx: *Context) u8 {