mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-10-21 23:28:19 +00:00
052d2d5fbe
Master added a workflow and several tests after this branch renamed xCAT-genesis-builder to xCAT-genesis-base. They still name files under xCAT-genesis-builder/, which no longer exists, so they fail or read nothing. The OpenEmbedded workflow, six bats files and four unit tests now use the new paths. Two of those unit tests could reach the code only as shell. genesis_ubuntu_build_root.t cut the package list out of builddeb-genesis-base and evaluated it through bash. genesis_payload_verification.t ran the bash verifier and parsed its stderr. XCAT::GenesisBuildRoot::required_packages() now returns the build-root package list, and builddeb-genesis-base calls it. XCAT::GenesisPayload holds the mandatory-command list and the payload check, and verify-genesis-payload runs its main() with the same arguments, exit codes and messages. stage_genesis_base_sources() stages the module beside the script. Both modules use core Perl only. The two tests now call these functions with chosen inputs and assert the exact results. genesis_base_sources_staged.t expects the module in the staged tarball. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
43 lines
1.7 KiB
Perl
43 lines
1.7 KiB
Perl
#!/usr/bin/env perl
|
|
# The genesis spec is the build root manifest: what it does not build-require, the buildroot
|
|
# only holds by accident, and dracut_install then installs nothing.
|
|
use strict;
|
|
use warnings;
|
|
|
|
use FindBin;
|
|
use lib "$FindBin::Bin/../lib";
|
|
use Test::More;
|
|
|
|
use XCAT::Test::File qw(repo_path slurp_repo_file);
|
|
|
|
my $relative = 'xCAT-genesis-base/xCAT-genesis-base.spec';
|
|
plan skip_all => "$relative not found" unless -f repo_path($relative);
|
|
plan tests => 4;
|
|
|
|
my @lines = split /\n/, slurp_repo_file($relative);
|
|
|
|
# getcert, getdestiny, getipmi and getadapter all run the openssl command. el8 and el9
|
|
# held it in the buildroot as a dependency of something else; el10 does not.
|
|
my @openssl = grep { /^BuildRequires:\s*openssl\s*$/ } @lines;
|
|
is(scalar(@openssl), 1, 'the spec build-requires openssl');
|
|
|
|
my ($buildarch) = grep { $lines[$_] =~ /^BuildArch:\s*noarch/ } 0 .. $#lines;
|
|
ok(defined $buildarch, 'the spec sets BuildArch: noarch');
|
|
|
|
# rpm reads the spec a second time with the target set to noarch, so %{_target_cpu} is
|
|
# "noarch" from BuildArch onwards. %{tarch} keeps the real architecture.
|
|
my @late_target_cpu = grep { $lines[$_] =~ /_target_cpu/ } ($buildarch + 1) .. $#lines;
|
|
is(scalar(@late_target_cpu), 0,
|
|
'%{_target_cpu} is not read after BuildArch: noarch')
|
|
or diag(join "\n", map { ($_ + 1) . ": $lines[$_]" } @late_target_cpu);
|
|
|
|
my ($openssl_line) = grep { $lines[$_] =~ /^BuildRequires:\s*openssl\s*$/ } 0 .. $#lines;
|
|
my $guarded = 0;
|
|
if (defined $openssl_line) {
|
|
for my $i (reverse 0 .. $openssl_line - 1) {
|
|
last if $lines[$i] =~ /^%endif/;
|
|
$guarded = 1, last if $lines[$i] =~ /^%if/;
|
|
}
|
|
}
|
|
is($guarded, 0, 'openssl is build-required on every release');
|