Unverified Commit d9736f3d authored by boklm's avatar boklm
Browse files

Make %reports a global variable

This allows to share it between make_reports_index and load_report,
which should avoid loading twice the same report.
parent 7c8f8916
......@@ -24,6 +24,8 @@ BEGIN {
@EXPORT_OK = qw(load_report report_dir report_path save_report);
}
my %reports;
my %template_functions = (
is_test_error => \&TBBTestSuite::Tests::is_test_error,
is_test_warning => \&TBBTestSuite::Tests::is_test_warning,
......@@ -104,7 +106,6 @@ sub make_reports_index {
INCLUDE_PATH => "$FindBin::Bin/tmpl",
OUTPUT_PATH => $options->{'reports-dir'},
);
my %reports;
foreach my $dir (glob "$options->{'reports-dir'}/r/*") {
my $resfile = "$dir/report.yml";
next unless -f $resfile;
......@@ -204,9 +205,10 @@ sub email_report {
sub load_report {
my ($report_name) = @_;
return $reports{$report_name} if exists $reports{$report_name};
my $reportfile = "$options->{'reports-dir'}/r/$report_name/report.yml";
return undef unless -f $reportfile;
return YAML::LoadFile($reportfile);
return $reports{$report_name} = YAML::LoadFile($reportfile);
}
sub report_summary {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment