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 A61611FF0E6 for ; Fri, 07 Aug 2026 11:08:14 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id C6518214DF; Fri, 07 Aug 2026 11:08:04 +0200 (CEST) From: "Max R. Carrara" To: pve-devel@lists.proxmox.com Subject: [PATCH proxmox-perl-rs v3] make: improve library path detection for tests Date: Fri, 7 Aug 2026 11:07:53 +0200 Message-ID: <20260807090809.101155-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: 1786093673906 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.811 Adjusted score from AWL reputation of From: address 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_MED -2.3 Sender listed at https://www.dnswl.org/, medium 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: KT75JOTF7QCUWZHXXOMIFEGZEVMLNSGE X-Message-ID-Hash: KT75JOTF7QCUWZHXXOMIFEGZEVMLNSGE 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: v2 --> v3: * Incorporate Elias's feedback (thanks a lot!) and use $(CURDIR) instead of ($shell pwd), as well as immediate assignment (`:=`) instead of lazy assignment (`=`) 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 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..a597589 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 := $(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