DoxigAlpha

rerunInFuzzMode

Function parameters

Parameters

#
run:*Run
fuzz:*std.Build.Fuzz
unit_test_index:u32
prog_node:std.Progress.Node

Type definitions in this namespace

Types

#

Functions in this namespace

Functions

#
addOutputFileArg
Provides a file path as a command line argument to the command being run.
addPrefixedOutputFileArg
Provides a file path as a command line argument to the command being run.
addFileArg
Appends an input file to the command line arguments.
addPrefixedFileArg
Appends an input file to the command line arguments prepended with a string.
addOutputDirectoryArg
Provides a directory path as a command line argument to the command being run.
addPrefixedOutputDirectoryArg
Provides a directory path as a command line argument to the command being run.
addDepFileOutputArg
Add a path argument to a dep file (.d) for the child process to write its
addPrefixedDepFileOutputArg
Add a prefixed path argument to a dep file (.d) for the child process to
expectStdErrEqual
Adds a check for exact stderr match.
expectStdOutEqual
Adds a check for exact stdout match as well as a check for exit code 0, if
addFileInput
Adds an additional input files that, when modified, indicates that this Run

= .run

Values

#
base_id
= .run

Source

Implementation

#
pub fn rerunInFuzzMode(
    run: *Run,
    fuzz: *std.Build.Fuzz,
    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.getPath3(b, step);
                try argv_list.append(arena, b.fmt("{s}{s}", .{ file.prefix, run.convertPathArg(file_path) }));
            },
            .decorated_directory => |dd| {
                const file_path = dd.lazy_path.getPath3(b, step);
                try argv_list.append(arena, b.fmt("{s}{s}{s}", .{ dd.prefix, run.convertPathArg(file_path), dd.suffix }));
            },
            .artifact => |pa| {
                const artifact = pa.artifact;
                const file_path: []const u8 = p: {
                    if (artifact == run.producer.?) break :p b.fmt("{f}", .{run.rebuilt_executable.?});
                    break :p artifact.installed_path orelse artifact.generated_bin.?.path.?;
                };
                try argv_list.append(arena, b.fmt("{s}{s}", .{
                    pa.prefix,
                    run.convertPathArg(.{ .root_dir = .cwd(), .sub_path = 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,
        .fuzz = fuzz,
    });
}