mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 18:32:42 +00:00
Add Nethermind integration tests (#3100)
## Proposed Changes Extend the current Geth merge integration tests to support Nethermind.
This commit is contained in:
73
testing/execution_engine_integration/src/build_utils.rs
Normal file
73
testing/execution_engine_integration/src/build_utils.rs
Normal file
@@ -0,0 +1,73 @@
|
||||
use crate::SUPPRESS_LOGS;
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::{Command, Output, Stdio};
|
||||
|
||||
pub fn prepare_dir() -> PathBuf {
|
||||
let manifest_dir: PathBuf = env::var("CARGO_MANIFEST_DIR").unwrap().into();
|
||||
let execution_clients_dir = manifest_dir.join("execution_clients");
|
||||
|
||||
if !execution_clients_dir.exists() {
|
||||
fs::create_dir(&execution_clients_dir).unwrap();
|
||||
}
|
||||
|
||||
execution_clients_dir
|
||||
}
|
||||
|
||||
pub fn clone_repo(repo_dir: &Path, repo_url: &str) -> bool {
|
||||
Command::new("git")
|
||||
.arg("clone")
|
||||
.arg(repo_url)
|
||||
.arg("--recursive")
|
||||
.current_dir(repo_dir)
|
||||
.output()
|
||||
.unwrap_or_else(|_| panic!("failed to clone repo at {}", repo_url))
|
||||
.status
|
||||
.success()
|
||||
}
|
||||
|
||||
pub fn checkout_branch(repo_dir: &Path, branch_name: &str) -> bool {
|
||||
Command::new("git")
|
||||
.arg("checkout")
|
||||
.arg(branch_name)
|
||||
.current_dir(repo_dir)
|
||||
.output()
|
||||
.unwrap_or_else(|_| {
|
||||
panic!(
|
||||
"failed to checkout branch at {:?}/{}",
|
||||
repo_dir, branch_name,
|
||||
)
|
||||
})
|
||||
.status
|
||||
.success()
|
||||
}
|
||||
|
||||
pub fn update_branch(repo_dir: &Path, branch_name: &str) -> bool {
|
||||
Command::new("git")
|
||||
.arg("pull")
|
||||
.current_dir(repo_dir)
|
||||
.output()
|
||||
.unwrap_or_else(|_| panic!("failed to update branch at {:?}/{}", repo_dir, branch_name))
|
||||
.status
|
||||
.success()
|
||||
}
|
||||
|
||||
pub fn check_command_output(output: Output, failure_msg: &'static str) {
|
||||
if !output.status.success() {
|
||||
if !SUPPRESS_LOGS {
|
||||
dbg!(String::from_utf8_lossy(&output.stdout));
|
||||
dbg!(String::from_utf8_lossy(&output.stderr));
|
||||
}
|
||||
panic!("{}", failure_msg);
|
||||
}
|
||||
}
|
||||
|
||||
/// Builds the stdout/stderr handler for commands which might output to the terminal.
|
||||
pub fn build_stdio() -> Stdio {
|
||||
if SUPPRESS_LOGS {
|
||||
Stdio::null()
|
||||
} else {
|
||||
Stdio::inherit()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user