mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-28 14:43:28 +00:00
wpt: accept test name argument
This commit is contained in:
2
Makefile
2
Makefile
@@ -49,7 +49,7 @@ shell:
|
||||
## Run WPT tests
|
||||
wpt:
|
||||
@printf "\e[36mBuilding wpt...\e[0m\n"
|
||||
@$(ZIG) build wpt -Dengine=v8 || (printf "\e[33mBuild ERROR\e[0m\n"; exit 1;)
|
||||
@$(ZIG) build wpt -Dengine=v8 -- $(filter-out $@,$(MAKECMDGOALS)) || (printf "\e[33mBuild ERROR\e[0m\n"; exit 1;)
|
||||
|
||||
## Test
|
||||
test:
|
||||
|
||||
@@ -70,6 +70,11 @@ pub fn main() !void {
|
||||
defer _ = gpa.deinit();
|
||||
const alloc = gpa.allocator();
|
||||
|
||||
const args = try std.process.argsAlloc(alloc);
|
||||
defer std.process.argsFree(alloc, args);
|
||||
|
||||
const filter = args[1..];
|
||||
|
||||
// initialize VM JS lib.
|
||||
const vm = jsruntime.VM.init();
|
||||
defer vm.deinit();
|
||||
@@ -91,6 +96,23 @@ pub fn main() !void {
|
||||
var run: usize = 0;
|
||||
var failures: usize = 0;
|
||||
for (list.items) |tc| {
|
||||
if (filter.len > 0) {
|
||||
var match = false;
|
||||
for (filter) |f| {
|
||||
if (std.mem.startsWith(u8, tc, f)) {
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
if (std.mem.endsWith(u8, tc, f)) {
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!match) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
run += 1;
|
||||
|
||||
// create an arena and deinit it for each test case.
|
||||
|
||||
Reference in New Issue
Block a user