* [PATCH proxmox-perl-rs v2] make: improve library path detection for tests
@ 2026-07-14 13:41 Max R. Carrara
2026-08-05 10:24 ` Elias Huhsovitz
0 siblings, 1 reply; 2+ messages in thread
From: Max R. Carrara @ 2026-07-14 13:41 UTC (permalink / raw)
To: pve-devel
Export LD_LIBRARY_PATH containing the absolute path to the current
Rust target's directory in the top-level Makefile.
This allows the bootstrap machinery in Proxmox::Lib::PVE to find the
compiled .so file when testing and building.
Since it's not needed anymore, remove the `sed` workaround in the
`all` target.
Signed-off-by: Max R. Carrara <m.carrara@proxmox.com>
---
Changes v1 --> v2:
* Use 'improve' instead of 'fix' in the commit message because 'fix'
implies that something was broken, which it wasn't
* Use LD_LIBRARY_PATH instead of PERL5LIB, as the latter didn't
actually work -- was a false positive on my side, as the .so file
installed on my workstation was used
Also, tested this more thoroughly this time around by adding `panic!()`
statements in parts of the resource scheduling source code so that I
could really see that the freshly compiled library is being used.
Checked this for both `make check` and `make deb`, so the built .so file
should always get picked up.
pve-rs/Makefile | 7 +++----
pve-rs/test/Makefile | 2 +-
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/pve-rs/Makefile b/pve-rs/Makefile
index bb1cd2d..c7f2aa4 100644
--- a/pve-rs/Makefile
+++ b/pve-rs/Makefile
@@ -48,6 +48,9 @@ else
TARGET_DIR=debug
endif
+# Used to tell tests where the compiled .so file resides
+export LD_LIBRARY_PATH=$(shell pwd)/target/$(TARGET_DIR)
+
# better way to automate this without a massively annoying cargo-metatdata + jq
# chain that spits out errors?
PROXMOX_DOC_CRATES := \
@@ -75,10 +78,6 @@ PROXMOX_DOC_URL_FLAGS = $(foreach crate,$(PROXMOX_DOC_CRATES),$(call make_rustdo
all: PVE
cargo build $(CARGO_BUILD_ARGS)
- mkdir -p test/Proxmox/Lib
- sed -r -e \
- 's@^sub libfile.*$$@sub libfile { "$(shell pwd)/target/$(TARGET_DIR)/libpve_rs.so"; }@' \
- Proxmox/Lib/PVE.pm >test/Proxmox/Lib/PVE.pm
Proxmox: Proxmox/Lib/PVE.pm
PVE: $(PERLMOD_PACKAGE_FILES)
diff --git a/pve-rs/test/Makefile b/pve-rs/test/Makefile
index 29dc955..2399b86 100644
--- a/pve-rs/test/Makefile
+++ b/pve-rs/test/Makefile
@@ -1,5 +1,5 @@
.PHONY: test
-test: Proxmox/Lib/PVE.pm
+test:
@echo "-- running pve-rs tests --"
perl -I. -I.. -I../.. ./resource_scheduling.pl
--
2.47.3
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH proxmox-perl-rs v2] make: improve library path detection for tests
2026-07-14 13:41 [PATCH proxmox-perl-rs v2] make: improve library path detection for tests Max R. Carrara
@ 2026-08-05 10:24 ` Elias Huhsovitz
0 siblings, 0 replies; 2+ messages in thread
From: Elias Huhsovitz @ 2026-08-05 10:24 UTC (permalink / raw)
To: Max R. Carrara, pve-devel
Nice patch. The less hacky solutions, the better!
2 small nits inline.
On Tue Jul 14, 2026 at 3:41 PM CEST, Max R. Carrara wrote:
> Export LD_LIBRARY_PATH containing the absolute path to the current
> Rust target's directory in the top-level Makefile.
>
> This allows the bootstrap machinery in Proxmox::Lib::PVE to find the
> compiled .so file when testing and building.
>
> Since it's not needed anymore, remove the `sed` workaround in the
> `all` target.
>
> Signed-off-by: Max R. Carrara <m.carrara@proxmox.com>
> ---
> Changes v1 --> v2:
> * Use 'improve' instead of 'fix' in the commit message because 'fix'
> implies that something was broken, which it wasn't
> * Use LD_LIBRARY_PATH instead of PERL5LIB, as the latter didn't
> actually work -- was a false positive on my side, as the .so file
> installed on my workstation was used
>
> Also, tested this more thoroughly this time around by adding `panic!()`
> statements in parts of the resource scheduling source code so that I
> could really see that the freshly compiled library is being used.
> Checked this for both `make check` and `make deb`, so the built .so file
> should always get picked up.
>
> pve-rs/Makefile | 7 +++----
> pve-rs/test/Makefile | 2 +-
> 2 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/pve-rs/Makefile b/pve-rs/Makefile
> index bb1cd2d..c7f2aa4 100644
> --- a/pve-rs/Makefile
> +++ b/pve-rs/Makefile
> @@ -48,6 +48,9 @@ else
> TARGET_DIR=debug
> endif
>
> +# Used to tell tests where the compiled .so file resides
> +export LD_LIBRARY_PATH=$(shell pwd)/target/$(TARGET_DIR)
nit: I would use `$(CURDIR)` instead of `$(shell pwd)`, because it
unaffected by the shell environment.
nit: Why not use `:=` instead of `=`? The values of CURDIR and TARGET
are known and should not change over the course of the Makefile
(unless i missed something).
e.g, I would change it to:
export LD_LIBRARY_PATH:=$(CURDIR)/target/$(TARGET_DIR)
> # better way to automate this without a massively annoying cargo-metatdata + jq
> # chain that spits out errors?
> PROXMOX_DOC_CRATES := \
> @@ -75,10 +78,6 @@ PROXMOX_DOC_URL_FLAGS = $(foreach crate,$(PROXMOX_DOC_CRATES),$(call make_rustdo
>
> all: PVE
> cargo build $(CARGO_BUILD_ARGS)
> - mkdir -p test/Proxmox/Lib
> - sed -r -e \
> - 's@^sub libfile.*$$@sub libfile { "$(shell pwd)/target/$(TARGET_DIR)/libpve_rs.so"; }@' \
> - Proxmox/Lib/PVE.pm >test/Proxmox/Lib/PVE.pm
>
> Proxmox: Proxmox/Lib/PVE.pm
> PVE: $(PERLMOD_PACKAGE_FILES)
> diff --git a/pve-rs/test/Makefile b/pve-rs/test/Makefile
> index 29dc955..2399b86 100644
> --- a/pve-rs/test/Makefile
> +++ b/pve-rs/test/Makefile
> @@ -1,5 +1,5 @@
> .PHONY: test
> -test: Proxmox/Lib/PVE.pm
> +test:
> @echo "-- running pve-rs tests --"
> perl -I. -I.. -I../.. ./resource_scheduling.pl
>
> --
> 2.47.3
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-05 10:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-14 13:41 [PATCH proxmox-perl-rs v2] make: improve library path detection for tests Max R. Carrara
2026-08-05 10:24 ` Elias Huhsovitz
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.