Skip to content

Commit 43aafb4

Browse files
committed
Auto merge of #7965 - jiegec:master, r=alexcrichton
Don't create hardlink for library test and integrations tests, fixing #7960 Related issue: #7960 Problem: Tests are run under deps, but it is still copied to its parent directory. It leads to separation between the executable and its debug symbols (.dSYM directory). Solution: Set hardlink to None.
2 parents 9443875 + 9f07c83 commit 43aafb4

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

src/cargo/core/compiler/context/compilation_files.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -421,9 +421,14 @@ impl<'a, 'cfg: 'a> CompilationFiles<'a, 'cfg> {
421421
Some(types) => {
422422
for file_type in types {
423423
let path = out_dir.join(file_type.filename(&file_stem));
424-
let hardlink = link_stem
425-
.as_ref()
426-
.map(|&(ref ld, ref ls)| ld.join(file_type.filename(ls)));
424+
// Don't create hardlink for tests
425+
let hardlink = if unit.mode.is_any_test() {
426+
None
427+
} else {
428+
link_stem
429+
.as_ref()
430+
.map(|&(ref ld, ref ls)| ld.join(file_type.filename(ls)))
431+
};
427432
let export_path = if unit.target.is_custom_build() {
428433
None
429434
} else {

tests/testsuite/bench.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1612,9 +1612,9 @@ fn json_artifact_includes_executable_for_benchmark() {
16121612
.with_json(
16131613
r#"
16141614
{
1615-
"executable": "[..]/foo/target/release/benchmark-[..][EXE]",
1615+
"executable": "[..]/foo/target/release/deps/benchmark-[..][EXE]",
16161616
"features": [],
1617-
"filenames": [ "[..]/foo/target/release/benchmark-[..][EXE]" ],
1617+
"filenames": [ "[..]/foo/target/release/deps/benchmark-[..][EXE]" ],
16181618
"fresh": false,
16191619
"package_id": "foo 0.0.1 ([..])",
16201620
"profile": "{...}",

tests/testsuite/test.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3379,7 +3379,7 @@ fn json_artifact_includes_executable_for_library_tests() {
33793379
.with_json(
33803380
r#"
33813381
{
3382-
"executable": "[..]/foo/target/debug/foo-[..][EXE]",
3382+
"executable": "[..]/foo/target/debug/deps/foo-[..][EXE]",
33833383
"features": [],
33843384
"filenames": "{...}",
33853385
"fresh": false,
@@ -3413,7 +3413,7 @@ fn json_artifact_includes_executable_for_integration_tests() {
34133413
.with_json(
34143414
r#"
34153415
{
3416-
"executable": "[..]/foo/target/debug/integration_test-[..][EXE]",
3416+
"executable": "[..]/foo/target/debug/deps/integration_test-[..][EXE]",
34173417
"features": [],
34183418
"filenames": "{...}",
34193419
"fresh": false,

0 commit comments

Comments
 (0)