2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-09-21 08:33:20 +00:00

fix(xcat-core): allow naming cases whose output survives a pass

run_fast_regression_test() prints a case's output only when it fails.
For 250 cases that is the right default, but it leaves no way to tell
whether a passing case did real work or skipped everything. That is not
academic for cases wrapping prove: prove exits 0 both when tests pass
and when every test skips, so integration_tests reports green either
way and the log cannot distinguish them.

Add @verbose_cases. A case named there has its output printed on a pass
as well, and the failure branch no longer prints a second copy. Seed it
with integration_tests to find out which of the three integration tests
actually run on a runner -- in particular whether
dhcp_kea_config_validation.t validates from /etc/kea now that the case
runs as root, or still skips. Emptying the list restores the previous
behaviour exactly.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-07-23 12:12:12 -03:00
parent 764e667e0a
commit 53e2b0bd7b
+14 -2
View File
@@ -39,6 +39,14 @@ my $GITHUB_API = "https://api.github.com";
my $srcdir = getcwd();
my $unitsrc = ($ENV{'RUNNER_TEMP'} ? $ENV{'RUNNER_TEMP'} : "/tmp") . "/xcat-core-unitsrc";
# Cases whose output is printed even when they pass. A passing case is normally
# silent, which is the right default for 250 of them but makes it impossible to
# tell from the log whether a case did real work or skipped everything -- a
# distinction that matters for cases wrapping prove, since prove exits 0 either
# way. Name a case here to see its output; empty the list for the quiet
# behaviour.
my @verbose_cases = qw(integration_tests);
#--------------------------------------------------------
# Fuction name: runcmd
# Description: run a command after 'cmd' label in one case
@@ -560,12 +568,16 @@ sub run_fast_regression_test{
$cmd = "sudo bash -c '. /etc/profile.d/xcat.sh && xcattest -f $conf_file -t $case'";
print "[run_fast_regression_test] run $x: $cmd\n";
@output = runcmd("$cmd");
#print Dumper \@output;
my $verbose = grep { $_ eq $case } @verbose_cases;
if($verbose){
print "[run_fast_regression_test] output of $case (listed in \@verbose_cases):\n";
print Dumper \@output;
}
for(my $i = $#output; $i>-1; --$i){
if($output[$i] =~ /------END::(.+)::Failed/){
push @failcase, $1;
++$failnum;
print Dumper \@output;
print Dumper \@output unless($verbose);
last;
}elsif ($output[$i] =~ /------END::(.+)::Passed/){
++$passnum;