Skip to content

Commit

Permalink
fix(qemu): unexpected no such file or directory for qemu scripts
Browse files Browse the repository at this point in the history
- append variable working directory before the script path
  • Loading branch information
255doesnotexist committed Dec 8, 2024
1 parent 8e08f13 commit 52266c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ fn run_tests(distros: &[&str], packages: &[&str], skip_successful: bool, dir: &P
let run_locally = distro_config.testing_type == "locally";
let via_boardtest = distro_config.testing_type == "boardtest";
let purely_remote = distro_config.testing_type != "qemu-based-remote";
let testenv_manager = crate::testenv_manager::TestEnvManager::new(&distro_config);
let testenv_manager = crate::testenv_manager::TestEnvManager::new(&distro_config, &dir);

info!(
"Connection method: {}",
Expand Down
7 changes: 5 additions & 2 deletions src/testenv_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
use crate::config::{connection_config::ConnectionConfig, distro_config::DistroConfig};
use log::info;
use std::io::Error;
use std::path::Path;
use std::process::Command;

/// Manages the test environment for a distribution.
Expand All @@ -12,6 +13,7 @@ pub struct TestEnvManager {
startup_script: String,
stop_script: String,
connection: Option<ConnectionConfig>,
dir: std::path::PathBuf,
}

impl TestEnvManager {
Expand All @@ -24,11 +26,12 @@ impl TestEnvManager {
/// # Returns
///
/// A new `TestEnvManager` instance initialized with the provided configuration.
pub fn new(config: &DistroConfig) -> Self {
pub fn new(config: &DistroConfig, dir: &Path) -> Self {
TestEnvManager {
startup_script: config.startup_script.clone(),
stop_script: config.stop_script.clone(),
connection: config.connection.clone(),
dir: dir.to_path_buf(),
}
}

Expand All @@ -49,7 +52,7 @@ impl TestEnvManager {
let connection_unwrapped = self.connection.clone().unwrap();

let mut cmd = Command::new("bash");
cmd.arg(script)
cmd.arg(self.dir.join(script).to_str().unwrap())
.env_remove("USER")
.env_remove("PASSWORD")
.env_remove("ADDRESS")
Expand Down

0 comments on commit 52266c0

Please sign in to comment.