mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 23:23:28 +00:00
add missing try/catch around loop wait for wpt tests
This commit is contained in:
@@ -138,8 +138,9 @@ pub fn main() !void {
|
|||||||
var arena = std.heap.ArenaAllocator.init(alloc);
|
var arena = std.heap.ArenaAllocator.init(alloc);
|
||||||
defer arena.deinit();
|
defer arena.deinit();
|
||||||
|
|
||||||
const res = wpt.run(arena.allocator(), wpt_dir, tc, &loader) catch |err| {
|
var msg_out: ?[]const u8 = null;
|
||||||
const suite = try Suite.init(alloc, tc, false, @errorName(err));
|
const res = wpt.run(arena.allocator(), wpt_dir, tc, &loader, &msg_out) catch |err| {
|
||||||
|
const suite = try Suite.init(alloc, tc, false, if (msg_out) |msg| msg else @errorName(err));
|
||||||
try results.append(suite);
|
try results.append(suite);
|
||||||
|
|
||||||
if (out == .text) {
|
if (out == .text) {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ const polyfill = @import("../browser/polyfill/polyfill.zig");
|
|||||||
// runWPT parses the given HTML file, starts a js env and run the first script
|
// runWPT parses the given HTML file, starts a js env and run the first script
|
||||||
// tags containing javascript sources.
|
// tags containing javascript sources.
|
||||||
// It loads first the js libs files.
|
// It loads first the js libs files.
|
||||||
pub fn run(arena: Allocator, comptime dir: []const u8, f: []const u8, loader: *FileLoader) ![]const u8 {
|
pub fn run(arena: Allocator, comptime dir: []const u8, f: []const u8, loader: *FileLoader, msg_out: *?[]const u8) ![]const u8 {
|
||||||
// document
|
// document
|
||||||
const html = blk: {
|
const html = blk: {
|
||||||
const file = try std.fs.cwd().openFile(f, .{});
|
const file = try std.fs.cwd().openFile(f, .{});
|
||||||
@@ -98,7 +98,17 @@ pub fn run(arena: Allocator, comptime dir: []const u8, f: []const u8, loader: *F
|
|||||||
);
|
);
|
||||||
|
|
||||||
// wait for all async executions
|
// wait for all async executions
|
||||||
try runner.loop.run();
|
{
|
||||||
|
var try_catch: Env.TryCatch = undefined;
|
||||||
|
try_catch.init(runner.executor);
|
||||||
|
defer try_catch.deinit();
|
||||||
|
runner.loop.run() catch |err| {
|
||||||
|
if (try try_catch.err(arena)) |msg| {
|
||||||
|
msg_out.* = msg;
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Check the final test status.
|
// Check the final test status.
|
||||||
try runner.exec("report.status;");
|
try runner.exec("report.status;");
|
||||||
|
|||||||
Reference in New Issue
Block a user