Skip to content

Commit b036f57

Browse files
committed
Check if the binary is already build in build_stored test function
To speed up the build simply check if the binary exists. It should already be build as a part of building all tests. Also fixes the release build.
1 parent 8165b4a commit b036f57

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

tests/util/mod.rs

+11-3
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,18 @@ fn build_stored() {
280280
static mut BUILD_SUCCESS: bool = false;
281281

282282
BUILD.call_once(|| {
283-
let mut cmd = Command::new("cargo");
283+
if let Ok(_) = fs::metadata(env!("CARGO_BIN_EXE_stored")) {
284+
// Already build.
285+
unsafe { BUILD_SUCCESS = true }
286+
return;
287+
}
288+
289+
let mut cmd = Command::new(env!("CARGO"));
284290
cmd.args(&["build", "--bin", "stored"]);
285-
#[cfg(not(debug_assertions))]
286-
cmd.arg("--release");
291+
if env!("CARGO_BIN_EXE_stored").contains("release") {
292+
cmd.arg("--release");
293+
}
294+
287295
let output = cmd.output().expect("unable to build server");
288296

289297
if !output.status.success() {

0 commit comments

Comments
 (0)