blob: 92fd45f84600fd3414861c90beaa3af049f8b1cf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
#!/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 => ['@resulttemplatedir@']);
my $content = $xslate->render("html.tmpl", {
results => $results,
task_ids => $task_ids,
});
print encode_utf8($content);
}
if (! defined $ARGV[0] || ! -d $ARGV[0]) {
print STDERR "Please specify correct working directory\n";
exit (1);
}
my $workdir = $ARGV[0];
my $data = [];
my $task_ids = {};
# go through *each* result directory
my $olddir = getcwd;
for (`find "$workdir" -mindepth 1 -maxdepth 1 -type d | sort`) {
chomp;
chdir $_;
my $run_results = {};
$run_results->{dirname} = basename($_);
$run_results->{tasks} = {};
my $glob_result;
my $fdg;
if (not open $fdg, '<', "dtf/result.yml") {
$run_results->{exit_status} = 2;
}
else {
$run_results->{glob} = YAML::Syck::LoadFile($fdg);
$run_results->{exit_status} = $run_results->{glob}->{exit_status};
}
# go through each task
for (`find dtf/tasks -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'";
$run_results->{tasks}->{$task_id} = YAML::Syck::LoadFile($fd);
}
push @{$data}, $run_results;
}
chdir $olddir;
html_printer $data, $task_ids;
|