-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for dev-dependencies #338
Comments
So the problem here is less a desire to do this, but rather that there is no way to do this cleanly. Cargo does not offer much control over its internals. The custom test frameworks eRFC was in part intended to help projects like The workaround I suggest is either:
If the examples route can be made to work pleasantly I'm open to adding support for creating and running fuzz targets that way to I'm closing this because we have no clear long- or short-term route to making this work, not because we don't want this. I consider "abuse If such a route appears in the future I'm happy to reopen this, and I do not mind this issue being used to track any progress/discussion on that route. |
@Manishearth Thanks for the response! I was worried that this might be the case. That is, that this is less of a "we don't want this" and more of a "not feasible to support." Bummer. OK. I'll check out the The example-abuse-hack seems neat, but I do definitely like the idea of custom test frameworks being the better option long term. |
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 addarbitrary::Arbitrary
impls for the variousAst
types inregex-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 thearbitrary
crate fromregex-syntax
. Even if we assume I take steps to make using this optional dependency onarbitrary
difficult (like gate it oncfg(fuzzing)
and name the feature something weird), then I don't want to do this for a few reasons:regex-syntax
to remain free of dependencies, even optional ones. In the past, I've seen ways for even optional dependencies to impactcargo 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.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 theregex-syntax
Ast
types. TheAst
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 indev-dependencies
just likecargo test
does. That is,cargo fuzz
seems to me like it's a lot closer tocargo test
than it is tocargo build
.The text was updated successfully, but these errors were encountered: