diff options
| author | Pavel Raiskup <praiskup@redhat.com> | 2014-10-12 14:57:20 +0200 |
|---|---|---|
| committer | Pavel Raiskup <praiskup@redhat.com> | 2014-10-12 15:42:56 +0200 |
| commit | fc3af983f7a74a74b332c2e99b76759e6b4e4374 (patch) | |
| tree | 768a681364ed69bac1d6503f13c2289cb5346695 /runner | |
| parent | 8957b4e9296777fedf44ee0e71431763b38c2f2a (diff) | |
| download | postgresql-setup-tests-fc3af983f7a74a74b332c2e99b76759e6b4e4374.tar.gz postgresql-setup-tests-fc3af983f7a74a74b332c2e99b76759e6b4e4374.tar.xz postgresql-setup-tests-fc3af983f7a74a74b332c2e99b76759e6b4e4374.zip | |
controller: create
Controller script runs the script on remote machine (OpenStack),
downloads the results, stores the result into its own
result-database and re-generates statistics for runs done so far.
It will be able to upload the results to "presenter" machine.
* config.sh.template: New doc file.
* controller: New file (the central script for CI).
* runner/result_stats: New file. Based on downloaded results from
testing machine, it generates single html file with stats.
* runner/result_templates/html.tmpl: New file. Template for ^^^.
Diffstat (limited to 'runner')
| -rwxr-xr-x | runner/result_stats | 74 | ||||
| -rw-r--r-- | runner/result_templates/html.tmpl | 40 |
2 files changed, 114 insertions, 0 deletions
diff --git a/runner/result_stats b/runner/result_stats new file mode 100755 index 0000000..a92d6d6 --- /dev/null +++ b/runner/result_stats @@ -0,0 +1,74 @@ +#!/bin/perl + +use strict; +use warnings; +use utf8; + +use Data::Dumper; +use File::Basename; +use Cwd; +use Encode 'encode_utf8'; + +# teplates +use Text::Xslate; + +# yaml (quick) parser +use YAML::Syck; + +our $srcdir = dirname(__FILE__); + +sub html_printer +{ + my $results = $_[0]; + my $task_ids = $_[1]; + + my $xslate = Text::Xslate->new(path => ["$srcdir/result_templates"]); + + my $content = $xslate->render("html.tmpl", { + results => $results, + task_ids => $task_ids, + }); + print encode_utf8($content); +} + +my $workdir = $ARGV[0]; + +my $data = []; + +my $task_ids = {}; + +# go through *each* result directory +my $olddir = getcwd; +for (`find "$workdir" -maxdepth 1 -type d -name 'result_*'`) { + chomp; + chdir $_; + + my $run_results = {}; + $run_results->{dirname} = basename($_); + $run_results->{tasks} = {}; + $run_results->{exit_status} = 0; + + # go through each task + for (`find -maxdepth 1 -type f -name '*.result'`) { + chomp; + + (my $task_id = $_) =~ s/\.result$//; + $task_id =~ s/.*\///; + $task_ids->{$task_id} = 1; + + my $yaml_file = $_; + open my $fd, '<', $yaml_file + or die "can't open yaml file '$yaml_file'"; + + my $config = YAML::Syck::LoadFile($fd); + if ($config->{exit_status} != 0) { + $run_results->{exit_status} = 1; + } + $run_results->{tasks}->{$task_id} = $config; + } + + push @{$data}, $run_results; +} +chdir $olddir; + +html_printer $data, $task_ids; diff --git a/runner/result_templates/html.tmpl b/runner/result_templates/html.tmpl new file mode 100644 index 0000000..14696c2 --- /dev/null +++ b/runner/result_templates/html.tmpl @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="UTF-8" /> +<meta name="keywords" content="" /> +<title>Results</title> +<link href="https://praiskup.fedorapeople.org/staticdata/patternfly-1.1/css/patternfly.css" rel="stylesheet" media="screen, print"> +</head> +<body> +<div class="table-responsive"> +<table class="table table-condensed table-hover"> +<thead> + <tr> + <th>Run time</th> +: for $task_ids.keys() -> $task_id { + <th><: $task_id :></th> +: } + </tr> +</thead><tbody> +: for $results -> $result { + : if ($result.exit_status) { + <tr class="danger"> + : } else { + <tr> + : } + <td><: $result.dirname :></td> + : for $task_ids.keys() -> $task_id { + : if $result.tasks[$task_id].exit_status == 0 { + <td>OK</td> + : } else { + <td class="danger">FAIL</td> + : } + : } + <tr> +:} +</tbody> +</table> +</div> +</body> +</html> |
