2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-10-21 23:28:19 +00:00
Files
xcat-core/xCAT-test/unit/xcattest_package_modules.t
T
Daniel Hilst 90813ba7d4 test(xcat-core): the Debian xCAT-test package misses xCAT::Test::OS
xcattest loads xCAT::Test::OS from /opt/xcat/lib/perl. xCAT-test.spec
installs it, but xCAT-test/debian/install does not, so xcattest on an
Ubuntu management node dies at startup with "Can't locate
xCAT/Test/OS.pm in @INC".

Check that the RPM spec and the Debian install list both ship every
module under xCAT-test/lib/xCAT. The Debian check fails.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-09-30 20:26:49 -03:00

29 lines
1.1 KiB
Perl

#!/usr/bin/env perl
# The installed xcattest loads the modules under xCAT-test/lib/xCAT from /opt/xcat/lib/perl, so
# both packages must ship each one.
use strict;
use warnings;
use File::Find;
use FindBin;
use lib "$FindBin::Bin/../lib";
use Test::More;
use XCAT::Test::File qw(repo_path slurp_repo_file);
my $lib = repo_path('xCAT-test/lib');
my @modules;
find(sub { push @modules, $File::Find::name =~ s{\A\Q$lib\E/}{}r if /\.pm\z/ }, "$lib/xCAT");
@modules = sort @modules;
ok(@modules, 'xCAT-test ships at least one Perl module to the installed tree');
my $rpm_spec = slurp_repo_file('xCAT-test/xCAT-test.spec');
my $debian_install = slurp_repo_file('xCAT-test/debian/install');
for my $module (@modules) {
(my $dir = $module) =~ s{/[^/]+\z}{};
like($rpm_spec, qr{^cp\s+lib/\Q$module\E\s+\$RPM_BUILD_ROOT/%\{prefix\}/lib/perl/\Q$dir\E/?\s*$}m,
"the RPM installs $module under lib/perl/$dir");
like($debian_install, qr{^lib/\Q$module\E\s+opt/xcat/lib/perl/\Q$dir\E/?\s*$}m,
"the Debian package installs $module under opt/xcat/lib/perl/$dir");
}
done_testing();