camshaft / bolero

property testing and verification front-end for Rust
https://camshaft.github.io/bolero
MIT License
181 stars 14 forks source link

cargo-bolero tests fail to build from crates.io #232

Closed jtojnar closed 3 months ago

jtojnar commented 3 months ago

Trying to update Nix cargo-bolero package (which obtains the source from crates.io), I get the following test failures:

   Compiling cargo-bolero v0.11.1 (/build/cargo-bolero-0.11.1.tar.gz)
error[E0433]: failed to resolve: use of undeclared crate or module `bolero`
 --> tests/fuzz_harnessed/fuzz_target.rs:3:5
  |
3 |     bolero::check!().for_each(|_| {});
  |     ^^^^^^ use of undeclared crate or module `bolero`

error[E0432]: unresolved import `bolero`
 --> tests/fuzz_generator/fuzz_target.rs:1:5
  |
1 | use bolero::check;
  |     ^^^^^^ use of undeclared crate or module `bolero`

error[E0432]: unresolved import `bolero`
 --> tests/fuzz_bytes/fuzz_target.rs:1:5
  |
1 | use bolero::check;
  |     ^^^^^^ use of undeclared crate or module `bolero`

Looking at the contents of the crate archive, it is because Cargo.toml no longer contains bolero dependency:

# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
#
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g., crates.io) dependencies.
#
# If you are reading this file be aware that the original Cargo.toml
# will likely look very different (and much more reasonable).
# See Cargo.toml.orig for the original contents.

# [omitted…]

[dev-dependencies]

[features]
afl = ["bolero-afl"]
default = [
    "afl",
    "libfuzzer",
    "kani",
]
honggfuzz = ["bolero-honggfuzz"]
kani = []
libfuzzer = []

It is present in Cargo.toml.orig, which is probably why it works on CI.

camshaft commented 3 months ago

Ah looks like the dev dependency is missing a version number: https://github.com/camshaft/bolero/blob/ab927998385fb0194489c0f479314b78ad0b39d5/bin/cargo-bolero/Cargo.toml#L37

I can get a fix out today.