Source
pub fn rerunInFuzzMode(
run: *Run,
web_server: *std.Build.Fuzz.WebServer,
unit_test_index: u32,
prog_node: std.Progress.Node,
) !void {
const step = &run.step;
const b = step.owner;
const arena = b.allocator;
var argv_list: std.ArrayListUnmanaged([]const u8) = .empty;
for (run.argv.items) |arg| {
switch (arg) {
.bytes => |bytes| {
try argv_list.append(arena, bytes);
},
.lazy_path => |file| {
const file_path = file.lazy_path.getPath2(b, step);
try argv_list.append(arena, b.fmt("{s}{s}", .{ file.prefix, file_path }));
},
.directory_source => |file| {
const file_path = file.lazy_path.getPath2(b, step);
try argv_list.append(arena, b.fmt("{s}{s}", .{ file.prefix, file_path }));
},
.artifact => |pa| {
const artifact = pa.artifact;
const file_path = if (artifact == run.producer.?)
b.fmt("{}", .{run.rebuilt_executable.?})
else
(artifact.installed_path orelse artifact.generated_bin.?.path.?);
try argv_list.append(arena, b.fmt("{s}{s}", .{ pa.prefix, file_path }));
},
.output_file, .output_directory => unreachable,
}
}
const has_side_effects = false;
const rand_int = std.crypto.random.int(u64);
const tmp_dir_path = "tmp" ++ fs.path.sep_str ++ std.fmt.hex(rand_int);
try runCommand(run, argv_list.items, has_side_effects, tmp_dir_path, prog_node, .{
.unit_test_index = unit_test_index,
.web_server = web_server,
});
}