mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-17 08:48:58 +00:00
wpt: summary includes pass cases number
This commit is contained in:
@@ -249,17 +249,15 @@ fn runSafe(
|
|||||||
const alloc = arena.allocator();
|
const alloc = arena.allocator();
|
||||||
|
|
||||||
const Result = enum {
|
const Result = enum {
|
||||||
pass,
|
success,
|
||||||
fail,
|
|
||||||
crash,
|
crash,
|
||||||
};
|
};
|
||||||
|
|
||||||
var argv = try std.ArrayList([]const u8).initCapacity(alloc, 3);
|
var argv = try std.ArrayList([]const u8).initCapacity(alloc, 3);
|
||||||
defer argv.deinit();
|
defer argv.deinit();
|
||||||
argv.appendAssumeCapacity(execname);
|
argv.appendAssumeCapacity(execname);
|
||||||
if (out == .json) {
|
// always require json output to count test cases results
|
||||||
argv.appendAssumeCapacity("--json");
|
argv.appendAssumeCapacity("--json");
|
||||||
}
|
|
||||||
|
|
||||||
var output = std.ArrayList(Test).init(alloc);
|
var output = std.ArrayList(Test).init(alloc);
|
||||||
|
|
||||||
@@ -275,29 +273,40 @@ fn runSafe(
|
|||||||
const run = try std.ChildProcess.run(.{
|
const run = try std.ChildProcess.run(.{
|
||||||
.allocator = alloc,
|
.allocator = alloc,
|
||||||
.argv = argv.items,
|
.argv = argv.items,
|
||||||
|
.max_output_bytes = 1024 * 1024,
|
||||||
});
|
});
|
||||||
|
|
||||||
var result: Result = undefined;
|
const result: Result = switch (run.term) {
|
||||||
switch (run.term) {
|
.Exited => .success,
|
||||||
.Exited => |v| {
|
else => .crash,
|
||||||
if (v == 0) {
|
};
|
||||||
result = .pass;
|
|
||||||
} else {
|
// read the JSON result from stdout
|
||||||
result = .fail;
|
var tests: []Test = undefined;
|
||||||
}
|
if (result != .crash) {
|
||||||
},
|
const parsed = try std.json.parseFromSlice([]Test, alloc, run.stdout, .{});
|
||||||
.Signal => result = .crash,
|
tests = parsed.value;
|
||||||
.Stopped => result = .crash,
|
|
||||||
.Unknown => result = .crash,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (out == .summary) {
|
if (out == .summary) {
|
||||||
switch (result) {
|
defer std.debug.print("\t{s}\n", .{tc});
|
||||||
.pass => std.debug.print("Pass", .{}),
|
if (result == .crash) {
|
||||||
.fail => std.debug.print("Fail", .{}),
|
std.debug.print("Crash\t", .{});
|
||||||
.crash => std.debug.print("Crash", .{}),
|
continue;
|
||||||
}
|
}
|
||||||
std.debug.print("\t{s}\n", .{tc});
|
|
||||||
|
// count results
|
||||||
|
var pass: u32 = 0;
|
||||||
|
var all: u32 = 0;
|
||||||
|
for (tests) |ttc| {
|
||||||
|
for (ttc.cases) |c| {
|
||||||
|
all += 1;
|
||||||
|
if (c.pass) pass += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const status = if (pass == all) "Pass" else "Fail";
|
||||||
|
std.debug.print("{s} {d}/{d}", .{ status, pass, all });
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,8 +326,7 @@ fn runSafe(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const jp = try std.json.parseFromSlice([]Test, alloc, run.stdout, .{});
|
try output.appendSlice(tests);
|
||||||
try output.appendSlice(jp.value);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user