| 1 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 3 | package Tapper::Reports::Receiver::Level2::BenchmarkAnything; | ||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # git description: v5.0.3-6-g7c02e97 | ||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | our $AUTHORITY = 'cpan:SCHWIGON'; | |||||||||||||||||||||||||||||||||||||||||||||
| 7 | # ABSTRACT: Tapper - Level2 receiver plugin to forward BenchmarkAnything data | ||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | $Tapper::Reports::Receiver::Level2::BenchmarkAnything::VERSION = '5.0.4'; | |||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Try::Tiny; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use Data::DPath 'dpath'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use Hash::Merge 'merge'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use Scalar::Util 'reftype'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use Tapper::Model 'model'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use Tapper::Config 5.0.2; # 5.0.2 provides {_last_used_tapper_config_file} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||
| 17 | # TAP aggregation metrics per type | ||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | our @boolean_aggregation_metrics = qw(all_passed has_errors has_problems); | |||||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | our @counter_aggregation_metrics = qw(failed parse_errors total passed skipped todo todo_passed); | |||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | our @textual_aggregation_metrics = qw(status); | |||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | ▶ | sub submit { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
submit: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | my ($util, $report, $options) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | my $benchmark_entries_path = $options->{benchmark_entries_path}; | |||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | my $additional_metainfo_path = $options->{additional_metainfo_path}; | |||||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | my $store_metainfo_as_benchmarks = $options->{store_metainfo_as_benchmarks}; | |||||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | my $store_testmetrics_as_benchmarks = $options->{store_testmetrics_as_benchmarks}; | |||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | return unless $benchmark_entries_path; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | try { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=48 SCAR=77.6
| |||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | my $tap_dom = $report->get_cached_tapdom; | |||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||
| 36 | # debug log | ||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | my @test_metrics = (); | |||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | my %test_metrics_aggregated = (); | |||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | for my $section (@{$tap_dom || []}) | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$tap_dom || []
MC/DC0%0/1
$tap_dom || []
$tap_dom
Truth table0%0/2
A
A= $tap_dom
| |||||||||||||||||||||||||||||||||||||||||||||||
| 40 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | foreach my $section_name (keys %{$section->{section} || {}}) # there should be only one, but loop anyway... | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$section->{'section'} || {}
MC/DC0%0/1
$section->{'section'} || {}
$section->{'section'}
Truth table0%0/2
A
A= $section->{'section'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 42 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | $section = $section->{section}{$section_name}; | |||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | my $section_metric_name = $section_name; | |||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | $section_metric_name =~ s/\.t$//; | |||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | $section_metric_name =~ s/\W+/_/g; | |||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | $util->log->debug("section_metric_name: $section_metric_name"); | |||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||
| 50 | # Metric name contemplation: | ||||||||||||||||||||||||||||||||||||||||||||||
| 51 | # -------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 52 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 53 | # There is a decision to make between 1) having | ||||||||||||||||||||||||||||||||||||||||||||||
| 54 | # $section_metric_name as part of the NAME field or 2) having | ||||||||||||||||||||||||||||||||||||||||||||||
| 55 | # generic NAMEs with $section_metric_name as an attribute of | ||||||||||||||||||||||||||||||||||||||||||||||
| 56 | # it. | ||||||||||||||||||||||||||||||||||||||||||||||
| 57 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 58 | # Here we make it part of NAME (option 1). | ||||||||||||||||||||||||||||||||||||||||||||||
| 59 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 60 | # With this it is easier to track a particular test as | ||||||||||||||||||||||||||||||||||||||||||||||
| 61 | # a metric and store expectations for that test with | ||||||||||||||||||||||||||||||||||||||||||||||
| 62 | # test independent attributes but consisting of the | ||||||||||||||||||||||||||||||||||||||||||||||
| 63 | # context in which we measured that metric. That | ||||||||||||||||||||||||||||||||||||||||||||||
| 64 | # "scope", i.e., the fields that we use to match which | ||||||||||||||||||||||||||||||||||||||||||||||
| 65 | # expectation to choose, consists then of that many | ||||||||||||||||||||||||||||||||||||||||||||||
| 66 | # dimensions as we need to describe the context, | ||||||||||||||||||||||||||||||||||||||||||||||
| 67 | # independent of the number of metrics we have. | ||||||||||||||||||||||||||||||||||||||||||||||
| 68 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 69 | # If we had the metric as additional attribute we had | ||||||||||||||||||||||||||||||||||||||||||||||
| 70 | # thousands of scope dimensions to maintain because we | ||||||||||||||||||||||||||||||||||||||||||||||
| 71 | # have thousands of metric names; and we could not | ||||||||||||||||||||||||||||||||||||||||||||||
| 72 | # clearly separate between the test and its context. | ||||||||||||||||||||||||||||||||||||||||||||||
| 73 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 74 | # From a test philosophical perspective, that decision | ||||||||||||||||||||||||||||||||||||||||||||||
| 75 | # sets the focus on the *actual result* we care for, | ||||||||||||||||||||||||||||||||||||||||||||||
| 76 | # instead of some generic detail like "success". | ||||||||||||||||||||||||||||||||||||||||||||||
| 77 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 78 | # From a data performance and complexity perspective, | ||||||||||||||||||||||||||||||||||||||||||||||
| 79 | # I also think that having more metrics, each with | ||||||||||||||||||||||||||||||||||||||||||||||
| 80 | # "normal" amount of describing attributes is better | ||||||||||||||||||||||||||||||||||||||||||||||
| 81 | # distributing the data than having few generic | ||||||||||||||||||||||||||||||||||||||||||||||
| 82 | # metrics with thousands of different describing | ||||||||||||||||||||||||||||||||||||||||||||||
| 83 | # attributes and gazillions of data points per | ||||||||||||||||||||||||||||||||||||||||||||||
| 84 | # metric. Though I'm not an expert here. | ||||||||||||||||||||||||||||||||||||||||||||||
| 85 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | foreach my $entry (@boolean_aggregation_metrics, @counter_aggregation_metrics, @textual_aggregation_metrics) | |||||||||||||||||||||||||||||||||||||||||||||
| 87 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 88 | push @test_metrics, { NAME => "tap.summary.section.${section_metric_name}.${entry}", | ||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | VALUE => $section->{tap}{summary}{$entry}, | |||||||||||||||||||||||||||||||||||||||||||||
| 90 | } if 0; | ||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 92 | # success ratio | ||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | my $section_total = $section->{tap}{summary}{total}; | |||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | my $section_passed = $section->{tap}{summary}{passed}; | |||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | my $section_ratio = sprintf("%.2f", 100 * ($section_total == 0 ? 0 : $section_passed / $section_total)); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | push @test_metrics, { NAME => "tap.summary.section.${section_metric_name}.success_ratio", | |||||||||||||||||||||||||||||||||||||||||||||
| 97 | VALUE => $section_ratio, | ||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } if 0; | ||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||
| 100 | # --- summarize all sections --- | ||||||||||||||||||||||||||||||||||||||||||||||
| 101 | # - bool metrics | ||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | foreach my $entry (@boolean_aggregation_metrics) { | |||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | $test_metrics_aggregated{$entry} ||= $section->{tap}{summary}{$entry}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$test_metrics_aggregated{$entry} ||= $section->{"tap"}{"summary"}{$entry}
MC/DC0%0/2
$test_metrics_aggregated{$entry} ||= $section->{"tap"}{"summary"}{$entry}
$test_metrics_aggregated{$entry}
$section->{"tap"}{"summary"}{$entry}
Truth table0%0/3
A ||= B
A= $test_metrics_aggregated{$entry}B= $section->{"tap"}{"summary"}{$entry}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 105 | # - counter metrics | ||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | foreach my $entry (@counter_aggregation_metrics) { | |||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | $test_metrics_aggregated{$entry} += ($section->{tap}{summary}{$entry} || 0); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$section->{'tap'}{'summary'}{$entry} || 0
MC/DC0%0/1
$section->{'tap'}{'summary'}{$entry} || 0
$section->{'tap'}{'summary'}{$entry}
Truth table0%0/2
A
A= $section->{'tap'}{'summary'}{$entry}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 109 | # - no textual aggregations of "PASS"/"FAIL"/etc. | ||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||
| 113 | # Actual aggregated metrics | ||||||||||||||||||||||||||||||||||||||||||||||
| 114 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 115 | # Note, that with "all.sections" containing a dot and the actual | ||||||||||||||||||||||||||||||||||||||||||||||
| 116 | # metric names above not containing dots there are no collisions | ||||||||||||||||||||||||||||||||||||||||||||||
| 117 | # in NAME. | ||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | my $suite_name = $report->suite->name || "unknown-suite-name"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$report->suite->name || 'unknown-suite-name'
MC/DC0%0/1
$report->suite->name || 'unknown-suite-name'
$report->suite->name
Truth table0%0/2
A
A= $report->suite->name
| |||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | foreach my $entry (@boolean_aggregation_metrics, @counter_aggregation_metrics) { | |||||||||||||||||||||||||||||||||||||||||||||
| 120 | push @test_metrics, { NAME => "tap.summary.suite.${suite_name}.${entry}", | ||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | VALUE => $test_metrics_aggregated{$entry}, | |||||||||||||||||||||||||||||||||||||||||||||
| 122 | } if 0; | ||||||||||||||||||||||||||||||||||||||||||||||
| 123 | push @test_metrics, { NAME => "tap.summary.all.${entry}", # same as general metric but with suitename as additional key | ||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | VALUE => $test_metrics_aggregated{$entry}, | |||||||||||||||||||||||||||||||||||||||||||||
| 125 | tapper_suite_name => $suite_name, | ||||||||||||||||||||||||||||||||||||||||||||||
| 126 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||
| 129 | # success ratios | ||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | my $agg_total = $test_metrics_aggregated{total} || 0; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$test_metrics_aggregated{'total'} || 0
MC/DC0%0/1
$test_metrics_aggregated{'total'} || 0
$test_metrics_aggregated{'total'}
Truth table0%0/2
A
A= $test_metrics_aggregated{'total'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | my $agg_passed = $test_metrics_aggregated{passed}; | |||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | my $agg_ratio = sprintf("%.2f", 100 * ($agg_total == 0 ? 0 : $agg_passed / $agg_total)); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | push @test_metrics, { NAME => "tap.summary.suite.${suite_name}.success_ratio", | |||||||||||||||||||||||||||||||||||||||||||||
| 134 | VALUE => $agg_ratio, | ||||||||||||||||||||||||||||||||||||||||||||||
| 135 | } if 0; | ||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | push @test_metrics, { NAME => "tap.summary.all.success_ratio", # same as general metric but with suitename as additional key | |||||||||||||||||||||||||||||||||||||||||||||
| 137 | VALUE => $agg_ratio, | ||||||||||||||||||||||||||||||||||||||||||||||
| 138 | tapper_suite_name => $suite_name, | ||||||||||||||||||||||||||||||||||||||||||||||
| 139 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||
| 141 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 142 | # You MUST localize Data::Dumper settings to strictly ONLY cover | ||||||||||||||||||||||||||||||||||||||||||||||
| 143 | # the debug output - otherwise it wrongly serializes the tap_dom | ||||||||||||||||||||||||||||||||||||||||||||||
| 144 | # cache into the DB during get_cached_tapdom(). | ||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | local $Data::Dumper::Pair = ":"; | |||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | local $Data::Dumper::Terse = 2; | |||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | local $Data::Dumper::Sortkeys = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | $util->log->debug("test metrics: ".Dumper(\@test_metrics)); | |||||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | my @benchmark_entries = dpath($benchmark_entries_path)->match($tap_dom); | |||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | @benchmark_entries = @{$benchmark_entries[0]} if $benchmark_entries[0] && reftype $benchmark_entries[0] eq "ARRAY"; # deref all array envelops | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$benchmark_entries[0] and builtin::reftype($benchmark_entries[0]) eq "ARRAY"
MC/DC0%0/2
$benchmark_entries[0] and builtin::reftype($benchmark_entries[0]) eq "ARRAY"
$benchmark_entries[0]
builtin::reftype($benchmark_entries[0]) eq "ARRAY"
Truth table0%0/3
A and B
A= $benchmark_entries[0]B= builtin::reftype($benchmark_entries[0]) eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | my @metainfo_entries = (); | |||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | if ($additional_metainfo_path) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 156 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | @metainfo_entries = dpath($additional_metainfo_path)->match($tap_dom); | |||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | @metainfo_entries = @{$metainfo_entries[0]} while $metainfo_entries[0] && reftype $metainfo_entries[0] eq "ARRAY"; # deref all array envelops | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$metainfo_entries[0] and builtin::reftype($metainfo_entries[0]) eq "ARRAY"
MC/DC0%0/2
$metainfo_entries[0] and builtin::reftype($metainfo_entries[0]) eq "ARRAY"
$metainfo_entries[0]
builtin::reftype($metainfo_entries[0]) eq "ARRAY"
Truth table0%0/3
A and B
A= $metainfo_entries[0]B= builtin::reftype($metainfo_entries[0]) eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | return unless @benchmark_entries; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | require BenchmarkAnything::Storage::Frontend::Lib; | |||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | my $balib = BenchmarkAnything::Storage::Frontend::Lib->new(cfgfile => Tapper::Config->subconfig->{_last_used_tapper_config_file}); | |||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | my $benchmark_counter = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | $balib->{queuemode} = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||
| 168 | # Part 1 - actual BenchmarkAnything data points | ||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | foreach my $entry (@benchmark_entries) | |||||||||||||||||||||||||||||||||||||||||||||
| 170 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | if (@metainfo_entries) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 172 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | Hash::Merge::set_behavior('LEFT_PRECEDENT'); | |||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | foreach my $metainfo (@metainfo_entries) | |||||||||||||||||||||||||||||||||||||||||||||
| 175 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 176 | # merge each $metainfo entry into current | ||||||||||||||||||||||||||||||||||||||||||||||
| 177 | # chunk before submitting the chunk | ||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | $entry = merge($entry, $metainfo); | |||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||
| 182 | # additional context info | ||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | $entry->{tapper_report} ||= $report->id; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$entry->{"tapper_report"} ||= $report->id
MC/DC0%0/2
$entry->{"tapper_report"} ||= $report->id
$entry->{"tapper_report"}
$report->id
Truth table0%0/3
A ||= B
A= $entry->{"tapper_report"}B= $report->id
| |||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | ▶ | $entry->{tapper_report_created} ||= $report->created_at->strftime('%F %T'); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$entry->{"tapper_report_created"} ||= $report->created_at->strftime("%F %T")
MC/DC0%0/2
$entry->{"tapper_report_created"} ||= $report->created_at->strftime("%F %T")
$entry->{"tapper_report_created"}
$report->created_at->strftime("%F %T")
Truth table0%0/3
A ||= B
A= $entry->{"tapper_report_created"}B= $report->created_at->strftime("%F %T")
| |||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | $entry->{tapper_testrun} ||= $report->reportgrouptestrun->testrun_id if $report->reportgrouptestrun && $report->reportgrouptestrun->testrun_id; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$report->reportgrouptestrun and $report->reportgrouptestrun->testrun_id
$entry->{"tapper_testrun"} ||= $report->reportgrouptestrun->testrun_id
MC/DC0%0/2
$report->reportgrouptestrun and $report->reportgrouptestrun->testrun_id
$report->reportgrouptestrun
$report->reportgrouptestrun->testrun_id
MC/DC0%0/2
$entry->{"tapper_testrun"} ||= $report->reportgrouptestrun->testrun_id
$entry->{"tapper_testrun"}
$report->reportgrouptestrun->testrun_id
Truth table0%0/3
A and B
A= $report->reportgrouptestrunB= $report->reportgrouptestrun->testrun_id
Truth table0%0/3
A ||= B
A= $entry->{"tapper_testrun"}B= $report->reportgrouptestrun->testrun_id
| |||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | $entry->{tapper_reportgroup_arbitrary} ||= $report->reportgrouparbitrary->arbitrary_id if $report->reportgrouparbitrary && $report->reportgrouparbitrary->arbitrary_id; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$report->reportgrouparbitrary and $report->reportgrouparbitrary->arbitrary_id
$entry->{"tapper_reportgroup_arbitrary"} ||= $report->reportgrouparbitrary->arbitrary_id
MC/DC0%0/2
$report->reportgrouparbitrary and $report->reportgrouparbitrary->arbitrary_id
$report->reportgrouparbitrary
$report->reportgrouparbitrary->arbitrary_id
MC/DC0%0/2
$entry->{"tapper_reportgroup_arbitrary"} ||= $report->reportgrouparbitrary->arbitrary_id
$entry->{"tapper_reportgroup_arbitrary"}
$report->reportgrouparbitrary->arbitrary_id
Truth table0%0/3
A and B
A= $report->reportgrouparbitraryB= $report->reportgrouparbitrary->arbitrary_id
Truth table0%0/3
A ||= B
A= $entry->{"tapper_reportgroup_arbitrary"}B= $report->reportgrouparbitrary->arbitrary_id
| |||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||
| 188 | # mark benchmkars from failed reports (and only them, for space-saving reasons) | ||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | $entry->{tapper_report_success} = ( $agg_ratio < 100 ? 0 : 1) if !defined $entry->{tapper_report_success}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||
| 191 | # debug log | ||||||||||||||||||||||||||||||||||||||||||||||
| 192 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 193 | # You MUST localize Data::Dumper settings to strictly ONLY cover | ||||||||||||||||||||||||||||||||||||||||||||||
| 194 | # the debug output - otherwise it wrongly serializes the tap_dom | ||||||||||||||||||||||||||||||||||||||||||||||
| 195 | # cache into the DB during get_cached_tapdom(). | ||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | local $Data::Dumper::Pair = ":"; | |||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | local $Data::Dumper::Terse = 2; | |||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | local $Data::Dumper::Sortkeys = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | $util->log->debug("store benchmark: ".Dumper($entry)); | |||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||
| 202 | # actually submit data | ||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | $balib->add ({BenchmarkAnythingData => [$entry]}); | |||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | $benchmark_counter++; | |||||||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||
| 207 | # Part 2 - store summary numbers from test/TAP as additional metrics | ||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | ▶ | if ($store_testmetrics_as_benchmarks) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 209 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | foreach my $entry (@test_metrics) | |||||||||||||||||||||||||||||||||||||||||||||
| 211 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | ▶ | if (@metainfo_entries) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 213 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | Hash::Merge::set_behavior('LEFT_PRECEDENT'); | |||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | foreach my $metainfo (@metainfo_entries) | |||||||||||||||||||||||||||||||||||||||||||||
| 216 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 217 | # merge each $metainfo entry into current | ||||||||||||||||||||||||||||||||||||||||||||||
| 218 | # chunk before submitting the chunk | ||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | $entry = merge($entry, $metainfo); | |||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||
| 223 | # additional context info | ||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | ▶ | $entry->{tapper_report} ||= $report->id; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$entry->{"tapper_report"} ||= $report->id
MC/DC0%0/2
$entry->{"tapper_report"} ||= $report->id
$entry->{"tapper_report"}
$report->id
Truth table0%0/3
A ||= B
A= $entry->{"tapper_report"}B= $report->id
| |||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | $entry->{tapper_testrun} ||= $report->reportgrouptestrun->testrun_id if $report->reportgrouptestrun && $report->reportgrouptestrun->testrun_id; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$report->reportgrouptestrun and $report->reportgrouptestrun->testrun_id
$entry->{"tapper_testrun"} ||= $report->reportgrouptestrun->testrun_id
MC/DC0%0/2
$report->reportgrouptestrun and $report->reportgrouptestrun->testrun_id
$report->reportgrouptestrun
$report->reportgrouptestrun->testrun_id
MC/DC0%0/2
$entry->{"tapper_testrun"} ||= $report->reportgrouptestrun->testrun_id
$entry->{"tapper_testrun"}
$report->reportgrouptestrun->testrun_id
Truth table0%0/3
A and B
A= $report->reportgrouptestrunB= $report->reportgrouptestrun->testrun_id
Truth table0%0/3
A ||= B
A= $entry->{"tapper_testrun"}B= $report->reportgrouptestrun->testrun_id
| |||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | ▶ | $entry->{tapper_reportgroup_arbitrary} ||= $report->reportgrouparbitrary->arbitrary_id if $report->reportgrouparbitrary && $report->reportgrouparbitrary->arbitrary_id; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$report->reportgrouparbitrary and $report->reportgrouparbitrary->arbitrary_id
$entry->{"tapper_reportgroup_arbitrary"} ||= $report->reportgrouparbitrary->arbitrary_id
MC/DC0%0/2
$report->reportgrouparbitrary and $report->reportgrouparbitrary->arbitrary_id
$report->reportgrouparbitrary
$report->reportgrouparbitrary->arbitrary_id
MC/DC0%0/2
$entry->{"tapper_reportgroup_arbitrary"} ||= $report->reportgrouparbitrary->arbitrary_id
$entry->{"tapper_reportgroup_arbitrary"}
$report->reportgrouparbitrary->arbitrary_id
Truth table0%0/3
A and B
A= $report->reportgrouparbitraryB= $report->reportgrouparbitrary->arbitrary_id
Truth table0%0/3
A ||= B
A= $entry->{"tapper_reportgroup_arbitrary"}B= $report->reportgrouparbitrary->arbitrary_id
| |||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||
| 228 | # debug log | ||||||||||||||||||||||||||||||||||||||||||||||
| 229 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 230 | # You MUST localize Data::Dumper settings to strictly ONLY cover | ||||||||||||||||||||||||||||||||||||||||||||||
| 231 | # the debug output - otherwise it wrongly serializes the tap_dom | ||||||||||||||||||||||||||||||||||||||||||||||
| 232 | # cache into the DB during get_cached_tapdom(). | ||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | local $Data::Dumper::Pair = ":"; | |||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | local $Data::Dumper::Terse = 2; | |||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | local $Data::Dumper::Sortkeys = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | $util->log->debug("store test metric: ".Dumper($entry)); | |||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||
| 239 | # actually submit data | ||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | $balib->add ({BenchmarkAnythingData => [$entry]}); | |||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | $benchmark_counter++; | |||||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||||||
| 245 | # Part 3 - store metainfo as additional metrics | ||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | ▶ | if ($store_metainfo_as_benchmarks) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 247 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | foreach my $entry (@metainfo_entries) | |||||||||||||||||||||||||||||||||||||||||||||
| 249 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 250 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 251 | # You MUST localize Data::Dumper settings to strictly ONLY cover | ||||||||||||||||||||||||||||||||||||||||||||||
| 252 | # the debug output - otherwise it wrongly serializes the tap_dom | ||||||||||||||||||||||||||||||||||||||||||||||
| 253 | # cache into the DB during get_cached_tapdom(). | ||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | local $Data::Dumper::Pair = ":"; | |||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | local $Data::Dumper::Terse = 2; | |||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | local $Data::Dumper::Sortkeys = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | $util->log->debug("store metainfo: ".Dumper($entry)); | |||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | $balib->add ({BenchmarkAnythingData => [$entry]}); | |||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | $benchmark_counter++; | |||||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||
| 264 | # Remember: the queue needs to be processed separately in *one* | ||||||||||||||||||||||||||||||||||||||||||||||
| 265 | # place! | ||||||||||||||||||||||||||||||||||||||||||||||
| 266 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 267 | # For example by letting the | ||||||||||||||||||||||||||||||||||||||||||||||
| 268 | # benchmarkanything-storage-frontend-http | ||||||||||||||||||||||||||||||||||||||||||||||
| 269 | # daemon run which contains a processing loop. | ||||||||||||||||||||||||||||||||||||||||||||||
| 270 | # Or by activating this code here in the Tapper config. | ||||||||||||||||||||||||||||||||||||||||||||||
| 271 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 272 | # But only do *ONE* of these options! | ||||||||||||||||||||||||||||||||||||||||||||||
| 273 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | if (Tapper::Config->subconfig->{receiver}{level2}{BenchmarkAnything}{process_benchmarkanything_queue}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | $balib->process_raw_result_queue(2 * $benchmark_counter); | |||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | $balib->gc; | |||||||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | $balib->disconnect; | |||||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||||||
| 282 | catch | ||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | $util->log->debug("error: $_"); | |||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | die "receiver:level2:benchmarkanything:error: $_"; | |||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||
| 293 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||