pts-core: PHP 8.3 compatibility updates/fixes

This commit is contained in:
Michael Larabel
2023-11-26 05:12:39 -06:00
parent af4db559fc
commit 9015a7f091
6 changed files with 56 additions and 14 deletions

View File

@@ -3,8 +3,8 @@
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2009 - 2020, Phoronix Media
Copyright (C) 2009 - 2020, Michael Larabel
Copyright (C) 2009 - 2023, Phoronix Media
Copyright (C) 2009 - 2023, Michael Larabel
pts_concise_display_mode.php: The batch / concise display mode
This program is free software; you can redistribute it and/or modify
@@ -319,7 +319,7 @@ class pts_concise_display_mode implements pts_display_mode_interface
}
public function test_run_configure(&$test_profile)
{
echo PHP_EOL . PHP_EOL . $test_profile->get_title() . ($test_profile->get_app_version() != null ? ' ' . $test_profile->get_app_version() : null) . ':' . PHP_EOL . $this->tab . $test_profile->get_identifier() . PHP_EOL;
echo PHP_EOL . PHP_EOL . trim($test_profile->get_title() . ($test_profile->get_app_version() != null ? ' ' . $test_profile->get_app_version() : null)) . ':' . PHP_EOL . $this->tab . $test_profile->get_identifier() . PHP_EOL;
echo $this->tab . $test_profile->get_test_hardware_type() . ' Test Configuration';
//echo PHP_EOL;
//echo $this->tab . 'Test ' . $test_run_manager->get_test_run_position() . ' of ' . $test_run_manager->get_test_run_count_reported() . PHP_EOL;

View File

@@ -3,8 +3,8 @@
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2008 - 2021, Phoronix Media
Copyright (C) 2008 - 2021, Michael Larabel
Copyright (C) 2008 - 2023, Phoronix Media
Copyright (C) 2008 - 2023, Michael Larabel
pho_graph.php: The core graph object that is used by the different graphing objects.
This program is free software; you can redistribute it and/or modify
@@ -472,8 +472,8 @@ abstract class pts_graph_core
protected function update_graph_dimensions($width = -1, $height = -1, $recalculate_offsets = false)
{
// Allow render area to be increased, but not decreased
$this->i['graph_width'] = max($this->i['graph_width'], $width);
$this->i['graph_height'] = max($this->i['graph_height'], $height);
$this->i['graph_width'] = intval(max($this->i['graph_width'], $width));
$this->i['graph_height'] = intval(max($this->i['graph_height'], $height));
if($recalculate_offsets)
{

View File

@@ -286,7 +286,7 @@ class pts_graph_lines extends pts_graph_core
for($y = $y_start; $y <= $y_end; $y += $this->i['key_line_height'], ++$i)
{
$ak = array_keys($this->test_result->test_result_buffer->buffer_items);
if(!isset($this->test_result->test_result_buffer->buffer_items[$ak[$i]]))
if(!isset($ak[$i]) || !isset($this->test_result->test_result_buffer->buffer_items[$ak[$i]]))
{
break;
}
@@ -314,7 +314,7 @@ class pts_graph_lines extends pts_graph_core
$precise_stat_array = array();
foreach($stat_array as $stat_value)
{
if(is_string($stat_value))
if(!is_numeric($stat_value))
{
// TODO investigate this case...
// sometimes $stat_value is string of comma separated values
@@ -469,7 +469,7 @@ class pts_graph_lines extends pts_graph_core
$this->svg_dom->draw_svg_line($x_y_pair[0], $x_y_pair[1] + 6, $x_y_pair[0], $x_y_pair[1] - 6, self::$c['color']['alert'], 4, array('xlink:title' => $regression_plots[$i]));
}
if($point_counter < 6 || $plotted_error_bar || $i == 0 || $i == ($poly_points_count - 1))
if($point_counter < 6 || $plotted_error_bar || $i == 0 || $i == ($poly_points_count - 1) || $this->i['on_zero_plot_connect'])
{
$this->svg_dom->add_element('ellipse', array('cx' => $x_y_pair[0], 'cy' => $x_y_pair[1], 'rx' => 3, 'ry' => 3), $g);
}
@@ -495,7 +495,7 @@ class pts_graph_lines extends pts_graph_core
$this->i['key_line_height'] = 16;
$this->i['key_longest_string_width'] = self::text_string_width($this->test_result->test_result_buffer->get_longest_identifier(), self::$c['size']['key']) + 6;
$item_width_spacing = 32;
$item_width_spacing = 36;
$this->i['key_item_width'] = $this->i['key_longest_string_width'] + $this->get_stat_word_width() * 3 + $item_width_spacing;
// if there are <=4 data sets, then use a single column, otherwise, try and multi-col it
@@ -515,7 +515,7 @@ class pts_graph_lines extends pts_graph_core
}
private function get_stat_word_width()
{
return ceil(2.6 * self::text_string_width($this->i['graph_max_value'] + 0.1, $this->i['min_identifier_size'] + 0.5));
return ceil(2.6 * self::text_string_width($this->i['graph_max_value'] + 0.001, $this->i['min_identifier_size'] + 0.5));
}
private function getStatisticsHeaderHeight()
{

View File

@@ -3,8 +3,8 @@
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2010 - 2021, Phoronix Media
Copyright (C) 2010 - 2021, Michael Larabel
Copyright (C) 2010 - 2023, Phoronix Media
Copyright (C) 2010 - 2023, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -619,6 +619,10 @@ class pts_openbenchmarking
if($test_profile != null && $hash_check == sha1($test_profile))
{
// save it
if(!is_dir(dirname($file)))
{
mkdir(dirname($file));
}
file_put_contents($file, $test_profile);
if(isset($acquire_test_json['openbenchmarking']['test']['changes']))

View File

@@ -892,6 +892,10 @@ class pts_result_viewer_embed
{
$analyze_checkboxes['Graph Settings'][] = array('nbp', 'No Box Plots');
}
if($has_line_graph || $is_multi_way)
{
$analyze_checkboxes['Graph Settings'][] = array('clg', 'On Line Graphs With Missing Data, Connect The Line Gaps');
}
if($is_multi_way && $system_count > 1)
{
@@ -1053,6 +1057,7 @@ class pts_result_viewer_embed
if($result_file->get_test_count() > 1)
{
$analyze_options .= '<div>Only show results matching title/arguments (delimit multiple options with a comma): ' . self::html_input_field('oss', 'oss') . '</div>';
$analyze_options .= '<div>Do not show results matching title/arguments (delimit multiple options with a comma): ' . self::html_input_field('noss', 'noss') . '</div>';
}
$analyze_options .= '<br /><input style="clear: both;" name="submit" value="Refresh Results" type="submit" /></form>';
@@ -1384,6 +1389,31 @@ class pts_result_viewer_embed
}
}
}
if(($noss = self::check_request_for_var($request, 'noss')) && strlen($noss) > 1)
{
$noss = pts_strings::comma_explode($noss);
foreach($result_file->get_result_objects() as $i => $result_object)
{
$matched = false;
foreach($noss as $search_check)
{
if(stripos($result_object->get_arguments_description(), $search_check) === false && stripos($result_object->test_profile->get_identifier(), $search_check) === false && stripos($result_object->test_profile->get_title(), $search_check) === false)
{
// Not found
$matched = false;
}
else
{
$matched = true;
break;
}
}
if($matched)
{
$result_file->remove_result_object_by_id($i);
}
}
}
if(self::check_request_for_var($request, 'ftt') && self::check_request_for_var($request, 'ftt'))
{
$ftt = self::check_request_for_var($request, 'ftt');
@@ -1623,6 +1653,10 @@ class pts_result_viewer_embed
{
$extra_attributes['no_box_plots'] = true;
}
if(self::check_request_for_var($request, 'clg'))
{
$extra_attributes['on_zero_plot_connect'] = true;
}
if(self::check_request_for_var($request, 'vb'))
{
$extra_attributes['vertical_bars'] = true;

View File

@@ -251,6 +251,10 @@ class pts_test_profile_parser
}
public function get_app_version()
{
if(isset($_GET['merge_mismatched_test_versions']) && $_GET['merge_mismatched_test_versions'] == 'i-understand-the-risks')
{
return '';
}
return $this->xg('TestInformation/AppVersion');
}
public function get_project_url()