From a80dcfa5444d257dd7bd1d8875755d3c5e7500ca Mon Sep 17 00:00:00 2001 From: Gleb Novikov Date: Mon, 6 Jan 2025 17:57:08 +0000 Subject: [PATCH] Capture LD_LIBRARY_PATH from pytest env --- compute_tools/src/bin/fast_import.rs | 3 +++ test_runner/fixtures/fast_import.py | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/compute_tools/src/bin/fast_import.rs b/compute_tools/src/bin/fast_import.rs index 2bdf30325e..aba6a347aa 100644 --- a/compute_tools/src/bin/fast_import.rs +++ b/compute_tools/src/bin/fast_import.rs @@ -226,6 +226,7 @@ pub(crate) async fn main() -> anyhow::Result<()> { ), ]) .env_clear() + .env("LD_LIBRARY_PATH", &pg_lib_dir) .stdout(std::process::Stdio::piped()) .stderr(std::process::Stdio::piped()) .spawn() @@ -302,6 +303,7 @@ pub(crate) async fn main() -> anyhow::Result<()> { .arg(&source_connection_string) // how we run it .env_clear() + .env("LD_LIBRARY_PATH", &pg_lib_dir) .kill_on_drop(true) .stdout(std::process::Stdio::piped()) .stderr(std::process::Stdio::piped()) @@ -335,6 +337,7 @@ pub(crate) async fn main() -> anyhow::Result<()> { .arg(&dumpdir) // how we run it .env_clear() + .env("LD_LIBRARY_PATH", &pg_lib_dir) .kill_on_drop(true) .stdout(std::process::Stdio::piped()) .stderr(std::process::Stdio::piped()) diff --git a/test_runner/fixtures/fast_import.py b/test_runner/fixtures/fast_import.py index 4784e493a3..33248132ab 100644 --- a/test_runner/fixtures/fast_import.py +++ b/test_runner/fixtures/fast_import.py @@ -1,3 +1,4 @@ +import os import shutil import subprocess import tempfile @@ -39,7 +40,10 @@ class FastImport(AbstractNeonCli): if not (self.pg_bin / "postgres").exists(): raise Exception(f"postgres binary was not found at '{self.pg_bin}'") self.pg_lib = pg_dir / "lib" - + if env_vars.get("LD_LIBRARY_PATH") is not None: + self.pg_lib = Path(env_vars["LD_LIBRARY_PATH"]) + elif os.getenv("LD_LIBRARY_PATH") is not None: + self.pg_lib = Path(str(os.getenv("LD_LIBRARY_PATH"))) if not workdir.exists(): raise Exception(f"Working directory '{workdir}' does not exist") self.workdir = workdir