From 006aea25b88cc5b9d39dcc970844ce7a01242532 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Wed, 3 Jan 2024 09:55:43 +0100 Subject: [PATCH] wpt: fix normal output --- Makefile | 6 +++++- src/main_wpt.zig | 20 +++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 525ef739..56dc7302 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ help: # $(ZIG) commands # ------------ -.PHONY: build build-release run run-release shell test bench download-zig +.PHONY: build build-release run run-release shell test bench download-zig wpt zig_version = $(shell grep 'recommended_zig_version = "' "vendor/jsruntime-lib/build.zig" | cut -d'"' -f2) kernel = $(shell uname -ms) @@ -80,6 +80,10 @@ wpt: @printf "\e[36mBuilding wpt...\e[0m\n" @$(ZIG) build wpt -Dengine=v8 -- --safe $(filter-out $@,$(MAKECMDGOALS)) || (printf "\e[33mBuild ERROR\e[0m\n"; exit 1;) +wpt-summary: + @printf "\e[36mBuilding wpt...\e[0m\n" + @$(ZIG) build wpt -Dengine=v8 -- --safe --summary $(filter-out $@,$(MAKECMDGOALS)) || (printf "\e[33mBuild ERROR\e[0m\n"; exit 1;) + ## Test test: @printf "\e[36mTesting...\e[0m\n" diff --git a/src/main_wpt.zig b/src/main_wpt.zig index 9cc30200..4416ba4d 100644 --- a/src/main_wpt.zig +++ b/src/main_wpt.zig @@ -288,6 +288,7 @@ fn runSafe( tests = parsed.value; } + // summary display if (out == .summary) { defer std.debug.print("\t{s}\n", .{tc}); if (result == .crash) { @@ -310,6 +311,7 @@ fn runSafe( continue; } + // json display if (out == .json) { if (result == .crash) { var cases = [_]Case{.{ @@ -330,7 +332,23 @@ fn runSafe( continue; } - std.debug.print("{s}\n", .{run.stderr}); + // normal display + std.debug.print("{s}\n", .{tc}); + if (result == .crash) { + std.debug.print("Crash\n{s}", .{run.stderr}); + continue; + } + var pass: u32 = 0; + var all: u32 = 0; + for (tests) |ttc| { + for (ttc.cases) |c| { + const status = if (c.pass) "Pass" else "Fail"; + std.debug.print("{s}\t{s}\n", .{ status, c.name }); + all += 1; + if (c.pass) pass += 1; + } + } + std.debug.print("{d}/{d}\n\n", .{ pass, all }); } if (out == .json) {