diff --git a/src/prepare.rs b/src/prepare.rs index 6d5bcae..13e46ac 100644 --- a/src/prepare.rs +++ b/src/prepare.rs @@ -199,12 +199,16 @@ fn run_command(cmd: Command) -> anyhow::Result<()> { && line.contains( " are different, but only one can be written to lockfile unambiguously", )) + || (line.contains("failed to select a version for ") + && line.contains(" which could resolve this conflict")) { broken_deps = true; } else if line.contains("error: failed to parse lock file at") || line.contains( "error: Attempting to resolve a dependency with more than one crate with links=", ) + || (line.contains("error: checksum for ") + && line.contains(" changed between lock files")) { broken_lockfile = true; } diff --git a/tests/buildtest/crates/checksum-mismatch/Cargo.lock b/tests/buildtest/crates/checksum-mismatch/Cargo.lock new file mode 100644 index 0000000..7aa52ae --- /dev/null +++ b/tests/buildtest/crates/checksum-mismatch/Cargo.lock @@ -0,0 +1,19 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "checksum-mismatch" +version = "0.1.0" +dependencies = [ + "empty-library", +] + +[[package]] +name = "empty-library" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0000000000000000000000000000000000000000000000000000000000000000" +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# | +# intentionally tempered with lock file | diff --git a/tests/buildtest/crates/checksum-mismatch/Cargo.toml b/tests/buildtest/crates/checksum-mismatch/Cargo.toml new file mode 100644 index 0000000..e3d34d1 --- /dev/null +++ b/tests/buildtest/crates/checksum-mismatch/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "checksum-mismatch" +version = "0.1.0" +authors = ["Pietro Albini "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +empty-library = "1.0.0" + +[features] + +# attempts to replicate error such as https://crater-reports.s3.amazonaws.com/beta-1.96-1/1.95.0/gh/Deltafall-Community.deltafall-clicker/log.txt diff --git a/tests/buildtest/crates/checksum-mismatch/src/main.rs b/tests/buildtest/crates/checksum-mismatch/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/tests/buildtest/crates/checksum-mismatch/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} diff --git a/tests/buildtest/crates/links-collision/Cargo.toml b/tests/buildtest/crates/links-collision/Cargo.toml new file mode 100644 index 0000000..c623dec --- /dev/null +++ b/tests/buildtest/crates/links-collision/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "links-collision" +version = "0.1.0" +authors = ["Pietro Albini "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +# both specify sqlite3 as their links key +sqlite3-src = { version = "=0.6.1" } +libsqlite3-sys = { version = "=0.32.0" } + +# replicates the error from e.g. https://crater-reports.s3.amazonaws.com/beta-1.96-1/1.95.0/gh/07CalC.rustodo/log.txt diff --git a/tests/buildtest/crates/links-collision/src/main.rs b/tests/buildtest/crates/links-collision/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/tests/buildtest/crates/links-collision/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} diff --git a/tests/buildtest/crates/missing-feature/Cargo.toml b/tests/buildtest/crates/missing-feature/Cargo.toml new file mode 100644 index 0000000..9c3e17f --- /dev/null +++ b/tests/buildtest/crates/missing-feature/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "missing-feature" +version = "0.1.0" +authors = ["Pietro Albini "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +empty-library = { version = "1.0.0", features = ["does-not-exist"] } + +[features] + +# attempts to replicate errors such as https://crater-reports.s3.amazonaws.com/beta-1.96-1/1.95.0/gh/GHOryy5.AINFTP/log.txt diff --git a/tests/buildtest/crates/missing-feature/src/main.rs b/tests/buildtest/crates/missing-feature/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/tests/buildtest/crates/missing-feature/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} diff --git a/tests/buildtest/mod.rs b/tests/buildtest/mod.rs index b2b61b9..1a4dbba 100644 --- a/tests/buildtest/mod.rs +++ b/tests/buildtest/mod.rs @@ -316,6 +316,27 @@ test_prepare_error!( InvalidCargoTomlSyntax ); +test_prepare_error_stderr!( + test_checksum_mismatch, + "checksum-mismatch", + InvalidCargoLock, + "error: checksum for `empty-library v1.0.0` changed between lock files" +); + +test_prepare_error_stderr!( + test_missing_feature, + "missing-feature", + BrokenDependencies, + "failed to select a version for `empty-library` which could resolve this conflict" +); + +test_prepare_error_stderr!( + test_links_collision, + "links-collision", + BrokenDependencies, + "failed to select a version for `sqlite3-src` which could resolve this conflict" +); + test_prepare_error_stderr!( test_yanked_deps, "yanked-deps",