mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-09-04 20:17:55 +00:00
test(xCAT-test): cover suffixed mock targets in buildrpms.pl
This commit is contained in:
@@ -71,4 +71,23 @@ like( $buildlocal, qr{^\s*cp /root/rpmbuild/RPMS/riscv64/\* \$CURDIR/build/$}m,
|
||||
my $buildrpms = read_file('buildrpms.pl');
|
||||
like( $buildrpms, qr/forcearch/, 'buildrpms.pl documents the forcearch mock configuration for riscv64 builds' );
|
||||
|
||||
# buildrpms.pl derives the rpm architecture from the mock target name; a suffixed
|
||||
# site config (the riscv64 forcearch one) must still resolve to riscv64.
|
||||
my ($targetarch_sub) = $buildrpms =~ m{^(sub targetarch_from_target \{.*?^\})}ms;
|
||||
ok( $targetarch_sub, 'targetarch_from_target was located in buildrpms.pl' )
|
||||
or BAIL_OUT('buildrpms.pl no longer matches the expected targetarch_from_target shape');
|
||||
{
|
||||
package Test::BuildTarget;
|
||||
our $ARCH = 'x86_64';
|
||||
eval $targetarch_sub; ## no critic (BuiltinFunctions::ProhibitStringyEval)
|
||||
die "Unable to evaluate targetarch_from_target: $@" if $@;
|
||||
}
|
||||
is( Test::BuildTarget::targetarch_from_target('rocky-10-riscv64-xcat'), 'riscv64', 'a suffixed riscv64 forcearch target resolves to riscv64' );
|
||||
is( Test::BuildTarget::targetarch_from_target('rocky-10-riscv64'), 'riscv64', 'the stock riscv64 target resolves to riscv64' );
|
||||
is( Test::BuildTarget::targetarch_from_target('alma+epel-10-ppc64le'), 'ppc64le', 'the ppc64le target still resolves to ppc64le' );
|
||||
is( Test::BuildTarget::targetarch_from_target('alma+epel-10-x86_64'), 'x86_64', 'the x86_64 target still resolves to x86_64' );
|
||||
is( Test::BuildTarget::targetarch_from_target('opensuse-leap-15.6-x86_64'), 'x86_64', 'a dashed distro name still resolves its arch' );
|
||||
is( Test::BuildTarget::targetarch_from_target('custom-target-foo'), 'foo', 'a target without an architecture token keeps the last part' );
|
||||
is( Test::BuildTarget::targetarch_from_target(undef), 'x86_64', 'no target means the host architecture' );
|
||||
|
||||
done_testing();
|
||||
|
||||
Reference in New Issue
Block a user