mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-30 15:41:48 +00:00
wpt: extract filter on its own func
This commit is contained in:
@@ -91,6 +91,10 @@ pub fn main() !void {
|
|||||||
|
|
||||||
if (safe) {
|
if (safe) {
|
||||||
for (list.items) |tc| {
|
for (list.items) |tc| {
|
||||||
|
if (!shouldRun(filter.items, tc)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO use std.ChildProcess.run after next zig upgrade.
|
// TODO use std.ChildProcess.run after next zig upgrade.
|
||||||
var child = std.ChildProcess.init(&.{ execname, tc }, alloc);
|
var child = std.ChildProcess.init(&.{ execname, tc }, alloc);
|
||||||
child.stdin_behavior = .Ignore;
|
child.stdin_behavior = .Ignore;
|
||||||
@@ -138,7 +142,7 @@ pub fn main() !void {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// std.debug.print("{s}\n", .{stderr.items});
|
std.debug.print("{s}\n", .{stderr.items});
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -163,22 +167,9 @@ pub fn main() !void {
|
|||||||
var run: usize = 0;
|
var run: usize = 0;
|
||||||
var failures: usize = 0;
|
var failures: usize = 0;
|
||||||
for (list.items) |tc| {
|
for (list.items) |tc| {
|
||||||
if (filter.items.len > 0) {
|
if (!shouldRun(filter.items, tc)) {
|
||||||
var match = false;
|
|
||||||
for (filter.items) |f| {
|
|
||||||
if (std.mem.startsWith(u8, tc, f)) {
|
|
||||||
match = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (std.mem.endsWith(u8, tc, f)) {
|
|
||||||
match = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!match) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
run += 1;
|
run += 1;
|
||||||
|
|
||||||
@@ -279,3 +270,19 @@ pub fn main() !void {
|
|||||||
std.os.exit(1);
|
std.os.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn shouldRun(filter: [][]const u8, tc: []const u8) bool {
|
||||||
|
if (filter.len == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (filter) |f| {
|
||||||
|
if (std.mem.startsWith(u8, tc, f)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (std.mem.endsWith(u8, tc, f)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user