Skip to content
3 changes: 2 additions & 1 deletion ci/aarch64-linux-debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ stage3-debug/bin/zig build test docs \
-Dtarget=native-native-musl \
--search-prefix "$PREFIX" \
--zig-lib-dir "$PWD/../lib" \
-Denable-superhtml
-Denable-superhtml \
--test-timeout-ms 60_000

stage3-debug/bin/zig build \
--prefix stage4-debug \
Expand Down
3 changes: 2 additions & 1 deletion ci/aarch64-linux-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ stage3-release/bin/zig build test docs \
-Dtarget=native-native-musl \
--search-prefix "$PREFIX" \
--zig-lib-dir "$PWD/../lib" \
-Denable-superhtml
-Denable-superhtml \
--test-timeout-ms 60_000

# Ensure that stage3 and stage4 are byte-for-byte identical.
stage3-release/bin/zig build \
Expand Down
3 changes: 2 additions & 1 deletion ci/aarch64-macos-debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ stage3-debug/bin/zig build test docs \
-Denable-macos-sdk \
-Dstatic-llvm \
-Dskip-non-native \
--search-prefix "$PREFIX"
--search-prefix "$PREFIX" \
--test-timeout-ms 60_000
3 changes: 2 additions & 1 deletion ci/aarch64-macos-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ stage3-release/bin/zig build test docs \
-Denable-macos-sdk \
-Dstatic-llvm \
-Dskip-non-native \
--search-prefix "$PREFIX"
--search-prefix "$PREFIX" \
--test-timeout-ms 60_000

# Ensure that stage3 and stage4 are byte-for-byte identical.
stage3-release/bin/zig build \
Expand Down
3 changes: 2 additions & 1 deletion ci/aarch64-windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ Write-Output "Main test suite..."
--search-prefix "$PREFIX_PATH" `
-Dstatic-llvm `
-Dskip-non-native `
-Denable-symlinks-windows
-Denable-symlinks-windows `
--test-timeout-ms 60_000
CheckLastExitCode

# Ensure that stage3 and stage4 are byte-for-byte identical.
Expand Down
3 changes: 2 additions & 1 deletion ci/riscv64-linux-debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,5 @@ stage3-debug/bin/zig build test-cases test-modules test-unit test-c-abi test-sta
-Dskip-compile-errors \
-Dtarget=native-native-musl \
--search-prefix "$PREFIX" \
--zig-lib-dir "$PWD/../lib"
--zig-lib-dir "$PWD/../lib" \
--test-timeout-ms 120_000
3 changes: 2 additions & 1 deletion ci/riscv64-linux-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,5 @@ stage3-release/bin/zig build test-cases test-modules test-unit test-c-abi test-s
-Dskip-compile-errors \
-Dtarget=native-native-musl \
--search-prefix "$PREFIX" \
--zig-lib-dir "$PWD/../lib"
--zig-lib-dir "$PWD/../lib" \
--test-timeout-ms 120_000
3 changes: 2 additions & 1 deletion ci/x86_64-linux-debug-llvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ stage3-debug/bin/zig build test docs \
-Dtarget=native-native-musl \
--search-prefix "$PREFIX" \
--zig-lib-dir "$PWD/../lib" \
-Denable-superhtml
-Denable-superhtml \
--test-timeout-ms 240_000
3 changes: 2 additions & 1 deletion ci/x86_64-linux-debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ stage3-debug/bin/zig build test docs \
-Dtarget=native-native-musl \
--search-prefix "$PREFIX" \
--zig-lib-dir "$PWD/../lib" \
-Denable-superhtml
-Denable-superhtml \
--test-timeout-ms 240_000
3 changes: 2 additions & 1 deletion ci/x86_64-linux-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ stage3-release/bin/zig build test docs \
-Dtarget=native-native-musl \
--search-prefix "$PREFIX" \
--zig-lib-dir "$PWD/../lib" \
-Denable-superhtml
-Denable-superhtml \
--test-timeout-ms 240_000

# Ensure that stage3 and stage4 are byte-for-byte identical.
stage3-release/bin/zig build \
Expand Down
3 changes: 2 additions & 1 deletion ci/x86_64-windows-debug.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ Write-Output "Main test suite..."
-Dstatic-llvm `
-Dskip-non-native `
-Dskip-release `
-Denable-symlinks-windows
-Denable-symlinks-windows `
--test-timeout-ms 240_000
CheckLastExitCode

Write-Output "Build x86_64-windows-msvc behavior tests using the C backend..."
Expand Down
3 changes: 2 additions & 1 deletion ci/x86_64-windows-release.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ Write-Output "Main test suite..."
--search-prefix "$PREFIX_PATH" `
-Dstatic-llvm `
-Dskip-non-native `
-Denable-symlinks-windows
-Denable-symlinks-windows `
--test-timeout-ms 240_000
CheckLastExitCode

