Stat-ing /dev/null worked, because the check in the blockdev module is for block and character devices and then decides based on the 'media=cdrom' flag whether to use the host_cdrom or host_device driver. But the result should actually be mocked to represent a block device rather than a character device.
Signed-off-by: Fiona Ebner <f.eb...@proxmox.com> --- New in v2. src/test/run_config2command_tests.pl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/test/run_config2command_tests.pl b/src/test/run_config2command_tests.pl index 7156c2e9..0623b5c1 100755 --- a/src/test/run_config2command_tests.pl +++ b/src/test/run_config2command_tests.pl @@ -317,11 +317,9 @@ my $file_stat_module = Test::MockModule->new("File::stat"); $file_stat_module->mock( stat => sub { my ($path) = @_; - if ($path =~ m!/dev/!) { - return $file_stat_module->original('stat')->('/dev/null'); - } else { - return $file_stat_module->original('stat')->('./run_config2command_tests.pl'); - } + my $st = $file_stat_module->original('stat')->('./run_config2command_tests.pl'); + $st->[2] = 25008 if $path =~ m!/dev/!; # block device + return $st; }, ); -- 2.47.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel