Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions lib/App/Yath/Command/test.pm
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,9 @@ sub render_final_data {

return if $self->settings->display->quiet > 1;

return $self->_render_final_data_plainly($final_data)
if $self->settings->display->no_final_table;

if (my $rows = $final_data->{retried}) {
print "\nThe following jobs failed at least once:\n";
print join "\n" => table(
Expand Down Expand Up @@ -713,6 +716,72 @@ sub render_final_data {
}
}

sub _render_final_data_plainly {
my $self = shift;
my ($final_data) = @_;

return if $self->settings->display->quiet > 1;

if (my $rows = $final_data->{retried}) {
print "\nThe following jobs failed at least once:\n";
for my $row (@$rows) {
print "- filename: $row->[2]\n";
print " job_id: $row->[0]\n";
print " times_run: $row->[1]\n";
print " succeeded_eventually: $row->[3]\n";
}
}

if (my $rows = $final_data->{failed}) {
print "\nThe following jobs failed:\n";
for my $row (@$rows) {
print "- filename: $row->[1]\n";
print " job_id: $row->[0]\n";
if ($row->[2]) {
print " subtests:\n";
my @paths = _subtest_paths($row->[2]);
print " - $_\n" for @paths;
}
}
}

if (my $rows = $final_data->{halted}) {
print "\nThe following jobs requested all testing be halted:\n";
for my $row (@$rows) {
print "- filename: $row->[1]\n";
print " job_id: $row->[0]\n";
print " reason: $row->[2]\n" if $row->[2];
}
}

if (my $rows = $final_data->{unseen}) {
print "\nThe following jobs never ran:\n";
for my $row (@$rows) {
print "- filename: $row->[1]\n";
print " job_id: $row->[0]\n";
}
}
}

sub _subtest_paths {
my ($map) = @_;

my @paths;
my @todo = @$map;
my @state;
while (my $st = shift @todo) {
if (!ref($st)) {
pop @state if $st eq 'pop';
next;
}
push @state, $st->[0];
push @paths, join(' -> ', @state);
unshift @todo, (@{$st->[1]}, 'pop');
}

return @paths;
}

sub stringify_subtest_map {
my ($map) = @_;

Expand Down
6 changes: 6 additions & 0 deletions lib/App/Yath/Options/Display.pm
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ option_group {prefix => 'display', category => "Display Options"} => sub {
default => 0,
);

option no_final_table => (
type => 'b',
description => "When printing final results, don't use table-style display",
default => 0,
);

option show_times => (
short => 'T',
description => 'Show the timing data for each job',
Expand Down