Skip to content

Commit

Permalink
Fixes e2e tests using checks with UNIX paths.
Browse files Browse the repository at this point in the history
On Windows the output error and warning paths use '\' as path separator.
e2e tests have checks with hardcoded UNIX paths that use '/' as path
separator character.

Solution was to replace '\' by '/' on `compile_and_capture_output`.
  • Loading branch information
esdrubal committed Oct 25, 2022
1 parent 2b8761d commit 4cec84b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/src/e2e_vm_tests/harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use fuel_vm::interpreter::Interpreter;
use fuel_vm::prelude::*;
use rand::rngs::StdRng;
use rand::{Rng, SeedableRng};
use regex::{Captures, Regex};
use std::{fmt::Write, fs, str::FromStr};

pub const NODE_URL: &str = "http://127.0.0.1:4000";
Expand Down Expand Up @@ -125,6 +126,17 @@ pub(crate) fn compile_and_capture_output(
write!(output, "\n{}", e).expect("error writing output");
}

if cfg!(windows) {
// In windows output error and warning path files start with \\?\
// We replace \ by / so tests can check unix paths only
let regex = Regex::new(r"\\\\?\\(.*)").unwrap();
output = regex
.replace_all(output.as_str(), |caps: &Captures| {
caps[1].replace('\\', "/")
})
.to_string();
}

(result, output)
}

Expand Down

0 comments on commit 4cec84b

Please sign in to comment.