wpt: accept test name argument

This commit is contained in:
Pierre Tachoire
2023-10-11 10:43:28 +02:00
parent 22b9b1841c
commit bf0af2c036
2 changed files with 23 additions and 1 deletions

View File

@@ -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:

View File

@@ -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.