pts-core: Various fixes, PHP 8.5 compatibility updates

This commit is contained in:
Michael Larabel
2025-08-17 10:59:50 -05:00
parent 87c7188a50
commit eedb556475
12 changed files with 46 additions and 10 deletions

View File

@@ -564,7 +564,10 @@ class check_tests implements pts_option_interface
echo pts_client::cli_colored_text($identifier . " Download Time: " . $download[self::V_DOWNLOAD_TIME] . " ERROR " . $errno . " " . $download[self::V_DOWNLOAD_ERROR] . PHP_EOL, 'red', false);
}
curl_close($ch);
if(PHP_MAJOR_VERSION < 8)
{
curl_close($ch);
}
fclose($fh);
$download[self::V_STATUS] = $info['http_code'];

View File

@@ -5,6 +5,11 @@ if [ `whoami` = "root" ] && [ ! -w /usr/bin/sudo ]; then
yum -y install $*
elif [ -x /usr/bin/dnf ]; then
sudo dnf -y --skip-unavailable install $*
command_status=$?
if [ $command_status -ne 0 ]; then
# RHEL 10 and older error out, Fedora ~42 and newer have --skip-unavailable
sudo dnf -y install $*
fi
elif [ `whoami` = "ec2-user" ]; then
sudo yum -y --skip-broken install $*
else

View File

@@ -89,7 +89,10 @@ class pushover_net extends pts_module_interface
'message' => $message,
)));
curl_exec($ch);
curl_close($ch);
if(PHP_MAJOR_VERSION < 8)
{
curl_close($ch);
}
}
}

View File

@@ -2035,7 +2035,7 @@ class pts_client
}
else
{
$possible_browsers = array('x-www-browser', 'firefox', 'mozilla', 'google-chrome', 'chromium', 'iceweasel', 'konqueror', 'epiphany', 'midori', 'epiphany-browser', 'epiphany', 'falkon', 'qupzilla', 'open', 'xdg-open');
$possible_browsers = array('x-www-browser', 'google-chrome', 'firefox', 'mozilla', 'chromium', 'iceweasel', 'konqueror', 'epiphany', 'midori', 'epiphany-browser', 'epiphany', 'falkon', 'qupzilla', 'open', 'xdg-open');
// First try to see if a browser is already running and use that
foreach($possible_browsers as &$b)

View File

@@ -122,7 +122,7 @@ class pts_tests
return $error;
}
foreach(array('fatal error', 'error while loading', 'undefined reference', 'cannot find -l', 'error:', 'returned 1 exit status', 'you must install', 'not found', 'child process excited with status', 'error opening archive', 'failed to load', 'fatal', 'illegal argument', 'is required to build', 'or higher is required', ': No such file or directory', 'not enough slots', 'mpirun noticed that process', 'permission denied', 'connection refused', 'MPI_ABORT was invoked', 'mpirun was unable to launch', 'error adding symbols:', 'not set and cannot find', 'please set JAVA', '/usr/bin/which: no ') as $error_string)
foreach(array('fatal error', 'error while loading', 'undefined reference', 'cannot find -l', 'error:', 'returned 1 exit status', 'you must install', 'not found', 'child process excited with status', 'error opening archive', 'failed to load', 'fatal', 'illegal argument', 'is required to build', 'or higher is required', ': No such file or directory', 'not enough slots', 'mpirun noticed that process', 'permission denied', 'connection refused', 'MPI_ABORT was invoked', 'mpirun was unable to launch', 'error adding symbols:', 'not set and cannot find', 'please set JAVA', '/usr/bin/which: no ', 'segmentation fault', 'returned non-zero exit status', 'Error with ', ' is not supported ', 'ValueError: ') as $error_string)
{
$lf = $log_file;
if(($e = strripos($lf, $error_string)) !== false)

View File

@@ -1509,6 +1509,7 @@ class phodevi_cpu extends phodevi_device_interface
198 => 'Arrow Lake',
204 => 'Panther Lake',
207 => 'Emerald Rapids',
213 => 'Wildcat Lake',
215 => 'Bartlett Lake',
221 => 'Clearwater Forest',
),
@@ -1519,6 +1520,10 @@ class phodevi_cpu extends phodevi_device_interface
4 => 'Prescott',
6 => 'Cedar Mill',
),
18 => array(
1 => 'Nova Lake',
3 => 'Nova Lake',
),
19 => array(
1 => 'Diamond Rapids',
),

