File tree 2 files changed +12
-11
lines changed
src/cargo/ops/cargo_rustc
2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -645,8 +645,12 @@ fn hardlink_or_copy(src: &Path, dst: &Path) -> CargoResult<()> {
645
645
use std:: os:: windows:: fs:: symlink_dir as symlink;
646
646
647
647
let dst_dir = dst. parent ( ) . unwrap ( ) ;
648
- assert ! ( src. starts_with( dst_dir) ) ;
649
- symlink ( src. strip_prefix ( dst_dir) . unwrap ( ) , dst)
648
+ let src = if src. starts_with ( dst_dir) {
649
+ src. strip_prefix ( dst_dir) . unwrap ( )
650
+ } else {
651
+ src
652
+ } ;
653
+ symlink ( src, dst)
650
654
} else {
651
655
fs:: hard_link ( src, dst)
652
656
} ;
Original file line number Diff line number Diff line change 1
1
use std:: path:: Path ;
2
2
use std:: fs:: { self , File } ;
3
3
use std:: env;
4
- use std:: io:: Write ;
5
4
6
5
use hamcrest:: assert_that;
7
6
8
- use cargotest:: { process, ChannelChanger } ;
7
+ use cargotest:: { process, sleep_ms , ChannelChanger } ;
9
8
use cargotest:: support:: { execs, project} ;
10
9
11
10
#[ test]
@@ -31,7 +30,7 @@ fn binary_with_debug() {
31
30
check_dir_contents (
32
31
& p. root ( ) . join ( "out" ) ,
33
32
& [ "foo" ] ,
34
- & [ "foo" ] ,
33
+ & [ "foo" , "foo.dSYM" ] ,
35
34
& [ "foo.exe" , "foo.pdb" ] ,
36
35
) ;
37
36
}
@@ -105,7 +104,7 @@ fn dynamic_library_with_debug() {
105
104
check_dir_contents (
106
105
& p. root ( ) . join ( "out" ) ,
107
106
& [ "libfoo.so" ] ,
108
- & [ "libfoo.so " ] ,
107
+ & [ "libfoo.dylib " ] ,
109
108
& [ "foo.dll" , "foo.dll.lib" ] ,
110
109
) ;
111
110
}
@@ -194,7 +193,7 @@ fn include_only_the_binary_from_the_current_package() {
194
193
check_dir_contents (
195
194
& p. root ( ) . join ( "out" ) ,
196
195
& [ "foo" ] ,
197
- & [ "foo" ] ,
196
+ & [ "foo" , "foo.dSYM" ] ,
198
197
& [ "foo.exe" , "foo.pdb" ] ,
199
198
) ;
200
199
}
@@ -250,10 +249,8 @@ fn replaces_artifacts() {
250
249
execs ( ) . with_stdout ( "foo" ) ,
251
250
) ;
252
251
253
- fs:: File :: create ( p. root ( ) . join ( "src/main.rs" ) )
254
- . unwrap ( )
255
- . write_all ( br#"fn main() { println!("bar") }"# )
256
- . unwrap ( ) ;
252
+ sleep_ms ( 1000 ) ;
253
+ p. change_file ( "src/main.rs" , r#"fn main() { println!("bar") }"# ) ;
257
254
258
255
assert_that (
259
256
p. cargo ( "build -Z out-dir --out-dir out" )
You can’t perform that action at this time.
0 commit comments