File tree Expand file tree Collapse file tree 4 files changed +73
-0
lines changed Expand file tree Collapse file tree 4 files changed +73
-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,73 @@ 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
+ "
258
+ [package]
259
+ name = \" foo\"
260
+ version = \" 0.1.0\"
261
+ edition = \" 2021\"
262
+
263
+ [build-dependencies]
264
+ dep_test = {{ path = \" {}/tests/testsuite/mock-std/dep_test\" }}
265
+ " ,
266
+ manifest_dir
267
+ )
268
+ . as_str ( ) ,
269
+ )
270
+ . file (
271
+ "src/main.rs" ,
272
+ r#"
273
+ fn main() {
274
+ println!("Hello, World!");
275
+ }
276
+ "# ,
277
+ )
278
+ . file (
279
+ "build.rs" ,
280
+ r#"
281
+ fn main() {
282
+ println!("cargo::rerun-if-changed=build.rs");
283
+ }
284
+ "# ,
285
+ )
286
+ . build ( ) ;
287
+
288
+ p. cargo ( "build -v" )
289
+ . build_std ( & setup)
290
+ . target_host ( )
291
+ . with_stderr_data ( str![ [ r#"
292
+ ...
293
+ [RUNNING] `[..] rustc --crate-name dep_test [..]`
294
+ ...
295
+ [RUNNING] `[..] rustc --crate-name dep_test [..]`
296
+ ...
297
+ "# ] ] )
298
+ . run ( ) ;
299
+
300
+ // TODO: Because of the way in which std is resolved, it's mandatory that this is left commented
301
+ // out as it will fail. This case should result in `dep_test` only being built once, however
302
+ // it's still being built twice. This is a bug.
303
+ //
304
+ // p.cargo("build -v")
305
+ // .build_std(&setup)
306
+ // .with_stderr_does_not_contain(str![[r#"
307
+ //...
308
+ //[RUNNING] `[..] rustc --crate-name dep_test [..]`
309
+ //...
310
+ //[RUNNING] `[..] rustc --crate-name dep_test [..]`
311
+ //...
312
+ //"#]])
313
+ // .run();
314
+ }
315
+
249
316
#[ cargo_test( build_std_mock) ]
250
317
fn simple_lib_std ( ) {
251
318
let setup = setup ( ) ;
You can’t perform that action at this time.
0 commit comments