From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 122431FF0E4 for ; Tue, 14 Jul 2026 15:41:45 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 29BD5213E7; Tue, 14 Jul 2026 15:41:44 +0200 (CEST) From: "Max R. Carrara" To: pve-devel@lists.proxmox.com Subject: [PATCH proxmox-perl-rs v2] make: improve library path detection for tests Date: Tue, 14 Jul 2026 15:41:03 +0200 Message-ID: <20260714134110.335651-1-m.carrara@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1784036454153 X-SPAM-LEVEL: Spam detection results: 0 DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_LOW -0.7 Sender listed at https://www.dnswl.org/, low trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: VEQ7LT4KJOU3J2NSQHDBDB3LPOLFPV5R X-Message-ID-Hash: VEQ7LT4KJOU3J2NSQHDBDB3LPOLFPV5R X-MailFrom: m.carrara@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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