File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,9 @@ const TestHTTPServer = @import("TestHTTPServer.zig");
2929
3030const WPT_DIR = "tests/wpt" ;
3131
32+ // use in custom panic handler
33+ var current_test : ? []const u8 = null ;
34+
3235pub fn main () ! void {
3336 var gpa : std .heap .DebugAllocator (.{}) = .init ;
3437 defer _ = gpa .deinit ();
@@ -77,6 +80,9 @@ pub fn main() !void {
7780 while (try it .next ()) | test_file | {
7881 defer _ = test_arena .reset (.retain_capacity );
7982
83+ defer current_test = null ;
84+ current_test = test_file ;
85+
8086 var err_out : ? []const u8 = null ;
8187 const result = run (
8288 test_arena .allocator (),
@@ -448,3 +454,12 @@ fn httpHandler(req: *std.http.Server.Request) !void {
448454 const file_path = try std .fmt .bufPrint (& buf , WPT_DIR ++ "{s}" , .{path });
449455 return TestHTTPServer .sendFile (req , file_path );
450456}
457+
458+ pub const panic = std .debug .FullPanic (struct {
459+ pub fn panicFn (msg : []const u8 , first_trace_addr : ? usize ) noreturn {
460+ if (current_test ) | ct | {
461+ std .debug .print ("===panic running: {s}===\n " , .{ct });
462+ }
463+ std .debug .defaultPanic (msg , first_trace_addr );
464+ }
465+ }.panicFn );
You can’t perform that action at this time.
0 commit comments