Commit fdd9cf0928

Andrew Kelley <superjoe30@gmail.com>
2018-06-12 21:14:32
better debugging for CI failures of std.atomic
1 parent 2594132
Changed files (2)
std/atomic/queue.zig
@@ -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 {
std/atomic/stack.zig
@@ -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 {