2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-09-21 16:39:30 +00:00
Files
xcat-core/xCAT-test/unit/debian_control_arch_coverage.t
T
Daniel Hilst f7d52f94ec test(xcat-core): capture the Debian control files excluding riscv64
Installing xCAT on a riscv64 Ubuntu management node fails before it starts:

  E: Unable to locate package xcat
  E: Unable to locate package xcat-test

xCAT/debian/control and xCATsn/debian/control name their architectures
explicitly, as "amd64 ppc64el". riscv64 is absent, so no riscv64 deb is ever
produced and apt has nothing to install -- while the rest of the tree already
carries riscv64 install templates, DHCP boot policy, mknb support and a Genesis
machine configuration.

The test reads both control files and asserts the explicit list covers every
Debian architecture xCAT ships. It fails on both files today.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
(cherry picked from commit 059c23486d8f15e8a0a224ef7dfe05cd7fe123a4)
2026-09-04 12:20:34 -03:00

41 lines
1.5 KiB
Perl

#!/usr/bin/env perl
# xCAT and xCATsn name their Debian architectures explicitly. An architecture missing from that
# list is not a build failure -- it is a package that never exists: apt on that architecture says
#
# E: Unable to locate package xcat
#
# and the management node cannot be installed at all. riscv64 was missing while the rest of the
# tree already carried riscv64 install templates, DHCP boot policy and a Genesis machine config.
#
# The list is compared against the architectures the DEB build itself supports, taken from
# build-utils/lib/XCAT/BuildUtils or, failing that, the documented set.
use strict;
use warnings;
use FindBin;
use Test::More;
my $root = "$FindBin::Bin/../..";
# The Debian architectures xCAT ships. dpkg names, not rpm ones.
my @arches = qw(amd64 ppc64el riscv64);
my @controls = grep { -f } ("$root/xCAT/debian/control", "$root/xCATsn/debian/control");
plan skip_all => 'no Debian control files in this tree' unless @controls;
for my $ctl (@controls) {
open my $fh, '<', $ctl or die "read $ctl: $!";
local $/; my $text = <$fh>; close $fh;
(my $short = $ctl) =~ s{^\Q$root\E/}{};
my @lines = ($text =~ /^Architecture:\s*(.+)$/mg);
my @explicit = grep { !/^(?:any|all)$/ } map { s/^\s+|\s+$//gr } @lines;
ok(scalar(@explicit), "$short names architectures explicitly") or next;
for my $line (@explicit) {
my %have = map { $_ => 1 } split /\s+/, $line;
my @missing = grep { !$have{$_} } @arches;
is_deeply(\@missing, [], "$short covers @arches");
}
}
done_testing();