mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-11-22 10:22:18 +00:00
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>
This commit is contained in:
@@ -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: $!");
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user