Skip to content

Commit

Permalink
Auto merge of #7534 - ehuss:fix-windows-nightly, r=alexcrichton
Browse files Browse the repository at this point in the history
Fix some tests failing on Windows nightly.

- Windows MSVC binaries don't have metadata hash anymore.
- Properly escape backslashes in config TOML.
  • Loading branch information
bors committed Oct 24, 2019
2 parents 79bb06b + 3beb139 commit dcad4cc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
4 changes: 2 additions & 2 deletions tests/testsuite/dep_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ fn relative_depinfo_paths_ws() {

assert_deps_contains(
&p,
&format!("target/{}/debug/.fingerprint/foo-*/dep-bin-foo-*", host),
&format!("target/{}/debug/.fingerprint/foo-*/dep-bin-foo*", host),
&[
(1, "src/main.rs"),
(
Expand Down Expand Up @@ -403,7 +403,7 @@ fn relative_depinfo_paths_no_ws() {

assert_deps_contains(
&p,
"target/debug/.fingerprint/foo-*/dep-bin-foo-*",
"target/debug/.fingerprint/foo-*/dep-bin-foo*",
&[
(1, "src/main.rs"),
(
Expand Down
30 changes: 12 additions & 18 deletions tests/testsuite/test.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
use std::fs::{self, File};
use std::io::prelude::*;

use cargo;

use cargo_test_support::paths::CargoPathExt;
use cargo_test_support::registry::Package;
use cargo_test_support::{
basic_bin_manifest, basic_lib_manifest, basic_manifest, cargo_exe, project,
};
use cargo_test_support::{cross_compile, is_nightly, paths};
use cargo_test_support::{rustc_host, sleep_ms};
use std::fs;

#[cargo_test]
fn cargo_test_simple() {
Expand Down Expand Up @@ -2421,10 +2418,7 @@ fn bin_does_not_rebuild_tests() {
p.cargo("test -v").run();

sleep_ms(1000);
File::create(&p.root().join("src/main.rs"))
.unwrap()
.write_all(b"fn main() { 3; }")
.unwrap();
fs::write(p.root().join("src/main.rs"), "fn main() { 3; }").unwrap();

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

fs::create_dir_all(config.parent().unwrap()).unwrap();
File::create(config)
.unwrap()
.write_all(
format!(
r#"
// Escape Windows backslashes for TOML config.
let runner_str = runner_path.to_str().unwrap().replace('\\', "\\\\");
fs::write(
config,
format!(
r#"
[target.'cfg(target_arch = "x86")']
runner = "{}"
"#,
runner_path.to_str().unwrap()
)
.as_bytes(),
)
.unwrap();
runner_str
),
)
.unwrap();

let p = project()
.file("Cargo.toml", &basic_lib_manifest("foo"))
Expand Down

0 comments on commit dcad4cc

Please sign in to comment.