[releng: Generate compact result table. Vladimir Still **20170118125640 Ignore-this: d4be6edb4ec2960d91732fad089bcd3 ] hunk ./releng/functional-report.pl 6 +use File::Basename; hunk ./releng/functional-report.pl 50 -open( my $index, ">", catfile( $out, "index.md" ) ); - -my $summary = ""; - -for my $k ( sort keys %rescount ) { - $summary .= "$rescount{ $k } $k, "; -} -$summary =~ s/, $//; - hunk ./releng/functional-report.pl 71 -print $index <", catfile( $out, "$name.md" ) ); + + my $summary = ""; + + for my $k ( sort keys %rescount ) { + $summary .= "$rescount{ $k } $k, "; + } + $summary =~ s/, $//; + + print $index < + hunk ./releng/functional-report.pl 96 -if ( @flavours > 1 ) { - print $index ""; - for my $f ( @flavours ) { - print $index ""; + if ( @flavours > 1 ) { + print $index ""; + for my $f ( @flavours ) { + print $index ""; + } + print $index "\n"; hunk ./releng/functional-report.pl 103 - print $index "\n"; -} -for my $t ( @tests ) { - print $index ""; - for my $f ( @flavours ) { - my $id = "$f:$t"; - my $report = "${f}_${t}.txt"; - $report =~ s|/|_|g; - my $origreport = "$id.txt"; - $origreport =~ s|/|_|g; - - my $res = $results{ $id }; - $res = "none" unless $res; - print $index ""; - system( "cp", catfile( $dir, $origreport ), catfile( $out, $report ) ); + $printer->( $index ); + + print $index "
$f
$f
$t[$res](./$report)
\n"; + close( $index ); + + system( "pandoc", "--to=html", "-s", "--smart", "--template", catfile( $webdir, "template.html" ), catfile( $out, "$name.md" ), "-o", catfile( $out, "$name.html" ) ); + + $/ = undef; + open( my $ii, "<", catfile( $out, "$name.html" ) ); + my $indexcont = <$ii>; + close( $ii ); + + sub procLink { + my ( $pre, $href, $post ) = @_; + if ( ( $href =~ /^http/ ) || ( $href =~ m|^\./| ) || ( $href =~ m|^/| ) ) { + $href =~ s|^\./|| if ( $href =~ m|^\./| ); + return "$pre$href$post"; + } + else { + return "$pre//$href$post"; + } hunk ./releng/functional-report.pl 125 - print $index "\n"; + + $indexcont =~ s/([<]a[^>]*href=["'])([^"']*)(['"])/procLink( $1, $2, $3 )/gems; + open( my $oi, ">", catfile( $out, "$name.html" ) ); + print $oi $indexcont; + close( $oi ); + hunk ./releng/functional-report.pl 133 -print $index "\n"; -close( $index ); - -system( "pandoc", "--to=html", "-s", "--smart", "--template", catfile( $webdir, "template.html" ), catfile( $out, "index.md" ), "-o", catfile( $out, "index.html" ) ); +doIndex( "full", sub { + my ( $index ) = @_; + + for my $t ( @tests ) { + print $index "$t"; + for my $f ( @flavours ) { + my $id = "$f:$t"; + my $report = "${f}_${t}.txt"; + $report =~ s|/|_|g; + my $origreport = "$id.txt"; + $origreport =~ s|/|_|g; + + my $res = $results{ $id }; + $res = "none" unless $res; + print $index "[$res](./$report)"; + system( "cp", catfile( $dir, $origreport ), catfile( $out, $report ) ); + } + print $index "\n"; + } + } ); + +my %codemap = ( + passed => "✓", + failed => "✗", + warning => "!", + skipped => "–", + started => "…", + timeout => "T", + none => " " + ); +doIndex( "compact", sub { + my ( $compact ) = @_; + + my %agreg; + for my $t ( @tests ) { + for my $f ( @flavours ) { + my $id = "$f:$t"; + my $report = "${f}_${t}.txt"; + $report =~ s|/|_|g; + my $aid = dirname( ${t} ); + $aid = (split( "/", $aid ))[0]; + + my $res = $results{ $id }; + $res = "none" unless $res; + my $r = $res; + $r = $codemap{ $res } if exists $codemap{ $res }; + $agreg{ $aid }->{ $f } = "" unless exists $agreg{ $aid }->{ $f }; + $agreg{ $aid }->{ $f } .= "$r​"; + } + } + for my $t ( sort( keys %agreg ) ) { + print $compact "$t"; + for my $f ( @flavours ) { + print $compact ( "
" . $agreg{ $t }->{ $f } . "
" ); + } + print $compact "\n"; + } + } ); + hunk ./releng/functional-report.pl 193 -# system( "sed", "-i", 's/href="style.css"/href="..\/..\/style.css"/', catfile( $out, "index.html" ) ); - -$/ = undef; -open( my $ii, "<", catfile( $out, "index.html" ) ); -my $indexcont = <$ii>; -close( $ii ); - -sub procLink { - my ( $pre, $href, $post ) = @_; - if ( ( $href =~ /^http/ ) || ( $href =~ m|^\./| ) || ( $href =~ m|^/| ) ) { - $href =~ s|^\./|| if ( $href =~ m|^\./| ); - return "$pre$href$post"; - } - else { - return "$pre//$href$post"; - } -} - -$indexcont =~ s/([<]a[^>]*href=["'])([^"']*)(['"])/procLink( $1, $2, $3 )/gems; -open( my $oi, ">", catfile( $out, "index.html" ) ); -print $oi $indexcont; -close( $oi ); - -print STDERR "file://" . catfile( $out, "index.html" ) . "\n"; + +print STDERR "file://" . catfile( $out, "full.html" ) . "\n"; +print STDERR "file://" . catfile( $out, "compact.html" ) . "\n";