all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH proxmox-perl-rs v1] make: fix library path detection for tests
@ 2026-06-26 14:31 Max R. Carrara
  2026-06-29 11:01 ` Max R. Carrara
  0 siblings, 1 reply; 2+ messages in thread
From: Max R. Carrara @ 2026-06-26 14:31 UTC (permalink / raw)
  To: pve-devel

Export a new variable containing the absolute path to the current
Rust target's directory and pass it to PERL5LIB [0] in the tests'
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.

[0] https://perldoc.perl.org/perlrun#PERL5LIB

Signed-off-by: Max R. Carrara <m.carrara@proxmox.com>
---
 pve-rs/Makefile      | 7 +++----
 pve-rs/test/Makefile | 4 +++-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/pve-rs/Makefile b/pve-rs/Makefile
index bb1cd2d..caeb248 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 TEST_LIB_DIR=$(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..5d27c96 100644
--- a/pve-rs/test/Makefile
+++ b/pve-rs/test/Makefile
@@ -1,5 +1,7 @@
+export PERL5LIB=$(TEST_LIB_DIR)
+
 .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 v1] make: fix library path detection for tests
  2026-06-26 14:31 [PATCH proxmox-perl-rs v1] make: fix library path detection for tests Max R. Carrara
@ 2026-06-29 11:01 ` Max R. Carrara
  0 siblings, 0 replies; 2+ messages in thread
From: Max R. Carrara @ 2026-06-29 11:01 UTC (permalink / raw)
  To: Max R. Carrara, pve-devel

On Fri Jun 26, 2026 at 4:31 PM CEST, Max R. Carrara wrote:
> Export a new variable containing the absolute path to the current
> Rust target's directory and pass it to PERL5LIB [0] in the tests'
> Makefile.
>
> [...]

Nevermind, scratch this -- ran into a false positive here. It's loading
the path from my installation, not the built version.

Sorry for the noise; will rework this!




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-29 11:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-26 14:31 [PATCH proxmox-perl-rs v1] make: fix library path detection for tests Max R. Carrara
2026-06-29 11:01 ` Max R. Carrara

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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal