Skip to content

Commit

Permalink
Set HOME env var in test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
dlon committed Oct 7, 2024
1 parent 3b3acab commit 586ec02
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
1 change: 1 addition & 0 deletions test/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions test/scripts/ssh-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ for file in test-runner connection-checker $APP_PACKAGE $PREVIOUS_APP $UI_RUNNER
cp -f "$SCRIPT_DIR/$file" "$RUNNER_DIR"
done

# Unprivileged users need execute rights for connection checker
chmod 551 "${RUNNER_DIR}/connection-checker"
# Unprivileged users need execute rights for some executables
chmod 775 "${RUNNER_DIR}/connection-checker"
chmod 775 "${RUNNER_DIR}/$UI_RUNNER"

chown -R root "$RUNNER_DIR/"

Expand Down
1 change: 1 addition & 0 deletions test/test-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ rust-version.workspace = true
workspace = true

[dependencies]
dirs = "5.0.1"
futures = { workspace = true }
tarpc = { workspace = true }
tokio = { workspace = true }
Expand Down
18 changes: 15 additions & 3 deletions test/test-runner/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,24 @@ impl Service for TestServer {
log::debug!("Exec {} (args: {args:?})", path);

let mut cmd = Command::new(&path);
cmd.stdout(Stdio::piped());
cmd.stderr(Stdio::piped());
cmd.stdin(Stdio::piped());
cmd.args(args);

// Make sure that PATH is updated
// TODO: We currently do not need this on non-Windows
#[cfg(target_os = "windows")]
cmd.env("PATH", sys::get_system_path_var()?);
{
// Make sure that PATH is updated
cmd.env("PATH", sys::get_system_path_var()?);
if let Some(home_dir) = dirs::home_dir() {
cmd.env("USERPROFILE", home_dir);
}
}

#[cfg(unix)]
if let Some(home_dir) = dirs::home_dir() {
cmd.env("HOME", home_dir);
}

cmd.envs(env);

Expand Down

0 comments on commit 586ec02

Please sign in to comment.