mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
webui: fixup build errors in fuzz / time_report
This commit is contained in:
parent
4c01275664
commit
cc6d9fdbf4
@ -101,22 +101,22 @@ const SourceLocationIndex = enum(u32) {
|
|||||||
|
|
||||||
fn sourceLocationLinkHtml(
|
fn sourceLocationLinkHtml(
|
||||||
sli: SourceLocationIndex,
|
sli: SourceLocationIndex,
|
||||||
out: *std.ArrayListUnmanaged(u8),
|
out: *std.ArrayList(u8),
|
||||||
focused: bool,
|
focused: bool,
|
||||||
) Allocator.Error!void {
|
) error{OutOfMemory}!void {
|
||||||
const sl = sli.ptr();
|
const sl = sli.ptr();
|
||||||
try out.writer(gpa).print("<code{s}>", .{
|
try out.print(gpa, "<code{s}>", .{
|
||||||
@as([]const u8, if (focused) " class=\"status-running\"" else ""),
|
@as([]const u8, if (focused) " class=\"status-running\"" else ""),
|
||||||
});
|
});
|
||||||
try sli.appendPath(out);
|
try sli.appendPath(out);
|
||||||
try out.writer(gpa).print(":{d}:{d} </code><button class=\"linkish\" onclick=\"wasm_exports.fuzzSelectSli({d});\">View</button>", .{
|
try out.print(gpa, ":{d}:{d} </code><button class=\"linkish\" onclick=\"wasm_exports.fuzzSelectSli({d});\">View</button>", .{
|
||||||
sl.line,
|
sl.line,
|
||||||
sl.column,
|
sl.column,
|
||||||
@intFromEnum(sli),
|
@intFromEnum(sli),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn appendPath(sli: SourceLocationIndex, out: *std.ArrayListUnmanaged(u8)) Allocator.Error!void {
|
fn appendPath(sli: SourceLocationIndex, out: *std.ArrayList(u8)) error{OutOfMemory}!void {
|
||||||
const sl = sli.ptr();
|
const sl = sli.ptr();
|
||||||
const file = coverage.fileAt(sl.file);
|
const file = coverage.fileAt(sl.file);
|
||||||
const file_name = coverage.stringAt(file.basename);
|
const file_name = coverage.stringAt(file.basename);
|
||||||
@ -294,7 +294,7 @@ fn updateStats() error{OutOfMemory}!void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn updateEntryPoints() error{OutOfMemory}!void {
|
fn updateEntryPoints() error{OutOfMemory}!void {
|
||||||
var html: std.ArrayListUnmanaged(u8) = .empty;
|
var html: std.ArrayList(u8) = .empty;
|
||||||
defer html.deinit(gpa);
|
defer html.deinit(gpa);
|
||||||
for (entry_points.items) |sli| {
|
for (entry_points.items) |sli| {
|
||||||
try html.appendSlice(gpa, "<li>");
|
try html.appendSlice(gpa, "<li>");
|
||||||
|
|||||||
@ -44,7 +44,7 @@ pub fn genericResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {
|
|||||||
js.updateGeneric(msg.step_idx, inner_html.ptr, inner_html.len);
|
js.updateGeneric(msg.step_idx, inner_html.ptr, inner_html.len);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {
|
pub fn compileResultMessage(msg_bytes: []u8) error{ OutOfMemory, WriteFailed }!void {
|
||||||
const max_table_rows = 500;
|
const max_table_rows = 500;
|
||||||
|
|
||||||
if (msg_bytes.len < @sizeOf(abi.CompileResult)) @panic("malformed CompileResult message");
|
if (msg_bytes.len < @sizeOf(abi.CompileResult)) @panic("malformed CompileResult message");
|
||||||
@ -166,10 +166,11 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {
|
|||||||
});
|
});
|
||||||
defer gpa.free(inner_html);
|
defer gpa.free(inner_html);
|
||||||
|
|
||||||
var file_table_html: std.ArrayListUnmanaged(u8) = .empty;
|
var file_table_html: std.Io.Writer.Allocating = .init(gpa);
|
||||||
defer file_table_html.deinit(gpa);
|
defer file_table_html.deinit();
|
||||||
|
|
||||||
for (slowest_files[0..@min(max_table_rows, slowest_files.len)]) |file| {
|
for (slowest_files[0..@min(max_table_rows, slowest_files.len)]) |file| {
|
||||||
try file_table_html.writer(gpa).print(
|
try file_table_html.writer.print(
|
||||||
\\<tr>
|
\\<tr>
|
||||||
\\ <th scope="row"><code>{f}</code></th>
|
\\ <th scope="row"><code>{f}</code></th>
|
||||||
\\ <td>{D}</td>
|
\\ <td>{D}</td>
|
||||||
@ -187,17 +188,17 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (slowest_files.len > max_table_rows) {
|
if (slowest_files.len > max_table_rows) {
|
||||||
try file_table_html.writer(gpa).print(
|
try file_table_html.writer.print(
|
||||||
\\<tr><td colspan="4">{d} more rows omitted</td></tr>
|
\\<tr><td colspan="4">{d} more rows omitted</td></tr>
|
||||||
\\
|
\\
|
||||||
, .{slowest_files.len - max_table_rows});
|
, .{slowest_files.len - max_table_rows});
|
||||||
}
|
}
|
||||||
|
|
||||||
var decl_table_html: std.ArrayListUnmanaged(u8) = .empty;
|
var decl_table_html: std.Io.Writer.Allocating = .init(gpa);
|
||||||
defer decl_table_html.deinit(gpa);
|
defer decl_table_html.deinit();
|
||||||
|
|
||||||
for (slowest_decls[0..@min(max_table_rows, slowest_decls.len)]) |decl| {
|
for (slowest_decls[0..@min(max_table_rows, slowest_decls.len)]) |decl| {
|
||||||
try decl_table_html.writer(gpa).print(
|
try decl_table_html.writer.print(
|
||||||
\\<tr>
|
\\<tr>
|
||||||
\\ <th scope="row"><code>{f}</code></th>
|
\\ <th scope="row"><code>{f}</code></th>
|
||||||
\\ <th scope="row"><code>{f}</code></th>
|
\\ <th scope="row"><code>{f}</code></th>
|
||||||
@ -219,7 +220,7 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (slowest_decls.len > max_table_rows) {
|
if (slowest_decls.len > max_table_rows) {
|
||||||
try decl_table_html.writer(gpa).print(
|
try decl_table_html.writer.print(
|
||||||
\\<tr><td colspan="6">{d} more rows omitted</td></tr>
|
\\<tr><td colspan="6">{d} more rows omitted</td></tr>
|
||||||
\\
|
\\
|
||||||
, .{slowest_decls.len - max_table_rows});
|
, .{slowest_decls.len - max_table_rows});
|
||||||
@ -229,10 +230,10 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {
|
|||||||
hdr.step_idx,
|
hdr.step_idx,
|
||||||
inner_html.ptr,
|
inner_html.ptr,
|
||||||
inner_html.len,
|
inner_html.len,
|
||||||
file_table_html.items.ptr,
|
file_table_html.written().ptr,
|
||||||
file_table_html.items.len,
|
file_table_html.written().len,
|
||||||
decl_table_html.items.ptr,
|
decl_table_html.written().ptr,
|
||||||
decl_table_html.items.len,
|
decl_table_html.written().len,
|
||||||
hdr.flags.use_llvm,
|
hdr.flags.use_llvm,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user