View File

@@ -1237,7 +1237,7 @@ class phodevi_gpu extends phodevi_device_interface
$info = str_replace('(TM)', '', implode(' + ', $windows_gpu));
}
if(empty($info) || strpos($info, 'Mesa ') !== false || strpos($info, 'Gallium ') !== false || strpos($info, 'DRM ') !== false)
if(empty($info) || strpos($info, 'Mesa ') !== false || strpos($info, 'Gallium ') !== false || strpos($info, 'DRM ') !== false || stripos($info, 'Zink ') !== false)
{
if(!empty($info))
{
@@ -1257,7 +1257,7 @@ class phodevi_gpu extends phodevi_device_interface
}
}
if(phodevi::is_windows() == false && (empty($info) || (strpos($info, 'Intel ') === false && !pts_strings::string_contains($info, pts_strings::CHAR_NUMERIC))))
if(phodevi::is_windows() == false && (empty($info) || stripos($info, 'Zink') !== false || (strpos($info, 'Intel ') === false && !pts_strings::string_contains($info, pts_strings::CHAR_NUMERIC))))
{
$controller_3d = phodevi_linux_parser::read_pci('3D controller', false);
$info_pci = phodevi_linux_parser::read_pci('VGA compatible controller', false);

View File

@@ -188,6 +188,15 @@ class cpu_temp extends phodevi_sensor
}
}
}
if($temp_c == -1)
{
// Chrome OS EC Driver, tested on Framework Desktop
$temp_c = phodevi_linux_parser::read_sysfs_node('/sys/class/hwmon/hwmon*/temp4_input', 'POSITIVE_NUMERIC', array('temp4_label' => 'cpu@4c'));
if($temp_c > 1000)
{
$temp_c = $temp_c / 1000;
}
}
return $temp_c;
}

View File

@@ -49,6 +49,14 @@ class memory_temp extends phodevi_sensor
$temp_c = $temp_c / 1000;
}
}
if($temp_c == -1)
{
$temp_c = phodevi_linux_parser::read_sysfs_node('/sys/class/hwmon/hwmon*/temp2_input', 'POSITIVE_NUMERIC', array('temp2_label' => 'mainboard_memory@4d'));
if($temp_c > 1000)
{
$temp_c = $temp_c / 1000;
}
}
if($temp_c > 1000 || $temp_c < 9)
{

View File

@@ -184,7 +184,10 @@ class pts_network
}
curl_exec($cr);
curl_close($cr);
if(PHP_MAJOR_VERSION < 8)
{
curl_close($cr);
}
fclose($fh);
return true;

View File

@@ -554,7 +554,7 @@ class pts_result_file
// See if only numbers are changing between runs
foreach($identifiers as $i => &$identifier)
{
if(($x = strpos($identifier, ': ')) !== false)
if(!empty($identifier) && ($x = strpos($identifier, ': ')) !== false)
{
$identifier = substr($identifier, ($x + 2));
}

View File

@@ -1361,11 +1361,11 @@ class pts_result_viewer_embed
foreach($spreads as $result_key => $spread)
{
$ro = $result_file->get_result_object_by_hash($result_key);
if(!is_object($ro[0]))
if(!is_object($ro))
{
continue;
}
$html .= '<a href="#r-' . $result_key . '">' . $ro[0]->test_profile->get_title() . ' - ' . $ro[0]->get_arguments_description() . '</a><br />';
$html .= '<a href="#r-' . $result_key . '">' . $ro->test_profile->get_title() . ' - ' . $ro->get_arguments_description() . '</a><br />';
}
}
}