Skip to content

Commit b2aa08b

Browse files
committed
test(fingerprint): Verify rustc extra flags like RUSTFLAGS
I almost overlooked these
1 parent 2560340 commit b2aa08b

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed

tests/testsuite/freshness.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,6 +1366,48 @@ fn changing_rustflags_is_cached() {
13661366
.run();
13671367
}
13681368

1369+
#[cargo_test]
1370+
fn changing_rustc_extra_flags_is_cached() {
1371+
let p = project().file("src/lib.rs", "").build();
1372+
1373+
// This isn't ever cached, we always have to recompile
1374+
p.cargo("rustc")
1375+
.with_stderr_data(str![[r#"
1376+
[COMPILING] foo v0.0.1 ([ROOT]/foo)
1377+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
1378+
1379+
"#]])
1380+
.run();
1381+
p.cargo("rustc -v -- -C linker=cc")
1382+
.with_stderr_data(str![[r#"
1383+
[DIRTY] foo v0.0.1 ([ROOT]/foo): the profile configuration changed
1384+
[COMPILING] foo v0.0.1 ([ROOT]/foo)
1385+
[RUNNING] `rustc [..]
1386+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
1387+
1388+
"#]])
1389+
.run();
1390+
1391+
p.cargo("rustc -v")
1392+
.with_stderr_data(str![[r#"
1393+
[DIRTY] foo v0.0.1 ([ROOT]/foo): the profile configuration changed
1394+
[COMPILING] foo v0.0.1 ([ROOT]/foo)
1395+
[RUNNING] `rustc [..]
1396+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
1397+
1398+
"#]])
1399+
.run();
1400+
p.cargo("rustc -v -- -C linker=cc")
1401+
.with_stderr_data(str![[r#"
1402+
[DIRTY] foo v0.0.1 ([ROOT]/foo): the profile configuration changed
1403+
[COMPILING] foo v0.0.1 ([ROOT]/foo)
1404+
[RUNNING] `rustc [..]
1405+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
1406+
1407+
"#]])
1408+
.run();
1409+
}
1410+
13691411
#[cargo_test]
13701412
fn update_dependency_mtime_does_not_rebuild() {
13711413
let p = project()

tests/testsuite/freshness_checksum.rs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,6 +1540,52 @@ fn changing_rustflags_is_cached() {
15401540
.run();
15411541
}
15421542

1543+
#[cargo_test(nightly, reason = "requires -Zchecksum-hash-algorithm")]
1544+
fn changing_rustc_extra_flags_is_cached() {
1545+
let p = project().file("src/lib.rs", "").build();
1546+
1547+
// This isn't ever cached, we always have to recompile
1548+
p.cargo("rustc -Zchecksum-freshness")
1549+
.masquerade_as_nightly_cargo(&["checksum-freshness"])
1550+
.with_stderr_data(str![[r#"
1551+
[COMPILING] foo v0.0.1 ([ROOT]/foo)
1552+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
1553+
1554+
"#]])
1555+
.run();
1556+
p.cargo("rustc -Zchecksum-freshness -v -- -C linker=cc")
1557+
.masquerade_as_nightly_cargo(&["checksum-freshness"])
1558+
.with_stderr_data(str![[r#"
1559+
[DIRTY] foo v0.0.1 ([ROOT]/foo): the profile configuration changed
1560+
[COMPILING] foo v0.0.1 ([ROOT]/foo)
1561+
[RUNNING] `rustc [..]
1562+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
1563+
1564+
"#]])
1565+
.run();
1566+
1567+
p.cargo("rustc -Zchecksum-freshness -v")
1568+
.masquerade_as_nightly_cargo(&["checksum-freshness"])
1569+
.with_stderr_data(str![[r#"
1570+
[DIRTY] foo v0.0.1 ([ROOT]/foo): the profile configuration changed
1571+
[COMPILING] foo v0.0.1 ([ROOT]/foo)
1572+
[RUNNING] `rustc [..] src/lib.rs [..]
1573+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
1574+
1575+
"#]])
1576+
.run();
1577+
p.cargo("rustc -Zchecksum-freshness -v -- -C linker=cc")
1578+
.masquerade_as_nightly_cargo(&["checksum-freshness"])
1579+
.with_stderr_data(str![[r#"
1580+
[DIRTY] foo v0.0.1 ([ROOT]/foo): the profile configuration changed
1581+
[COMPILING] foo v0.0.1 ([ROOT]/foo)
1582+
[RUNNING] `rustc [..]
1583+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
1584+
1585+
"#]])
1586+
.run();
1587+
}
1588+
15431589
#[cargo_test(nightly, reason = "requires -Zchecksum-hash-algorithm")]
15441590
fn reuse_panic_build_dep_test() {
15451591
let p = project()

0 commit comments

Comments
 (0)