# Ensure that stage3 and stage4 are byte-for-byte identical.
Expand Down
13 changes: 13 additions & 0 deletions lib/build-web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,19 @@
<div><slot name="llvm-pass-timings"></slot></div>
</details>
</div>
<div id="runTestReport">
<table class="time-stats">
<thead>
<tr>
<th scope="col">Test Name</th>
<th scope="col">Duration</th>
</tr>
</thead>
<!-- HTML does not allow placing a 'slot' inside of a 'tbody' for backwards-compatibility
reasons, so we unfortunately must template on the `id` here. -->
<tbody id="runTestTableBody"></tbody>
</div>
</div>
</details>
</template>

Expand Down
22 changes: 21 additions & 1 deletion lib/build-web/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ WebAssembly.instantiateStreaming(wasm_promise, {
updateCoverage: fuzzUpdateCoverage,
},
time_report: {
updateCompile: timeReportUpdateCompile,
updateGeneric: timeReportUpdateGeneric,
updateCompile: timeReportUpdateCompile,
updateRunTest: timeReportUpdateRunTest,
},
}).then(function(obj) {
setConnectionStatus("Connecting to WebSocket...", true);
Expand Down Expand Up @@ -248,6 +249,7 @@ function timeReportUpdateCompile(

shadow.getElementById("genericReport").classList.add("hidden");
shadow.getElementById("compileReport").classList.remove("hidden");
shadow.getElementById("runTestReport").classList.add("hidden");

if (!use_llvm) shadow.querySelector(":host > details").classList.add("no-llvm");
host.innerHTML = inner_html;
Expand All @@ -265,8 +267,26 @@ function timeReportUpdateGeneric(
shadow.querySelector(":host > details").classList.remove("pending", "no-llvm");
shadow.getElementById("genericReport").classList.remove("hidden");
shadow.getElementById("compileReport").classList.add("hidden");
shadow.getElementById("runTestReport").classList.add("hidden");
host.innerHTML = inner_html;
}
function timeReportUpdateRunTest(
step_idx,
table_html_ptr,
table_html_len,
) {
const table_html = decodeString(table_html_ptr, table_html_len);
const host = domTimeReportList.children.item(step_idx);
const shadow = host.shadowRoot;

shadow.querySelector(":host > details").classList.remove("pending", "no-llvm");

shadow.getElementById("genericReport").classList.add("hidden");
shadow.getElementById("compileReport").classList.add("hidden");
shadow.getElementById("runTestReport").classList.remove("hidden");

shadow.getElementById("runTestTableBody").innerHTML = table_html;
}

const fuzz_entry_template = document.getElementById("fuzzEntryTemplate").content;
const domFuzz = document.getElementById("fuzz");
Expand Down
1 change: 1 addition & 0 deletions lib/build-web/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export fn message_end() void {

.time_report_generic_result => return time_report.genericResultMessage(msg_bytes) catch @panic("OOM"),
.time_report_compile_result => return time_report.compileResultMessage(msg_bytes) catch @panic("OOM"),
.time_report_run_test_result => return time_report.runTestResultMessage(msg_bytes) catch @panic("OOM"),
}
}

Expand Down
41 changes: 41 additions & 0 deletions lib/build-web/time_report.zig
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ const js = struct {
/// Whether the LLVM backend was used. If not, LLVM-specific statistics are hidden.
use_llvm: bool,
) void;
extern "time_report" fn updateRunTest(
/// The index of the step.
step_idx: u32,
// The HTML which will populate the <tbody> of the test table.
table_html_ptr: [*]const u8,
table_html_len: usize,
) void;
};

pub fn genericResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {
Expand Down Expand Up @@ -237,3 +244,37 @@ pub fn compileResultMessage(msg_bytes: []u8) error{ OutOfMemory, WriteFailed }!v
hdr.flags.use_llvm,
);
}

pub fn runTestResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {
if (msg_bytes.len < @sizeOf(abi.RunTestResult)) @panic("malformed RunTestResult message");
const hdr: *const abi.RunTestResult = @ptrCast(msg_bytes[0..@sizeOf(abi.RunTestResult)]);
if (hdr.step_idx >= step_list.*.len) @panic("malformed RunTestResult message");
const trailing = msg_bytes[@sizeOf(abi.RunTestResult)..];

const durations: []align(1) const u64 = @ptrCast(trailing[0 .. hdr.tests_len * 8]);
var offset: usize = hdr.tests_len * 8;

var table_html: std.ArrayListUnmanaged(u8) = .empty;
defer table_html.deinit(gpa);

for (durations) |test_ns| {
const test_name_len = std.mem.indexOfScalar(u8, trailing[offset..], 0) orelse @panic("malformed RunTestResult message");
const test_name = trailing[offset..][0..test_name_len];
offset += test_name_len + 1;
try table_html.print(gpa, "<tr><th scope=\"row\"><code>{f}</code></th>", .{fmtEscapeHtml(test_name)});
if (test_ns == std.math.maxInt(u64)) {
try table_html.appendSlice(gpa, "<td class=\"empty-cell\"></td>"); // didn't run
} else {
try table_html.print(gpa, "<td>{D}</td>", .{test_ns});
}
try table_html.appendSlice(gpa, "</tr>\n");
}

if (offset != trailing.len) @panic("malformed RunTestResult message");

js.updateRunTest(
hdr.step_idx,
table_html.items.ptr,
table_html.items.len,
);
}
Loading
Loading