2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-22 02:12:16 +00:00
Files
xcat-core/xCAT-test/unit/mknb_genesis_compressor.t
T
2026-10-14 13:30:01 -03:00

32 lines
939 B
Perl

#!/usr/bin/env perl
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/../lib";
use lib "$FindBin::Bin/../../perl-xCAT";
use lib "$FindBin::Bin/../../xCAT-server/lib/perl";
use File::Path qw(make_path);
use File::Temp qw(tempdir);
use Test::More;
use XCAT::Test::File qw(repo_path);
my $root = tempdir(CLEANUP => 1);
$ENV{XCATROOT} = repo_path('xCAT-server');
$ENV{XCATCFG} = "$root/config";
make_path($ENV{XCATCFG});
require(repo_path('xCAT-server/lib/xcat/plugins/mknb.pm'));
for my $case (
[1, 1, 'lzma -C crc32 -9'],
[1, 0, 'lzma -C crc32 -9'],
[0, 1, 'xz --format=lzma -C crc32 -9'],
) {
my ($lzma, $xz, $expected) = @$case;
is(xCAT_plugin::mknb::genesis_lzma_command($lzma, $xz), $expected,
"selects the LZMA command with lzma=$lzma xz=$xz");
}
is(xCAT_plugin::mknb::genesis_lzma_command(0, 0), undef,
'no LZMA command is selected when neither compressor is available');
done_testing();