Skip to content

Commit

Permalink
test: extract making make exectuable to fn
Browse files Browse the repository at this point in the history
  • Loading branch information
weihanglo committed Oct 6, 2023
1 parent 5a2ea19 commit cd5d793
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions tests/testsuite/jobserver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ fn validate(_: &str) {
}
"#;

fn make_exe() -> &'static str {
if cfg!(windows) {
"mingw32-make"
} else {
"make"
}
}

#[cargo_test]
fn jobserver_exists() {
let p = project()
Expand All @@ -64,11 +72,7 @@ fn jobserver_exists() {

#[cargo_test]
fn external_subcommand_inherits_jobserver() {
let make = if cfg!(windows) {
"mingw32-make"
} else {
"make"
};
let make = make_exe();
if Command::new(make).arg("--version").output().is_err() {
return;
}
Expand Down Expand Up @@ -103,11 +107,7 @@ all:

#[cargo_test]
fn makes_jobserver_used() {
let make = if cfg!(windows) {
"mingw32-make"
} else {
"make"
};
let make = make_exe();
if !is_ci() && Command::new(make).arg("--version").output().is_err() {
return;
}
Expand Down Expand Up @@ -215,11 +215,7 @@ all:

#[cargo_test]
fn jobserver_and_j() {
let make = if cfg!(windows) {
"mingw32-make"
} else {
"make"
};
let make = make_exe();
if !is_ci() && Command::new(make).arg("--version").output().is_err() {
return;
}
Expand Down

0 comments on commit cd5d793

Please sign in to comment.