@@ -1642,8 +1642,13 @@ fn buildSuiteRunner(io: std.Io, alloc: std.mem.Allocator) !void {
16421642 try common .ensureDir (io , BIN_DIR );
16431643 const root_mod = "-Mroot=tools/suite_runner.zig" ;
16441644 const html_mod = "-Mhtmlparser=src/root.zig" ;
1645- const config_mod = "-Mconfig=src/config.zig" ;
1646- const build_config_mod = "-Mbuild_config=src/build_config.zig" ;
1645+ const config_path = try tempConfigModule (io , alloc );
1646+ defer {
1647+ std .Io .Dir .deleteFileAbsolute (io , config_path ) catch {};
1648+ alloc .free (config_path );
1649+ }
1650+ const config_mod = try std .fmt .allocPrint (alloc , "-Mconfig={s}" , .{config_path });
1651+ defer alloc .free (config_mod );
16471652 const argv = [_ ][]const u8 {
16481653 "zig" ,
16491654 "build-exe" ,
@@ -1653,17 +1658,38 @@ fn buildSuiteRunner(io: std.Io, alloc: std.mem.Allocator) !void {
16531658 "--dep" ,
16541659 "config" ,
16551660 html_mod ,
1656- "--dep" ,
1657- "build_config" ,
16581661 config_mod ,
1659- build_config_mod ,
16601662 "-O" ,
16611663 "ReleaseFast" ,
16621664 "-femit-bin=" ++ SUITE_RUNNER_BIN ,
16631665 };
16641666 try common .runInherit (io , alloc , & argv , REPO_ROOT );
16651667}
16661668
1669+ fn tempConfigModule (io : std.Io , alloc : std.mem.Allocator ) ! []u8 {
1670+ var src : std.Random.IoSource = .{ .io = io };
1671+ const path = try std .fmt .allocPrint (alloc , "/tmp/htmlparser-config-{x}.zig" , .{src .interface ().int (u64 )});
1672+ errdefer alloc .free (path );
1673+
1674+ const file = try std .Io .Dir .createFileAbsolute (io , path , .{
1675+ .truncate = true ,
1676+ .exclusive = true ,
1677+ });
1678+ defer file .close (io );
1679+ try file .writeStreamingAll (io ,
1680+ \\pub const IntLen = enum {
1681+ \\ u16,
1682+ \\ u32,
1683+ \\ u64,
1684+ \\ usize,
1685+ \\};
1686+ \\
1687+ \\pub const intlen: IntLen = .u32;
1688+ \\
1689+ );
1690+ return path ;
1691+ }
1692+
16671693fn runSelectorCount (io : std.Io , alloc : std.mem.Allocator , mode : []const u8 , fixture : []const u8 , selector : []const u8 ) ! usize {
16681694 const argv = [_ ][]const u8 { SUITE_RUNNER_BIN , "selector-count" , mode , fixture , selector };
16691695 const out = try common .runCaptureStdout (io , alloc , & argv , REPO_ROOT );
@@ -2728,13 +2754,19 @@ fn runExamplesCheck(io: std.Io, alloc: std.mem.Allocator) !void {
27282754 }
27292755 if (example_files .len == 0 ) return error .NoExamplesFound ;
27302756
2757+ const config_path = try tempConfigModule (io , alloc );
2758+ defer {
2759+ std .Io .Dir .deleteFileAbsolute (io , config_path ) catch {};
2760+ alloc .free (config_path );
2761+ }
2762+ const config_mod = try std .fmt .allocPrint (alloc , "-Mconfig={s}" , .{config_path });
2763+ defer alloc .free (config_mod );
2764+
27312765 for (example_files ) | example_path | {
27322766 std .debug .print ("examples-check: zig test {s}\n " , .{example_path });
27332767 const root_mod = try std .fmt .allocPrint (alloc , "-Mroot={s}" , .{example_path });
27342768 defer alloc .free (root_mod );
27352769 const html_mod = "-Mhtmlparser=src/root.zig" ;
2736- const config_mod = "-Mconfig=src/config.zig" ;
2737- const build_config_mod = "-Mbuild_config=src/build_config.zig" ;
27382770 const argv = [_ ][]const u8 {
27392771 "zig" ,
27402772 "test" ,
@@ -2744,10 +2776,7 @@ fn runExamplesCheck(io: std.Io, alloc: std.mem.Allocator) !void {
27442776 "--dep" ,
27452777 "config" ,
27462778 html_mod ,
2747- "--dep" ,
2748- "build_config" ,
27492779 config_mod ,
2750- build_config_mod ,
27512780 };
27522781 try common .runInherit (io , alloc , & argv , REPO_ROOT );
27532782 }
0 commit comments