2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-09-11 03:56:25 +00:00
Files
xcat-core/xCAT-test/unit/debian_arch_map.t
T
Vinícius Ferrão 56910729ce test(xCAT-test): drive the mirror choice with the osarch value genimage reads
The mirror assertions passed a Debian architecture straight in and so never
exercised the conversion genimage performs first. They now start from the xCAT
osarch value, which is what let the 32-bit x86 token reach the wrong archive.

Signed-off-by: Vinícius Ferrão <2031761+viniciusferrao@users.noreply.github.com>
2026-09-08 22:01:32 -03:00

62 lines
2.6 KiB
Perl

#!/usr/bin/env perl
use strict;
use warnings;
use FindBin;
use Test::More;
# Debian, xCAT and the kernel each name the same architecture differently. copycd reads the
# name from the media and genimage gives debootstrap the Debian one, so both directions have
# to agree on every architecture xCAT supports.
use lib "$FindBin::Bin/../lib";
use lib "$FindBin::Bin/../../perl-xCAT";
use xCAT::Utils;
# --- what debootstrap and the package lists are given ----------------------
is(xCAT::Utils->debian_arch('x86_64'), 'amd64',
'Debian calls x86_64 amd64');
# genimage passes this value to debootstrap --arch and reads it to pick the apt mirror, and
# debootstrap knows i386, not xCAT's x86.
is(xCAT::Utils->debian_arch('x86'), 'i386',
'debian_arch: the 32-bit x86 token becomes i386');
is(xCAT::Utils->debian_arch('ppc64el'), 'ppc64el',
'the Debian name for POWER LE is unchanged');
is(xCAT::Utils->debian_arch('ppc64le'), 'ppc64le',
'the POWER LE alias is left alone, because only ppc64el reaches the driver table');
is(xCAT::Utils->debian_arch('s390x'), 's390x',
'an architecture Debian names the same is passed through');
is(xCAT::Utils->debian_arch('ppc64'), 'ppc64',
'POWER BE is passed through');
is(xCAT::Utils->debian_arch(undef), undef,
'no architecture resolves to nothing');
# --- what copycd reads from the media --------------------------------------
is(xCAT::Utils->xcat_arch_from_debian('amd64'), 'x86_64',
'amd64 media installs x86_64 nodes');
is(xCAT::Utils->xcat_arch_from_debian('i386'), 'x86',
'i386 media installs x86 nodes');
is(xCAT::Utils->xcat_arch_from_debian('i686'), 'x86',
'every 32-bit x86 spelling installs x86 nodes');
is(xCAT::Utils->xcat_arch_from_debian('ppc64el'), 'ppc64el',
'POWER LE media keeps the Debian name xCAT uses for Ubuntu');
is(xCAT::Utils->xcat_arch_from_debian('powerpc'), 'ppc64',
'POWER BE media installs ppc64 nodes');
is(xCAT::Utils->xcat_arch_from_debian('riscv64'), 'riscv64',
'riscv64 media installs riscv64 nodes');
is(xCAT::Utils->debian_arch('riscv64'), 'riscv64',
'Debian and xCAT agree on the riscv64 name');
is(xCAT::Utils->xcat_arch_from_debian('nonesuch'), undef,
'media xCAT has no name for resolves to nothing');
is(xCAT::Utils->xcat_arch_from_debian(''), undef,
'media with no architecture resolves to nothing');
# --- the two directions agree ----------------------------------------------
foreach my $arch (qw(x86_64 ppc64el)) {
is(xCAT::Utils->xcat_arch_from_debian(xCAT::Utils->debian_arch($arch)), $arch,
"$arch survives a round trip through both directions");
}
done_testing();