File tree 4 files changed +70
-0
lines changed 4 files changed +70
-0
lines changed Original file line number Diff line number Diff line change
1
+ [package ]
2
+ name = " dep_test"
3
+ version = " 0.1.0"
4
+ edition = " 2021"
Original file line number Diff line number Diff line change
1
+
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ edition = "2018"
6
6
7
7
[dependencies ]
8
8
registry-dep-using-alloc = { version = " *" , features = [' mockbuild' ] }
9
+ dep_test = { path = " ../../dep_test" }
9
10
10
11
[features ]
11
12
feature1 = []
Original file line number Diff line number Diff line change @@ -246,6 +246,70 @@ fn basic() {
246
246
p. cargo ( "test" ) . build_std ( & setup) . target_host ( ) . run ( ) ;
247
247
}
248
248
249
+ #[ cargo_test( build_std_mock) ]
250
+ fn shared_std_dependency_rebuild ( ) {
251
+ let manifest_dir = std:: env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ;
252
+ let setup = setup ( ) ;
253
+ let p = project ( )
254
+ . file (
255
+ "Cargo.toml" ,
256
+ format ! ( "
257
+ [package]
258
+ name = \" foo\"
259
+ version = \" 0.1.0\"
260
+ edition = \" 2021\"
261
+
262
+ [build-dependencies]
263
+ dep_test = {{ path = \" {}/tests/testsuite/mock-std/dep_test\" }}
264
+ " , manifest_dir) . as_str ( )
265
+ )
266
+ . file (
267
+ "src/main.rs" ,
268
+ r#"
269
+ fn main() {
270
+ println!("Hello, World!");
271
+ }
272
+ "# ,
273
+ )
274
+ . file (
275
+ "build.rs" ,
276
+ r#"
277
+ fn main() {
278
+ println!("cargo::rerun-if-changed=build.rs");
279
+ }
280
+ "# ,
281
+ )
282
+ . build ( ) ;
283
+
284
+ p. cargo ( "build -v" )
285
+ . build_std ( & setup)
286
+ . target_host ( )
287
+ . with_stderr_data ( str![ [ r#"
288
+ ...
289
+ [RUNNING] `[..] rustc --crate-name dep_test [..]`
290
+ ...
291
+ [RUNNING] `[..] rustc --crate-name dep_test [..]`
292
+ ...
293
+ "# ] ] )
294
+ . run ( ) ;
295
+
296
+ // TODO: Because of the way in which std is resolved, it's mandatory that this is left commented
297
+ // out as it will fail. This case should result in `dep_test` only being built once, however
298
+ // it's still being built twice. This is a bug.
299
+ //
300
+ // p.cargo("build -v")
301
+ // .build_std(&setup)
302
+ // .with_stderr_does_not_contain(str![[r#"
303
+ //...
304
+ //[RUNNING] `[..] rustc --crate-name dep_test [..]`
305
+ //...
306
+ //[RUNNING] `[..] rustc --crate-name dep_test [..]`
307
+ //...
308
+ //"#]])
309
+ // .run();
310
+
311
+ }
312
+
249
313
#[ cargo_test( build_std_mock) ]
250
314
fn simple_lib_std ( ) {
251
315
let setup = setup ( ) ;
You can’t perform that action at this time.
0 commit comments