Skip to content

add support for dev-dependencies #338

@BurntSushi

Description

@BurntSushi

My main ask is this: I would like a way to build fuzz targets such that they bring in the dev-dependencies of the crate being tested. This issue was discussed a little bit in #256, but I wanted to try again with a more clearly defined use case.

Folks have been working on improving the fuzzers for the regex crate. One such improvement is add arbitrary::Arbitrary impls for the various Ast types in regex-syntax instead of relying on parsing a pattern out of a &[u8]. The problem that has cropped up is that this seems to require adding a proper dependency on the arbitrary crate from regex-syntax. Even if we assume I take steps to make using this optional dependency on arbitrary difficult (like gate it on cfg(fuzzing) and name the feature something weird), then I don't want to do this for a few reasons:

  1. I want regex-syntax to remain free of dependencies, even optional ones. In the past, I've seen ways for even optional dependencies to impact cargo build even if they aren't used. This tends to come up with MSRV concerns. For example, if the current version of Cargo doesn't know how to read the manifest of an optional dependency. There may be other avenues for impact. It's a little fuzzy to me. But I know one thing: if it isn't a dependency then it can't have any impact.
  2. Regardless of what I do, Arbitrary impls are likely to be found to be useful by others, and it's likely they will find a way to use them. That puts them at risk of breakage.

Now I do have some other work-arounds that avoid adding new optional dependencies, but they're pretty gross. The leading contender at the moment is probably to duplicate the Ast types in the fuzzer target, derive(Arbitrary) on them and then convert them to the regex-syntax Ast types. The Ast types don't change much, but... there are a lot of them.

Also, popping up a level, cargo fuzz is supposed to be test infrastructure, right? If so, then it seems to me that, at least semantically, it should permit bringing in dev-dependencies just like cargo test does. That is, cargo fuzz seems to me like it's a lot closer to cargo test than it is to cargo build.

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