From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id D91CB1FF139 for ; Tue, 10 Feb 2026 14:22:09 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 7680B1E8A; Tue, 10 Feb 2026 14:22:54 +0100 (CET) Message-ID: <16e76695-0f35-4b72-aefe-0ae87df1b622@proxmox.com> Date: Tue, 10 Feb 2026 14:22:08 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH qemu-server v3 1/3] tests: improve multiarch build support by introducing local get_host_arch helper To: Dominik Csapak , pve-devel@lists.proxmox.com References: <20260205141959.3615131-1-d.csapak@proxmox.com> <20260205141959.3615131-2-d.csapak@proxmox.com> Content-Language: en-US From: Fiona Ebner In-Reply-To: <20260205141959.3615131-2-d.csapak@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1770729644475 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.015 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment 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: HE2JMIJA55IIGSTY7HF6NTJUNE6QXPSW X-Message-ID-Hash: HE2JMIJA55IIGSTY7HF6NTJUNE6QXPSW X-MailFrom: f.ebner@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: Am 05.02.26 um 3:19 PM schrieb Dominik Csapak: > Since mocking imported functions have to be done for each package that > imports them, we would have to mock get_host_arch for each package that > imports it from PVE::Tools. Instead, introduce one local helper here > that uses the function from PVE::Tools. This allows us to only need to > override it one time. > > Signed-off-by: Dominik Csapak Reviewed-by: Fiona Ebner with two small comments below > @@ -29,6 +30,11 @@ my $arch_to_qemu_binary = { > x86_64 => '/usr/bin/qemu-system-x86_64', > }; > > +# wrapper around the Tools helper, having it here makes it easier for testing To be even clearer: "easier to mock for testing" > +sub get_host_arch { > + return PVE::Tools::get_host_arch(); > +} > + > sub get_command_for_arch($) { > my ($arch) = @_; > return '/usr/bin/kvm' if get_host_arch() eq $arch; # i.e. native arch > diff --git a/src/test/run_config2command_tests.pl b/src/test/run_config2command_tests.pl > index 4c872d1c..c20f2377 100755 > --- a/src/test/run_config2command_tests.pl > +++ b/src/test/run_config2command_tests.pl > @@ -253,9 +253,6 @@ $qemu_server_module->mock( > kernel_has_vhost_net => sub { > return 1; # TODO: make this per-test configurable? > }, > - get_host_arch => sub() { > - return $current_test->{host_arch} // 'x86_64'; > - }, > get_iscsi_initiator_name => sub { > return 'iqn.1993-08.org.debian:01:aabbccddeeff'; > }, > @@ -388,6 +385,9 @@ $pve_common_tools->mock( > }, > ); > }, > + get_host_arch => sub() { Pre-existing from before the move, but I think we should drop the parentheses for consistency with other mocked functions > + return $current_test->{host_arch} // 'x86_64'; > + }, > ); > > my $pve_cpuconfig;