update standalone and incremental tests to new API

This commit is contained in:
Andrew Kelley
2025-07-07 19:33:20 -07:00
parent c873c2eed9
commit d8e26275f2
72 changed files with 347 additions and 892 deletions

View File

@@ -91,9 +91,10 @@ pub fn main() !void {
try readExtRegistry(&exts, a, std.fs.cwd(), args[2]);
var bw = std.io.bufferedWriter(std.io.getStdOut().writer());
try render(bw.writer(), a, core_spec, exts.items);
try bw.flush();
var buffer: [4000]u8 = undefined;
var w = std.fs.File.stdout().writerStreaming(&buffer);
try render(&w, a, core_spec, exts.items);
try w.flush();
}
fn readExtRegistry(exts: *std.ArrayList(Extension), a: Allocator, dir: std.fs.Dir, sub_path: []const u8) !void {
@@ -166,7 +167,7 @@ fn tagPriorityScore(tag: []const u8) usize {
}
}
fn render(writer: anytype, a: Allocator, registry: CoreRegistry, extensions: []const Extension) !void {
fn render(writer: *std.io.Writer, a: Allocator, registry: CoreRegistry, extensions: []const Extension) !void {
try writer.writeAll(
\\//! This file is auto-generated by tools/gen_spirv_spec.zig.
\\
@@ -188,15 +189,10 @@ fn render(writer: anytype, a: Allocator, registry: CoreRegistry, extensions: []c
\\ none,
\\ _,
\\
\\ pub fn format(
\\ self: IdResult,
\\ comptime _: []const u8,
\\ _: std.fmt.FormatOptions,
\\ writer: anytype,
\\ ) @TypeOf(writer).Error!void {
\\ pub fn format(self: IdResult, writer: *std.io.Writer) std.io.Writer.Error!void {
\\ switch (self) {
\\ .none => try writer.writeAll("(none)"),
\\ else => try writer.print("%{}", .{@intFromEnum(self)}),
\\ else => try writer.print("%{d}", .{@intFromEnum(self)}),
\\ }
\\ }
\\};
@@ -899,7 +895,8 @@ fn parseHexInt(text: []const u8) !u31 {
}
fn usageAndExit(arg0: []const u8, code: u8) noreturn {
std.io.getStdErr().writer().print(
const stderr = std.debug.lockStderrWriter(&.{});
stderr.print(
\\Usage: {s} <SPIRV-Headers repository path> <path/to/zig/src/codegen/spirv/extinst.zig.grammar.json>
\\
\\Generates Zig bindings for SPIR-V specifications found in the SPIRV-Headers