Skip to content

Commit

Permalink
fix: attempt to fix CI on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhuene committed Dec 10, 2024
1 parent cb84dc3 commit 100d3ab
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 17 deletions.
23 changes: 13 additions & 10 deletions wdl-engine/tests/tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use std::collections::HashSet;
use std::env;
use std::ffi::OsStr;
use std::fs;
use std::path::MAIN_SEPARATOR;
use std::path::Path;
use std::path::PathBuf;
use std::path::absolute;
Expand Down Expand Up @@ -88,19 +87,23 @@ fn find_tests() -> Vec<PathBuf> {

/// Normalizes a result.
fn normalize(root: &Path, s: &str) -> String {
// Normalize paths separation characters first
let s = s
.replace("\\", "/")
.replace("//", "/")
.replace("\r\n", "\n");

// Strip any paths that start with the root directory
let s: Cow<'_, str> = if let Some(mut root) = root.to_str().map(str::to_string) {
if !root.ends_with(MAIN_SEPARATOR) {
root.push(MAIN_SEPARATOR);
if let Some(root) = root.to_str().map(str::to_string) {
let mut root = root.replace('\\', "/");
if !root.ends_with('/') {
root.push('/');
}

s.replace(&root, "").into()
s.replace(&root, "")
} else {
s.into()
};

// Normalize paths separation characters
s.replace('\\', "/").replace("\r\n", "\n")
s
}
}

/// Compares a single result.
Expand Down
2 changes: 1 addition & 1 deletion wdl-engine/tests/tasks/flags-task/source.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ task flags {

# Instead, make both the flag and the value conditional on `max_matches`
# being defined.
grep ~{"-m " + max_matches} ~{pattern} ~{infile} | wc -l | sed 's/^ *//'
grep ~{"-m " + max_matches} ~{pattern} '~{infile}' | wc -l | sed 's/^ *//'
>>>

output {
Expand Down
8 changes: 4 additions & 4 deletions wdl-engine/tests/tasks/input-type-qualifiers/source.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ task input_type_quantifiers {
}

command <<<
cat ~{write_lines(a)} >> result
cat ~{write_lines(b)} >> result
cat '~{write_lines(a)}' >> result
cat '~{write_lines(b)}' >> result
~{if defined(c) then
"cat ~{write_lines(select_first([c]))} >> result"
"cat '~{write_lines(select_first([c]))}' >> result"
else ""}
~{if defined(e) then
"cat ~{write_lines(select_first([e]))} >> result"
"cat '~{write_lines(select_first([e]))}' >> result"
else ""}
>>>

Expand Down
2 changes: 1 addition & 1 deletion wdl-engine/tests/tasks/multiline-strings2/outputs.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"multiline_strings2.hw4": "hello world",
"multiline_strings2.hw5": "hello world",
"multiline_strings2.hw6": "hello world",
"multiline_strings2.not_equivalent": "hello ///n world"
"multiline_strings2.not_equivalent": "hello //n world"
}
2 changes: 1 addition & 1 deletion wdl-engine/tests/tasks/private-declaration-task/source.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ task private_declaration {
Int num_lines_clamped = if num_lines > 3 then 3 else num_lines

command <<<
head -~{num_lines_clamped} ~{write_lines(lines)}
head -~{num_lines_clamped} '~{write_lines(lines)}'
>>>

output {
Expand Down

0 comments on commit 100d3ab

Please sign in to comment.