Skip to content

Commit

Permalink
pts-core: Allow the test result definitions to indicate less importan…
Browse files Browse the repository at this point in the history
…t metrics
  • Loading branch information
michaellarabel committed Jun 25, 2022
1 parent 36de1c9 commit 6ebfe5a
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 6 deletions.
3 changes: 2 additions & 1 deletion pts-core/objects/pts_test_profile.php
Expand Up @@ -611,7 +611,8 @@ public function get_results_definition($limit = null)
$dob = isset($i->DeleteOutputBefore) ? $i->DeleteOutputBefore->__toString() : null;
$doa = isset($i->DeleteOutputAfter) ? $i->DeleteOutputAfter->__toString() : null;
$df = isset($i->DisplayFormat) ? $i->DisplayFormat->__toString() : null;
$results_definition->add_result_parser_definition($ot, $mtta, $rk, $lh, $lbh, $lah, $rbs, $ras, $sfr, $srp, $mm, $drb, $mrb, $rs, $rpro, $rpre, $ad, $atad, $ff, $tcts, $dob, $doa, $df, $drd);
$ri = isset($i->Importance) ? $i->Importance->__toString() : null;
$results_definition->add_result_parser_definition($ot, $mtta, $rk, $lh, $lbh, $lah, $rbs, $ras, $sfr, $srp, $mm, $drb, $mrb, $rs, $rpro, $rpre, $ad, $atad, $ff, $tcts, $dob, $doa, $df, $drd, $ri);
}
}
}
Expand Down
12 changes: 9 additions & 3 deletions pts-core/objects/pts_test_profile_results_definition.php
Expand Up @@ -58,9 +58,9 @@ public function get_image_parser_definitions()
{
return $this->image_parsers;
}
public function add_result_parser_definition($ot, $mtta, $rk, $lh, $lbh, $lah, $rbs, $ras, $sfr, $srp, $mm, $drb, $mrb, $rs, $rpro, $rpre, $ad, $atad, $ff, $tcts, $dob, $doa, $df, $drd)
public function add_result_parser_definition($ot, $mtta, $rk, $lh, $lbh, $lah, $rbs, $ras, $sfr, $srp, $mm, $drb, $mrb, $rs, $rpro, $rpre, $ad, $atad, $ff, $tcts, $dob, $doa, $df, $drd, $ri)
{
$this->result_parsers[] = new pts_test_profile_results_definition_result_parser($ot, $mtta, $rk, $lh, $lbh, $lah, $rbs, $ras, $sfr, $srp, $mm, $drb, $mrb, $rs, $rpro, $rpre, $ad, $atad, $ff, $tcts, $dob, $doa, $df, $drd);
$this->result_parsers[] = new pts_test_profile_results_definition_result_parser($ot, $mtta, $rk, $lh, $lbh, $lah, $rbs, $ras, $sfr, $srp, $mm, $drb, $mrb, $rs, $rpro, $rpre, $ad, $atad, $ff, $tcts, $dob, $doa, $df, $drd, $ri);
}
public function get_result_parser_definitions()
{
Expand Down Expand Up @@ -174,8 +174,9 @@ class pts_test_profile_results_definition_result_parser
private $delete_output_before;
private $delete_output_after;
private $display_format;
private $result_importance;

public function __construct($ot, $mtta, $rk, $lh, $lbh, $lah, $rbs, $ras, $sfr, $srp, $mm, $drb, $mrb, $rs, $rpro, $rpre, $ad, $atad, $ff, $tcts, $dob, $doa, $df, $drd)
public function __construct($ot, $mtta, $rk, $lh, $lbh, $lah, $rbs, $ras, $sfr, $srp, $mm, $drb, $mrb, $rs, $rpro, $rpre, $ad, $atad, $ff, $tcts, $dob, $doa, $df, $drd, $ri)
{
$this->output_template = $ot;
$this->match_to_test_args = $mtta;
Expand All @@ -201,6 +202,7 @@ public function __construct($ot, $mtta, $rk, $lh, $lbh, $lah, $rbs, $ras, $sfr,
$this->delete_output_before = $dob;
$this->delete_output_after = $doa;
$this->display_format = $df;
$this->result_importance = $ri;
}
public function get_output_template()
{
Expand Down Expand Up @@ -294,6 +296,10 @@ public function get_delete_output_after()
{
return $this->delete_output_after;
}
public function get_result_importance()
{
return $this->result_importance;
}
public function get_display_format()
{
return $this->display_format;
Expand Down
13 changes: 11 additions & 2 deletions pts-core/objects/pts_test_result_parser.php
Expand Up @@ -450,6 +450,7 @@ protected static function parse_result_process(&$test_run_request, $log_file, $p
$definitions = $test_run_request->test_profile->get_results_definition('ResultsParser');
$all_parser_entries = $definitions->get_result_parser_definitions();
$avoid_duplicates = array();
$primary_result = null;
foreach($all_parser_entries as $entry)
{
$tr = clone $test_run_request;
Expand All @@ -463,7 +464,7 @@ protected static function parse_result_process(&$test_run_request, $log_file, $p
$max_result = null;
$min_test_result = false;
$max_test_result = false;
$test_result = self::parse_result_process_entry($tr, $log_file, $pts_test_arguments, $extra_arguments, $prefix, $entry, $is_pass_fail_test, $is_numeric_check, $all_parser_entries, $min_test_result, $max_test_result);
$test_result = self::parse_result_process_entry($tr, $log_file, $pts_test_arguments, $extra_arguments, $prefix, $entry, $is_pass_fail_test, $is_numeric_check, $all_parser_entries, $min_test_result, $max_test_result, $primary_result);
if($test_result != false)
{
// Result found
Expand All @@ -482,12 +483,16 @@ protected static function parse_result_process(&$test_run_request, $log_file, $p
}
self::gen_result_active_handle($test_run_request, $tr)->add_trial_run_result($test_result, $min_result, $max_result);
$produced_result = true;
if($primary_result == null)
{
$primary_result = $tr;
}
}
}

return $produced_result;
}
protected static function parse_result_process_entry(&$test_run_request, $log_file, $pts_test_arguments, $extra_arguments, $prefix, &$e, $is_pass_fail_test, $is_numeric_check, &$all_parser_entries, &$min_test_result = false, &$max_test_result = false)
protected static function parse_result_process_entry(&$test_run_request, $log_file, $pts_test_arguments, $extra_arguments, $prefix, &$e, $is_pass_fail_test, $is_numeric_check, &$all_parser_entries, &$min_test_result = false, &$max_test_result = false, $primary_result = null)
{
$test_result = false;
$match_test_arguments = $e->get_match_to_test_args();
Expand Down Expand Up @@ -904,6 +909,10 @@ protected static function parse_result_process_entry(&$test_run_request, $log_fi
{
$test_run_request->set_used_arguments_description($e->get_arguments_description());
}
if($e->get_result_importance() != null && strtolower($e->get_result_importance()) == 'secondary' && !empty($primary_result))
{
$test_run_request->set_parent_hash_from_result($primary_result);
}
if($e->get_append_to_arguments_description() != null)
{
foreach($all_parser_entries as $parser_entry)
Expand Down
10 changes: 10 additions & 0 deletions pts-core/openbenchmarking.org/schemas/results-parser.xsd
Expand Up @@ -270,6 +270,16 @@
<xs:documentation>If wishing to trim the log file that will be parsed for the test result, a unique string can be specified here and the result parser will drop any text after the match.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="Importance" type="xs:string" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:appinfo>
<get>get_result_importance</get>
<set></set>
<default></default>
</xs:appinfo>
<xs:documentation>If the result is less important, the Importance can be set to 'Secondary' to indicate it is of less importance / subordinate to other result metrics. Otherwise it's assumed to be a 'Primary' result. This can affect how 'secondary' results are shown on the result viewer such as behind a tabbed view or shown in a smaller manner than the main results.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
Expand Down

0 comments on commit 6ebfe5a

Please sign in to comment.