From 687d2c15a6ef94a80e67f2cb32c6bdeba4f23e88 Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Wed, 21 Oct 2026 16:37:04 -0300 Subject: [PATCH] test(xcattest): the harness tests stage one module by name xcattest_report_every_check.t and autotest_check_lines_are_understood.t copy xcattest into a scratch tree and run it. Each copied xCAT/Test/OS.pm by name, so a second module under xCAT-test/lib/xCAT stops the copied xcattest before its first case, and the test reports that as a harness error. Both now copy every .pm under that directory. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- xCAT-test/unit/autotest_check_lines_are_understood.t | 9 +++++++-- xCAT-test/unit/xcattest_report_every_check.t | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/xCAT-test/unit/autotest_check_lines_are_understood.t b/xCAT-test/unit/autotest_check_lines_are_understood.t index 40b6ea3175..5d7a278a64 100644 --- a/xCAT-test/unit/autotest_check_lines_are_understood.t +++ b/xCAT-test/unit/autotest_check_lines_are_understood.t @@ -3,6 +3,7 @@ use strict; use warnings; use File::Copy qw(copy); +use File::Basename qw(basename); use File::Find qw(find); use File::Path qw(make_path); use File::Temp qw(tempdir); @@ -57,8 +58,12 @@ my $root = tempdir(CLEANUP => 1); make_path("$root/bin", "$root/cases", "$root/lib/perl/xCAT/Test"); copy($program, "$root/bin/xcattest") or die("copy xcattest: $!"); chmod 0755, "$root/bin/xcattest"; -copy("$FindBin::Bin/../lib/xCAT/Test/OS.pm", "$root/lib/perl/xCAT/Test/OS.pm") - or die("copy xCAT/Test/OS.pm: $!"); +# Every module under xCAT-test/lib/xCAT, because xcattest loads them from lib/perl beside its +# own directory and a missing one stops it before the first case. +foreach my $module (glob("$FindBin::Bin/../lib/xCAT/Test/*.pm")) { + my $name = basename($module); + copy($module, "$root/lib/perl/xCAT/Test/$name") or die("copy xCAT/Test/$name: $!"); +} open(my $fixture_fh, '>', "$root/cases/fixture") or die("write the fixture case: $!"); print $fixture_fh $fixture; close($fixture_fh) or die("close the fixture case: $!"); diff --git a/xCAT-test/unit/xcattest_report_every_check.t b/xCAT-test/unit/xcattest_report_every_check.t index 44372e9f4e..69336fcc71 100644 --- a/xCAT-test/unit/xcattest_report_every_check.t +++ b/xCAT-test/unit/xcattest_report_every_check.t @@ -4,6 +4,7 @@ use warnings; use FindBin; use File::Copy qw(copy); +use File::Basename qw(basename); use File::Path qw(make_path); use File::Temp qw(tempdir); use Test::More; @@ -31,8 +32,12 @@ sub run_harness { make_path("$root/bin", "$root/cases", "$root/lib/perl/xCAT/Test"); copy($program, "$root/bin/xcattest") or die("copy xcattest: $!"); chmod 0755, "$root/bin/xcattest"; - copy("$FindBin::Bin/../lib/xCAT/Test/OS.pm", "$root/lib/perl/xCAT/Test/OS.pm") - or die("copy xCAT/Test/OS.pm: $!"); + # Every module under xCAT-test/lib/xCAT, because xcattest loads them from lib/perl beside + # its own directory and a missing one stops it before the first case. + foreach my $module (glob("$FindBin::Bin/../lib/xCAT/Test/*.pm")) { + my $name = basename($module); + copy($module, "$root/lib/perl/xCAT/Test/$name") or die("copy xCAT/Test/$name: $!"); + } open(my $case_fh, '>', "$root/cases/fixture") or die("write the fixture case: $!"); print $case_fh $case_text;