Skip to content

Commit 09847df

Browse files
committed
Fix all tests with recent changes
The package id for path dependencies now has another path component pointing precisely to the package being compiled, so lots of tests need their output matches to get updated.
1 parent 9185445 commit 09847df

17 files changed

+105
-87
lines changed

src/cargo/util/paths.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ pub fn read(path: &Path) -> CargoResult<String> {
7373
let mut f = try!(File::open(path));
7474
try!(f.read_to_string(&mut ret));
7575
Ok(ret)
76-
}).chain_error(|| {
77-
internal(format!("failed to read `{}`", path.display()))
76+
})().map_err(human).chain_error(|| {
77+
human(format!("failed to read `{}`", path.display()))
7878
})
7979
}
8080

@@ -83,8 +83,8 @@ pub fn write(path: &Path, contents: &[u8]) -> CargoResult<()> {
8383
let mut f = try!(File::create(path));
8484
try!(f.write_all(contents));
8585
Ok(())
86-
}).chain_error(|| {
87-
internal(format!("failed to write `{}`", path.display()))
86+
})().map_err(human).chain_error(|| {
87+
human(format!("failed to write `{}`", path.display()))
8888
})
8989
}
9090

tests/test_cargo_compile.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ test!(cargo_compile_with_warnings_in_a_dep_package {
315315

316316
assert_that(p.cargo_process("build"),
317317
execs()
318-
.with_stdout(&format!("{} bar v0.5.0 ({})\n\
318+
.with_stdout(&format!("{} bar v0.5.0 ({}/bar)\n\
319319
{} foo v0.5.0 ({})\n",
320320
COMPILING, p.url(),
321321
COMPILING, p.url()))
@@ -607,7 +607,7 @@ test!(cargo_compile_with_dep_name_mismatch {
607607
assert_that(p.cargo_process("build"),
608608
execs().with_status(101).with_stderr(&format!(
609609
r#"no matching package named `notquitebar` found (required by `foo`)
610-
location searched: {proj_dir}
610+
location searched: {proj_dir}/bar
611611
version required: *
612612
"#, proj_dir = p.url())));
613613
});
@@ -1004,7 +1004,7 @@ test!(verbose_release_build_deps {
10041004
.file("foo/src/lib.rs", "");
10051005
assert_that(p.cargo_process("build").arg("-v").arg("--release"),
10061006
execs().with_status(0).with_stdout(&format!("\
1007-
{compiling} foo v0.0.0 ({url})
1007+
{compiling} foo v0.0.0 ({url}/foo)
10081008
{running} `rustc foo[..]src[..]lib.rs --crate-name foo \
10091009
--crate-type dylib --crate-type rlib -C prefer-dynamic \
10101010
-C opt-level=3 \

tests/test_cargo_compile_custom_build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ test!(shared_dep_with_a_build_script {
970970
authors = []
971971
972972
[dependencies.a]
973-
path = "../b"
973+
path = "../a"
974974
"#)
975975
.file("b/src/lib.rs", "");
976976
assert_that(p.cargo_process("build").arg("-v"),

tests/test_cargo_compile_git_deps.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -622,8 +622,8 @@ test!(update_with_shared_deps {
622622
execs().with_stdout(&format!("\
623623
{updating} git repository `{git}`
624624
{compiling} bar v0.5.0 ({git}#[..])
625-
{compiling} [..] v0.5.0 ({dir})
626-
{compiling} [..] v0.5.0 ({dir})
625+
{compiling} [..] v0.5.0 ([..])
626+
{compiling} [..] v0.5.0 ([..])
627627
{compiling} foo v0.5.0 ({dir})\n",
628628
updating = UPDATING, git = git_project.url(),
629629
compiling = COMPILING, dir = p.url())));
@@ -681,8 +681,8 @@ To learn more, run the command again with --verbose.
681681
assert_that(p.cargo("build"),
682682
execs().with_stdout(&format!("\
683683
{compiling} bar v0.5.0 ({git}#[..])
684-
{compiling} [..] v0.5.0 ({dir})
685-
{compiling} [..] v0.5.0 ({dir})
684+
{compiling} [..] v0.5.0 ({dir}[..]dep[..])
685+
{compiling} [..] v0.5.0 ({dir}[..]dep[..])
686686
{compiling} foo v0.5.0 ({dir})\n",
687687
git = git_project.url(),
688688
compiling = COMPILING, dir = p.url())));

tests/test_cargo_compile_path_deps.rs

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ test!(cargo_compile_with_nested_deps_shorthand {
7272

7373
assert_that(p.cargo_process("build"),
7474
execs().with_status(0)
75-
.with_stdout(&format!("{} baz v0.5.0 ({})\n\
76-
{} bar v0.5.0 ({})\n\
75+
.with_stdout(&format!("{} baz v0.5.0 ({}/bar/baz)\n\
76+
{} bar v0.5.0 ({}/bar)\n\
7777
{} foo v0.5.0 ({})\n",
7878
COMPILING, p.url(),
7979
COMPILING, p.url(),
@@ -90,13 +90,13 @@ test!(cargo_compile_with_nested_deps_shorthand {
9090
println!("building baz");
9191
assert_that(p.cargo("build").arg("-p").arg("baz"),
9292
execs().with_status(0)
93-
.with_stdout(&format!("{} baz v0.5.0 ({})\n",
93+
.with_stdout(&format!("{} baz v0.5.0 ({}/bar/baz)\n",
9494
COMPILING, p.url())));
9595
println!("building foo");
9696
assert_that(p.cargo("build")
9797
.arg("-p").arg("foo"),
9898
execs().with_status(0)
99-
.with_stdout(&format!("{} bar v0.5.0 ({})\n\
99+
.with_stdout(&format!("{} bar v0.5.0 ({}/bar)\n\
100100
{} foo v0.5.0 ({})\n",
101101
COMPILING, p.url(),
102102
COMPILING, p.url())));
@@ -176,15 +176,15 @@ test!(cargo_compile_with_root_dev_deps_with_testing {
176176
p2.build();
177177
assert_that(p.cargo_process("test"),
178178
execs().with_stdout(&format!("\
179-
{compiling} [..] v0.5.0 ({url})
180-
{compiling} [..] v0.5.0 ({url})
179+
{compiling} [..] v0.5.0 ([..])
180+
{compiling} [..] v0.5.0 ([..])
181181
{running} target[..]foo-[..]
182182
183183
running 0 tests
184184
185185
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
186186
187-
", compiling = COMPILING, url = p.url(), running = RUNNING)));
187+
", compiling = COMPILING, running = RUNNING)));
188188
});
189189

190190
test!(cargo_compile_with_transitive_dev_deps {
@@ -229,7 +229,7 @@ test!(cargo_compile_with_transitive_dev_deps {
229229
"#);
230230

231231
assert_that(p.cargo_process("build"),
232-
execs().with_stdout(&format!("{} bar v0.5.0 ({})\n\
232+
execs().with_stdout(&format!("{} bar v0.5.0 ({}/bar)\n\
233233
{} foo v0.5.0 ({})\n",
234234
COMPILING, p.url(),
235235
COMPILING, p.url())));
@@ -271,7 +271,7 @@ test!(no_rebuild_dependency {
271271
"#);
272272
// First time around we should compile both foo and bar
273273
assert_that(p.cargo_process("build"),
274-
execs().with_stdout(&format!("{} bar v0.5.0 ({})\n\
274+
execs().with_stdout(&format!("{} bar v0.5.0 ({}/bar)\n\
275275
{} foo v0.5.0 ({})\n",
276276
COMPILING, p.url(),
277277
COMPILING, p.url())));
@@ -282,7 +282,7 @@ test!(no_rebuild_dependency {
282282

283283
p.build(); // rebuild the files (rewriting them in the process)
284284
assert_that(p.cargo("build"),
285-
execs().with_stdout(&format!("{} bar v0.5.0 ({})\n\
285+
execs().with_stdout(&format!("{} bar v0.5.0 ({}/bar)\n\
286286
{} foo v0.5.0 ({})\n",
287287
COMPILING, p.url(),
288288
COMPILING, p.url())));
@@ -337,8 +337,8 @@ test!(deep_dependencies_trigger_rebuild {
337337
pub fn baz() {}
338338
"#);
339339
assert_that(p.cargo_process("build"),
340-
execs().with_stdout(&format!("{} baz v0.5.0 ({})\n\
341-
{} bar v0.5.0 ({})\n\
340+
execs().with_stdout(&format!("{} baz v0.5.0 ({}/baz)\n\
341+
{} bar v0.5.0 ({}/bar)\n\
342342
{} foo v0.5.0 ({})\n",
343343
COMPILING, p.url(),
344344
COMPILING, p.url(),
@@ -355,8 +355,8 @@ test!(deep_dependencies_trigger_rebuild {
355355
pub fn baz() { println!("hello!"); }
356356
"#).unwrap();
357357
assert_that(p.cargo("build"),
358-
execs().with_stdout(&format!("{} baz v0.5.0 ({})\n\
359-
{} bar v0.5.0 ({})\n\
358+
execs().with_stdout(&format!("{} baz v0.5.0 ({}/baz)\n\
359+
{} bar v0.5.0 ({}/bar)\n\
360360
{} foo v0.5.0 ({})\n",
361361
COMPILING, p.url(),
362362
COMPILING, p.url(),
@@ -369,7 +369,7 @@ test!(deep_dependencies_trigger_rebuild {
369369
pub fn bar() { println!("hello!"); baz::baz(); }
370370
"#).unwrap();
371371
assert_that(p.cargo("build"),
372-
execs().with_stdout(&format!("{} bar v0.5.0 ({})\n\
372+
execs().with_stdout(&format!("{} bar v0.5.0 ({}/bar)\n\
373373
{} foo v0.5.0 ({})\n",
374374
COMPILING, p.url(),
375375
COMPILING, p.url())));
@@ -426,8 +426,8 @@ test!(no_rebuild_two_deps {
426426
pub fn baz() {}
427427
"#);
428428
assert_that(p.cargo_process("build"),
429-
execs().with_stdout(&format!("{} baz v0.5.0 ({})\n\
430-
{} bar v0.5.0 ({})\n\
429+
execs().with_stdout(&format!("{} baz v0.5.0 ({}/baz)\n\
430+
{} bar v0.5.0 ({}/bar)\n\
431431
{} foo v0.5.0 ({})\n",
432432
COMPILING, p.url(),
433433
COMPILING, p.url(),
@@ -473,7 +473,7 @@ test!(nested_deps_recompile {
473473
let bar = p.url();
474474

475475
assert_that(p.cargo_process("build"),
476-
execs().with_stdout(&format!("{} bar v0.5.0 ({})\n\
476+
execs().with_stdout(&format!("{} bar v0.5.0 ({}/src/bar)\n\
477477
{} foo v0.5.0 ({})\n",
478478
COMPILING, bar,
479479
COMPILING, p.url())));
@@ -509,14 +509,16 @@ test!(error_message_for_missing_manifest {
509509
.file("src/bar/not-a-manifest", "");
510510

511511
assert_that(p.cargo_process("build"),
512-
execs()
513-
.with_status(101)
514-
.with_stderr(&format!("\
512+
execs().with_status(101)
513+
.with_stderr("\
515514
Unable to update file://[..]
516515
517516
Caused by:
518-
Could not find `Cargo.toml` in `{}`
519-
", p.root().join("src").join("bar").display())));
517+
failed to read `[..]bar[..]Cargo.toml`
518+
519+
Caused by:
520+
No such file or directory ([..])
521+
"));
520522

521523
});
522524

@@ -678,7 +680,7 @@ test!(path_dep_build_cmd {
678680
p.root().join("bar").move_into_the_past().unwrap();
679681

680682
assert_that(p.cargo("build"),
681-
execs().with_stdout(&format!("{} bar v0.5.0 ({})\n\
683+
execs().with_stdout(&format!("{} bar v0.5.0 ({}/bar)\n\
682684
{} foo v0.5.0 ({})\n",
683685
COMPILING, p.url(),
684686
COMPILING, p.url())));
@@ -695,7 +697,7 @@ test!(path_dep_build_cmd {
695697
}
696698

697699
assert_that(p.cargo("build"),
698-
execs().with_stdout(&format!("{} bar v0.5.0 ({})\n\
700+
execs().with_stdout(&format!("{} bar v0.5.0 ({}/bar)\n\
699701
{} foo v0.5.0 ({})\n",
700702
COMPILING, p.url(),
701703
COMPILING, p.url())));
@@ -741,8 +743,8 @@ test!(dev_deps_no_rebuild_lib {
741743
assert_that(p.cargo("test"),
742744
execs().with_status(0)
743745
.with_stdout(&format!("\
744-
{compiling} [..] v0.5.0 ({url})
745-
{compiling} [..] v0.5.0 ({url})
746+
{compiling} [..] v0.5.0 ({url}[..])
747+
{compiling} [..] v0.5.0 ({url}[..])
746748
{running} target[..]foo-[..]
747749
748750
running 0 tests

tests/test_cargo_compile_plugins.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ test!(native_plugin_dependency_with_custom_ar_linker {
264264
foo.build();
265265
assert_that(bar.cargo_process("build").arg("--verbose"),
266266
execs().with_stdout(&format!("\
267-
{compiling} foo v0.0.1 ({url})
267+
{compiling} foo v0.0.1 ([..])
268268
{running} `rustc [..] -C ar=nonexistent-ar -C linker=nonexistent-linker [..]`
269-
", compiling = COMPILING, running = RUNNING, url = bar.url())))
269+
", compiling = COMPILING, running = RUNNING)));
270270
});

tests/test_cargo_cross_compile.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ test!(build_script_needed_for_host_and_target {
602602
assert_that(p.cargo_process("build").arg("--target").arg(&target).arg("-v"),
603603
execs().with_status(0)
604604
.with_stdout_contains(&format!("\
605-
{compiling} d1 v0.0.0 ({url})", compiling = COMPILING, url = p.url()))
605+
{compiling} d1 v0.0.0 ({url}/d1)", compiling = COMPILING, url = p.url()))
606606
.with_stdout_contains(&format!("\
607607
{running} `rustc d1[..]build.rs [..] --out-dir {dir}[..]target[..]build[..]d1-[..]`",
608608
running = RUNNING, dir = p.root().display()))
@@ -612,7 +612,7 @@ test!(build_script_needed_for_host_and_target {
612612
.with_stdout_contains(&format!("\
613613
{running} `rustc d1[..]src[..]lib.rs [..]`", running = RUNNING))
614614
.with_stdout_contains(&format!("\
615-
{compiling} d2 v0.0.0 ({url})", compiling = COMPILING, url = p.url()))
615+
{compiling} d2 v0.0.0 ({url}/d2)", compiling = COMPILING, url = p.url()))
616616
.with_stdout_contains(&format!("\
617617
{running} `rustc d2[..]src[..]lib.rs [..] \
618618
-L /path/to/{host}`", running = RUNNING, host = host))

tests/test_cargo_doc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ test!(doc_deps {
101101

102102
assert_that(p.cargo_process("doc"),
103103
execs().with_status(0).with_stdout(&format!("\
104-
[..] bar v0.0.1 ({dir})
105-
[..] bar v0.0.1 ({dir})
104+
[..] bar v0.0.1 ({dir}/bar)
105+
[..] bar v0.0.1 ({dir}/bar)
106106
{documenting} foo v0.0.1 ({dir})
107107
",
108108
documenting = DOCUMENTING,
@@ -148,7 +148,7 @@ test!(doc_no_deps {
148148

149149
assert_that(p.cargo_process("doc").arg("--no-deps"),
150150
execs().with_status(0).with_stdout(&format!("\
151-
{compiling} bar v0.0.1 ({dir})
151+
{compiling} bar v0.0.1 ({dir}/bar)
152152
{documenting} foo v0.0.1 ({dir})
153153
",
154154
documenting = DOCUMENTING, compiling = COMPILING,

tests/test_cargo_features.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ test!(no_feature_doesnt_build {
253253

254254
assert_that(p.cargo("build").arg("--features").arg("bar"),
255255
execs().with_status(0).with_stdout(format!("\
256-
{compiling} bar v0.0.1 ({dir})
256+
{compiling} bar v0.0.1 ({dir}/bar)
257257
{compiling} foo v0.0.1 ({dir})
258258
", compiling = COMPILING, dir = p.url())));
259259
assert_that(p.process(&p.bin("foo")),
@@ -293,7 +293,7 @@ test!(default_feature_pulled_in {
293293

294294
assert_that(p.cargo_process("build"),
295295
execs().with_status(0).with_stdout(format!("\
296-
{compiling} bar v0.0.1 ({dir})
296+
{compiling} bar v0.0.1 ({dir}/bar)
297297
{compiling} foo v0.0.1 ({dir})
298298
", compiling = COMPILING, dir = p.url())));
299299
assert_that(p.process(&p.bin("foo")),
@@ -394,8 +394,8 @@ test!(groups_on_groups_on_groups {
394394

395395
assert_that(p.cargo_process("build"),
396396
execs().with_status(0).with_stdout(format!("\
397-
{compiling} ba[..] v0.0.1 ({dir})
398-
{compiling} ba[..] v0.0.1 ({dir})
397+
{compiling} ba[..] v0.0.1 ({dir}/ba[..])
398+
{compiling} ba[..] v0.0.1 ({dir}/ba[..])
399399
{compiling} foo v0.0.1 ({dir})
400400
", compiling = COMPILING, dir = p.url())));
401401
});
@@ -438,8 +438,8 @@ test!(many_cli_features {
438438

439439
assert_that(p.cargo_process("build").arg("--features").arg("bar baz"),
440440
execs().with_status(0).with_stdout(format!("\
441-
{compiling} ba[..] v0.0.1 ({dir})
442-
{compiling} ba[..] v0.0.1 ({dir})
441+
{compiling} ba[..] v0.0.1 ({dir}/ba[..])
442+
{compiling} ba[..] v0.0.1 ({dir}/ba[..])
443443
{compiling} foo v0.0.1 ({dir})
444444
", compiling = COMPILING, dir = p.url())));
445445
});
@@ -499,8 +499,8 @@ test!(union_features {
499499

500500
assert_that(p.cargo_process("build"),
501501
execs().with_status(0).with_stdout(format!("\
502-
{compiling} d2 v0.0.1 ({dir})
503-
{compiling} d1 v0.0.1 ({dir})
502+
{compiling} d2 v0.0.1 ({dir}/d2)
503+
{compiling} d1 v0.0.1 ({dir}/d1)
504504
{compiling} foo v0.0.1 ({dir})
505505
", compiling = COMPILING, dir = p.url())));
506506
});
@@ -533,14 +533,14 @@ test!(many_features_no_rebuilds {
533533

534534
assert_that(p.cargo_process("build"),
535535
execs().with_status(0).with_stdout(format!("\
536-
{compiling} a v0.1.0 ({dir})
536+
{compiling} a v0.1.0 ({dir}/a)
537537
{compiling} b v0.1.0 ({dir})
538538
", compiling = COMPILING, dir = p.url())));
539539
p.root().move_into_the_past().unwrap();
540540

541541
assert_that(p.cargo("build").arg("-v"),
542542
execs().with_status(0).with_stdout(format!("\
543-
{fresh} a v0.1.0 ([..])
543+
{fresh} a v0.1.0 ([..]/a)
544544
{fresh} b v0.1.0 ([..])
545545
", fresh = FRESH)));
546546
});

0 commit comments

Comments
 (0)