Skip to content

Commit

Permalink
add test case for parsing panic output
Browse files Browse the repository at this point in the history
  • Loading branch information
ianic committed Sep 19, 2023
1 parent 41945df commit 8d9eff3
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/test/suite/testdata/panic.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Running: zig test --test-filter "connects and waits" src/tcp_echo_test.zig

1/1 test.connects and waits... thread 814883 panic: reached unreachable code
/usr/local/zig/zig-linux-aarch64-0.11.0-dev.3886+0c1bfe271/lib/std/debug.zig:258:14: 0x21cb63 in assert (test)
if (!ok) unreachable; // assertion failure
^
/home/ianic/zig/io_uring/loop/src/tcp.zig:290:15: 0x2232a3 in shutdown (test)
assert(self.completion.args == .send);
^
/home/ianic/zig/io_uring/loop/src/tcp.zig:201:29: 0x22086f in shutdown (test)
self.writer.shutdown();
^
/home/ianic/zig/io_uring/loop/src/tcp_echo_test.zig:390:32: 0x2204bb in test.connects and waits (test)
server.conn.stream.shutdown();
^
/usr/local/zig/zig-linux-aarch64-0.11.0-dev.3886+0c1bfe271/lib/test_runner.zig:175:28: 0x24532b in mainTerminal (test)
} else test_fn.func();
^
/usr/local/zig/zig-linux-aarch64-0.11.0-dev.3886+0c1bfe271/lib/test_runner.zig:35:28: 0x223eff in main (test)
return mainTerminal();
^
/usr/local/zig/zig-linux-aarch64-0.11.0-dev.3886+0c1bfe271/lib/std/start.zig:598:22: 0x220dd3 in posixCallMainAndExit (test)
root.main();
^
/usr/local/zig/zig-linux-aarch64-0.11.0-dev.3886+0c1bfe271/lib/std/start.zig:367:5: 0x220987 in _start (test)
@call(.never_inline, posixCallMainAndExit, .{});
^
error: the following test command crashed:
/home/ianic/zig/io_uring/loop/zig-cache/o/6452d5d36c12d85ca07bd5bc9c15289a/test


30 changes: 30 additions & 0 deletions src/test/suite/testdata/panic.txt_expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[
{
"file": "/home/ianic/zig/io_uring/loop/src/tcp_echo_test.zig",
"line": 389,
"column": 31,
"message": "panic: reached unreachable code",
"severity": 0
},
{
"file": "/usr/local/zig/zig-linux-aarch64-0.11.0-dev.3886+0c1bfe271/lib/std/debug.zig",
"line": 257,
"column": 13,
"message": "panic: reached unreachable code\nin assert (test)",
"severity": 0
},
{
"file": "/home/ianic/zig/io_uring/loop/src/tcp.zig",
"line": 289,
"column": 14,
"message": "panic: reached unreachable code\nin shutdown (test)",
"severity": 0
},
{
"file": "/home/ianic/zig/io_uring/loop/src/tcp.zig",
"line": 200,
"column": 28,
"message": "panic: reached unreachable code\nin shutdown (test)",
"severity": 0
}
]

0 comments on commit 8d9eff3

Please sign in to comment.