[pve-devel] [PATCH v3 qemu-server 02/13] tests: add memory tests

Fiona Ebner f.ebner at proxmox.com
Fri Feb 3 14:44:13 CET 2023


Am 02.02.23 um 12:03 schrieb Alexandre Derumier:
> diff --git a/test/run_config2command_tests.pl b/test/run_config2command_tests.pl
> index f097811..dafc3b8 100755
> --- a/test/run_config2command_tests.pl
> +++ b/test/run_config2command_tests.pl
> @@ -178,6 +178,21 @@ $qemu_server_config->mock(
>      },
>  );
>  
> +my $qemu_server_memory;
> +$qemu_server_memory = Test::MockModule->new('PVE::QemuServer::Memory');
> +$qemu_server_memory->mock(
> +    page_chunk => sub {

Turns out you mocking things declared as 'my sub' doesn't work :( So you
need to change the function in Memory.pm into a 'sub'. Sorry I missed
that until now.

> +	return 1;
> +    },
> +    host_numanode_exist => sub {
> +	my ($id) = @_;
> +	return 1;
> +    },
> +    get_host_phys_address_bits => sub {

Same here.

> +	return 46;
> +    }
> +);
> +
>  my $pve_common_tools;
>  $pve_common_tools = Test::MockModule->new('PVE::Tools');
>  $pve_common_tools->mock(





More information about the pve-devel mailing list