authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-08-18 19:40:08-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-08-19 16:45:16-07:00
loga85f41ec2c38eff7e64ba32c76c5a60b48274a8a
tree402b34d085835205fa9ff6fbef1b5360646ff91b
parent10b95d89f878c8ba780f573d65604ef79d6cbd9a

test-stack-traces: relax parsing rules

* accept forward and backward slashes in file paths * strip multiple extensions; e.g. if the basename is "test.exe.obj" then it strips to "test".

1 files changed, 4 insertions(+), 4 deletions(-)

test/tests.zig+4-4
...@@ -923,7 +923,7 @@ pub const StackTracesContext = struct {...@@ -923,7 +923,7 @@ pub const StackTracesContext = struct {
923 pos = marks[i] + delim.len;923 pos = marks[i] + delim.len;
924 }924 }
925 // locate source basename925 // locate source basename
926 pos = mem.lastIndexOfScalar(u8, line[0..marks[0]], fs.path.sep) orelse {926 pos = mem.lastIndexOfAny(u8, line[0..marks[0]], "\\/") orelse {
927 // unexpected pattern: emit raw line and cont927 // unexpected pattern: emit raw line and cont
928 try buf.appendSlice(line);928 try buf.appendSlice(line);
929 try buf.appendSlice("\n");929 try buf.appendSlice("\n");
...@@ -935,9 +935,9 @@ pub const StackTracesContext = struct {...@@ -935,9 +935,9 @@ pub const StackTracesContext = struct {
935 try buf.appendSlice(line[pos + 1 .. marks[2] + delims[2].len]);935 try buf.appendSlice(line[pos + 1 .. marks[2] + delims[2].len]);
936 try buf.appendSlice(" [address]");936 try buf.appendSlice(" [address]");
937 if (self.mode == .Debug) {937 if (self.mode == .Debug) {
938 if (mem.lastIndexOfScalar(u8, line[marks[4]..marks[5]], '.')) |idot| {938 // On certain platforms (windows) or possibly depending on how we choose to link main
939 // On certain platforms (windows) or possibly depending on how we choose to link main939 // the object file extension may be present so we simply strip any extension.
940 // the object file extension may be present so we simply strip any extension.940 if (mem.indexOfScalar(u8, line[marks[4]..marks[5]], '.')) |idot| {
941 try buf.appendSlice(line[marks[3] .. marks[4] + idot]);941 try buf.appendSlice(line[marks[3] .. marks[4] + idot]);
942 try buf.appendSlice(line[marks[5]..]);942 try buf.appendSlice(line[marks[5]..]);
943 } else {943 } else {