Skip to content

Commit 84e4277

Browse files
committed
test(package): Add test to verify package build cache behavior
1 parent 9b29697 commit 84e4277

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

tests/testsuite/package.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,6 +1827,46 @@ fn package_two_kinds_of_deps() {
18271827
p.cargo("package --no-verify").run();
18281828
}
18291829

1830+
#[cargo_test]
1831+
fn package_should_not_use_build_cache() {
1832+
Package::new("other", "1.0.0").publish();
1833+
let p = project()
1834+
.file(
1835+
"Cargo.toml",
1836+
r#"
1837+
[package]
1838+
name = "foo"
1839+
version = "0.0.1"
1840+
edition = "2015"
1841+
authors = []
1842+
1843+
[dependencies]
1844+
other = "1.0"
1845+
"#,
1846+
)
1847+
.file("src/lib.rs", "")
1848+
.build();
1849+
1850+
// Build once so that the build cache is populated
1851+
p.cargo("build").run();
1852+
1853+
// Run package and verify we rebuild everything
1854+
p.cargo("package")
1855+
.with_stderr_data(str![[r#"
1856+
[WARNING] manifest has no description, license, license-file, documentation, homepage or repository.
1857+
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
1858+
[PACKAGING] foo v0.0.1 ([ROOT]/foo)
1859+
[UPDATING] `dummy-registry` index
1860+
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
1861+
[VERIFYING] foo v0.0.1 ([ROOT]/foo)
1862+
[COMPILING] other v1.0.0
1863+
[COMPILING] foo v0.0.1 ([ROOT]/foo/target/package/foo-0.0.1)
1864+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
1865+
1866+
"#]])
1867+
.run();
1868+
}
1869+
18301870
#[cargo_test(nightly, reason = "exported_private_dependencies lint is unstable")]
18311871
fn package_public_dep() {
18321872
Package::new("bar", "1.0.0").publish();

0 commit comments

Comments
 (0)