Skip to content

[Feature] Allow users to pass in arguments directly to coverage tool #1

@gabe-sherman

Description

@gabe-sherman

The inspiration for this issue came out of a specific use case I needed, but I wanted to bring it to attention in case it would be helpful for others as well. In using afl-cov-fast-gcc, I wanted to supply additional arguments to the lcov commands beyond those already supplied by the script, but didn't find there was any easy way to do this.

I think it would be helpful for users to be able to directly provide additional arguments to their coverage tools in order to be able to accommodate for their specific needs. For example, this was how I implemented it for afl-cov-fast-gcc:

    parser.add_argument(
        "--extra-cov-args",
        nargs=argparse.REMAINDER,
        help="Additional arguments to pass directly to the coverage tool (e.g., --include=*/src --exclude=*/tests)",
        default=[],
    )

Then, just add these additonal arguments to the command:

 lcov_cmd = [
        args.lcov_path,
        "--no-checksum",
        "--capture",
        "--rc",
        "lcov_branch_coverage=1",
        "--directory",
        str(gcov_dir),
        "--follow",
        "--output-file",
        str(output_file),
    ]
    lcov_cmd += args.extra_cov_args

Generalizing this across all tools may be a bit challenging as the way commands are constructed differs, and many of these scripts call multiple command line tools (e.g., lcov, genhtml, etc.), but I just wanted to bring it up in case the developers see value in adding this feature!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions