Skip to content

Commit dcad4cc

Browse files
committed
Auto merge of #7534 - ehuss:fix-windows-nightly, r=alexcrichton
Fix some tests failing on Windows nightly. - Windows MSVC binaries don't have metadata hash anymore. - Properly escape backslashes in config TOML.
2 parents 79bb06b + 3beb139 commit dcad4cc

File tree

2 files changed

+14
-20
lines changed

2 files changed

+14
-20
lines changed

tests/testsuite/dep_info.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ fn relative_depinfo_paths_ws() {
275275

276276
assert_deps_contains(
277277
&p,
278-
&format!("target/{}/debug/.fingerprint/foo-*/dep-bin-foo-*", host),
278+
&format!("target/{}/debug/.fingerprint/foo-*/dep-bin-foo*", host),
279279
&[
280280
(1, "src/main.rs"),
281281
(
@@ -403,7 +403,7 @@ fn relative_depinfo_paths_no_ws() {
403403

404404
assert_deps_contains(
405405
&p,
406-
"target/debug/.fingerprint/foo-*/dep-bin-foo-*",
406+
"target/debug/.fingerprint/foo-*/dep-bin-foo*",
407407
&[
408408
(1, "src/main.rs"),
409409
(

tests/testsuite/test.rs

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
use std::fs::{self, File};
2-
use std::io::prelude::*;
3-
41
use cargo;
5-
62
use cargo_test_support::paths::CargoPathExt;
73
use cargo_test_support::registry::Package;
84
use cargo_test_support::{
95
basic_bin_manifest, basic_lib_manifest, basic_manifest, cargo_exe, project,
106
};
117
use cargo_test_support::{cross_compile, is_nightly, paths};
128
use cargo_test_support::{rustc_host, sleep_ms};
9+
use std::fs;
1310

1411
#[cargo_test]
1512
fn cargo_test_simple() {
@@ -2421,10 +2418,7 @@ fn bin_does_not_rebuild_tests() {
24212418
p.cargo("test -v").run();
24222419

24232420
sleep_ms(1000);
2424-
File::create(&p.root().join("src/main.rs"))
2425-
.unwrap()
2426-
.write_all(b"fn main() { 3; }")
2427-
.unwrap();
2421+
fs::write(p.root().join("src/main.rs"), "fn main() { 3; }").unwrap();
24282422

24292423
p.cargo("test -v --no-run")
24302424
.with_stderr(
@@ -3787,19 +3781,19 @@ fn cargo_test_doctest_xcompile_runner() {
37873781
let config = paths::root().join(".cargo/config");
37883782

37893783
fs::create_dir_all(config.parent().unwrap()).unwrap();
3790-
File::create(config)
3791-
.unwrap()
3792-
.write_all(
3793-
format!(
3794-
r#"
3784+
// Escape Windows backslashes for TOML config.
3785+
let runner_str = runner_path.to_str().unwrap().replace('\\', "\\\\");
3786+
fs::write(
3787+
config,
3788+
format!(
3789+
r#"
37953790
[target.'cfg(target_arch = "x86")']
37963791
runner = "{}"
37973792
"#,
3798-
runner_path.to_str().unwrap()
3799-
)
3800-
.as_bytes(),
3801-
)
3802-
.unwrap();
3793+
runner_str
3794+
),
3795+
)
3796+
.unwrap();
38033797

38043798
let p = project()
38053799
.file("Cargo.toml", &basic_lib_manifest("foo"))

0 commit comments

Comments
 (0)