pts-core: PHP 8.4 warning fixes and other small fixes/improvements

This commit is contained in:
Michael Larabel
2025-03-29 06:21:22 -05:00
parent e1fdc09426
commit e4857241da
23 changed files with 73 additions and 45 deletions

View File

@@ -35,7 +35,7 @@ class intersect implements pts_option_interface
{
if(count($to_union) < 2)
{
trigger_error('Two or more results/suites must be passed to this sub-command.', E_USER_ERROR);
trigger_error('Two or more results/suites must be passed to this sub-command.', E_USER_WARNING);
return false;
}
$tests = array();

View File

@@ -46,7 +46,7 @@ class openbenchmarking_login implements pts_option_interface
if(!isset($json['openbenchmarking']) || isset($json['openbenchmarking']['response']['error']))
{
trigger_error($json['openbenchmarking']['response']['error'], E_USER_ERROR);
trigger_error($json['openbenchmarking']['response']['error'], E_USER_WARNING);
pts_storage_object::remove_in_file(PTS_CORE_STORAGE, 'openbenchmarking');
}
else

View File

@@ -29,13 +29,13 @@ class start_phoromatic_server implements pts_option_interface
{
if(pts_client::create_lock(PTS_USER_PATH . 'phoromatic_server_lock') == false)
{
trigger_error('The Phoromatic Server is already running.', E_USER_ERROR);
trigger_error('The Phoromatic Server is already running.', E_USER_WARNING);
return false;
}
if(phodevi::is_windows())
{
trigger_error('Running the Phoromatic Server on Windows is experimental and may have issues. Running the Phoromatic client and Phoronix Test Suite itself on Windows is supported but the Phoromatic Server is currently not engineered for Windows but can be under commercial engagement.', E_USER_ERROR);
trigger_error('Running the Phoromatic Server on Windows is experimental and may have issues. Running the Phoromatic client and Phoronix Test Suite itself on Windows is supported but the Phoromatic Server is currently not engineered for Windows but can be under commercial engagement.', E_USER_WARNING);
}
pts_file_io::unlink(getenv('PTS_EXT_LAUNCH_SCRIPT_DIR') . '/phoromatic-server-launcher');
@@ -87,7 +87,7 @@ class start_phoromatic_server implements pts_option_interface
if(($fp = fsockopen('127.0.0.1', $remote_access, $errno, $errstr, 5)) != false)
{
fclose($fp);
trigger_error('Port ' . $remote_access . ' is already in use by another server process. Close that process or change the Phoronix Test Suite server port via' . pts_config::get_config_file_location() . ' to proceed.', E_USER_ERROR);
trigger_error('Port ' . $remote_access . ' is already in use by another server process. Close that process or change the Phoronix Test Suite server port via' . pts_config::get_config_file_location() . ' to proceed.', E_USER_WARNING);
return false;
}
else

View File

@@ -51,7 +51,7 @@ class start_remote_gui_server implements pts_option_interface
if(($fp = fsockopen('127.0.0.1', $remote_access, $errno, $errstr, 5)) != false)
{
trigger_error('Port ' . $remote_access . ' is already in use by another server process. Close that process or change the Phoronix Test Suite server port via ' . pts_config::get_config_file_location() . ' to proceed.', E_USER_ERROR);
trigger_error('Port ' . $remote_access . ' is already in use by another server process. Close that process or change the Phoronix Test Suite server port via ' . pts_config::get_config_file_location() . ' to proceed.', E_USER_WARNING);
fclose($fp);
return false;
}

View File

@@ -28,6 +28,9 @@ class start_ws_server implements pts_option_interface
public static function run($r)
{
// Unused / hasn't been finished in a decade... So don't bother trying for now.
return;
if(getenv('PTS_WEBSOCKET_PORT') !== false)
{
$web_socket_port = getenv('PTS_WEBSOCKET_PORT');

View File

@@ -43,7 +43,7 @@ class upload_result implements pts_option_interface
}
if(!pts_openbenchmarking::ob_upload_support_available())
{
trigger_error('No OpenBenchmarking.org upload support available.', E_USER_ERROR);
trigger_error('No OpenBenchmarking.org upload support available.', E_USER_WARNING);
return false;
}

View File

@@ -119,7 +119,7 @@ class load_dynamic_result_viewer extends pts_module_interface
return;
}
}
//trigger_error('The result viewer is already running.', E_USER_ERROR);
//trigger_error('The result viewer is already running.', E_USER_WARNING);
return false;
}
if(PHP_VERSION_ID < 50400)
@@ -162,7 +162,7 @@ class load_dynamic_result_viewer extends pts_module_interface
if(($fp = fsockopen('127.0.0.1', $remote_access, $errno, $errstr, 5)) != false)
{
fclose($fp);
//trigger_error('Port ' . $remote_access . ' is already in use by another server process. Close that process or change the Phoronix Test Suite server port via' . pts_config::get_config_file_location() . ' to proceed.', E_USER_ERROR);
//trigger_error('Port ' . $remote_access . ' is already in use by another server process. Close that process or change the Phoronix Test Suite server port via' . pts_config::get_config_file_location() . ' to proceed.', E_USER_WARNING);
return false;
}
else

View File

@@ -467,7 +467,7 @@ class phoromatic extends pts_module_interface
{
if(pts_client::create_lock(PTS_USER_PATH . 'phoromatic_lock') == false)
{
trigger_error('Phoromatic is already running.', E_USER_ERROR);
trigger_error('Phoromatic is already running.', E_USER_WARNING);
return false;
}
define('PHOROMATIC_PROCESS', true);
@@ -523,7 +523,7 @@ class phoromatic extends pts_module_interface
if($times_failed >= 2)
{
trigger_error('Communication with server failed.', E_USER_ERROR);
trigger_error('Communication with server failed.', E_USER_WARNING);
if(PTS_IS_DAEMONIZED_SERVER_PROCESS == false && $times_failed > 5)
{
@@ -558,7 +558,7 @@ class phoromatic extends pts_module_interface
{
if(isset($json['phoromatic']['error']) && !empty($json['phoromatic']['error']))
{
trigger_error($json['phoromatic']['error'], E_USER_ERROR);
trigger_error($json['phoromatic']['error'], E_USER_WARNING);
}
if(isset($json['phoromatic']['response']) && !empty($json['phoromatic']['response']))
{

View File

@@ -30,6 +30,9 @@ class update_checker extends pts_module_interface
public static function __pre_option_process()
{
// Disable module for wasting Phoronix resources with infrequent updates...
return pts_module::MODULE_UNLOAD;
// if first run of the day or if the PTS release build is more than 1 year old, start pestering user to upgrade...
$do_check = IS_FIRST_RUN_TODAY || (time() > strtotime(PTS_RELEASE_DATE) + (86400 * 30 * 13));

View File

@@ -1291,11 +1291,11 @@ class pts_client
if((isset($pass_args[$argument_check->get_argument_index()]) && !empty($pass_args[$argument_check->get_argument_index()])) || ($argument_check->get_argument_index() == 'VARIABLE_LENGTH' && !empty($pass_args)))
{
trigger_error('Invalid Argument: ' . implode(' ', $pass_args), E_USER_ERROR);
trigger_error('Invalid Argument: ' . implode(' ', $pass_args), E_USER_WARNING);
}
else
{
trigger_error('Phoronix Test Suite Argument Missing', E_USER_ERROR);
trigger_error('Phoronix Test Suite Argument Missing', E_USER_WARNING);
}
echo PHP_EOL . pts_client::cli_just_bold('CORRECT SYNTAX:') . PHP_EOL . 'phoronix-test-suite ' . str_replace('_', '-', $command_alias) . ' ' . pts_client::cli_just_italic(implode(' ', $argument_checks)) . PHP_EOL . PHP_EOL;
@@ -2098,7 +2098,7 @@ class pts_client
if($pid == -1)
{
trigger_error('Could not fork ' . $function . '.', E_USER_ERROR);
trigger_error('Could not fork ' . $function . '.', E_USER_WARNING);
}
else if($pid)
{
@@ -2140,7 +2140,7 @@ class pts_client
$function = implode(':', $function);
}
trigger_error('php-pcntl and php-posix must be installed for calling ' . $function . '.', E_USER_ERROR);
trigger_error('php-pcntl and php-posix must be installed for calling ' . $function . '.', E_USER_WARNING);
}
}
public static function fork($fork_function, $fork_function_parameters = null)
@@ -2157,7 +2157,7 @@ class pts_client
if($pid == -1)
{
trigger_error('Could not fork ' . $fork_function . '.', E_USER_ERROR);
trigger_error('Could not fork ' . $fork_function . '.', E_USER_WARNING);
}
else if($pid)
{
@@ -2194,14 +2194,6 @@ class pts_client
switch($error_code)
{
case E_USER_ERROR:
$error_type = 'PROBLEM';
if(pts_client::is_debug_mode() == false)
{
$error_file = null;
$error_line = 0;
}
break;
case E_USER_NOTICE:
if(pts_client::is_debug_mode() == false)
{

View File

@@ -235,7 +235,7 @@ class pts_module
}
else
{
trigger_error('php-pcntl must be installed for the ' . self::module_name() . ' module.', E_USER_ERROR);
trigger_error('php-pcntl must be installed for the ' . self::module_name() . ' module.', E_USER_WARNING);
}
}
private static function module_name()

View File

@@ -214,7 +214,7 @@ class pts_openbenchmarking_client
else
{
pts_storage_object::set_in_file(PTS_CORE_STORAGE, 'openbenchmarking', false);
trigger_error('Invalid OpenBenchmarking.org account supplied, please re-login.', E_USER_ERROR);
trigger_error('Invalid OpenBenchmarking.org account supplied, please re-login.', E_USER_WARNING);
}
}
else

View File

@@ -72,13 +72,13 @@ class pts_test_installer
// Install tests
if(!is_writable(pts_client::test_install_root_path()))
{
trigger_error('The test installation directory is not writable.' . PHP_EOL . 'Location: ' . pts_client::test_install_root_path(), E_USER_ERROR);
trigger_error('The test installation directory is not writable.' . PHP_EOL . 'Location: ' . pts_client::test_install_root_path(), E_USER_WARNING);
return false;
}
$mount_options = phodevi::read_property('disk', 'mount-options');
if(isset($mount_options['mount-options']) && strpos($mount_options['mount-options'], 'noexec') !== false)
{
trigger_error('The test installation directory is on a file-system mounted with the \'noexec\' mount option. Re-mount the file-system appropriately or change the Phoronix Test Suite user configuration file to point to an alternative mount point.' . PHP_EOL . 'Location: ' . pts_client::test_install_root_path(), E_USER_ERROR);
trigger_error('The test installation directory is on a file-system mounted with the \'noexec\' mount option. Re-mount the file-system appropriately or change the Phoronix Test Suite user configuration file to point to an alternative mount point.' . PHP_EOL . 'Location: ' . pts_client::test_install_root_path(), E_USER_WARNING);
return false;
}

View File

@@ -899,20 +899,20 @@ class pts_test_run_manager
if($this->batch_mode && $this->batch_mode['Configured'] == false && !$this->auto_mode)
{
trigger_error('The batch mode must first be configured.' . PHP_EOL . 'To configure, run phoronix-test-suite batch-setup', E_USER_ERROR);
trigger_error('The batch mode must first be configured.' . PHP_EOL . 'To configure, run phoronix-test-suite batch-setup', E_USER_WARNING);
return false;
}
if(!is_writable(pts_client::test_install_root_path()))
{
trigger_error('The test installation directory is not writable.' . PHP_EOL . 'Location: ' . pts_client::test_install_root_path(), E_USER_ERROR);
trigger_error('The test installation directory is not writable.' . PHP_EOL . 'Location: ' . pts_client::test_install_root_path(), E_USER_WARNING);
return false;
}
$mount_options = phodevi::read_property('disk', 'mount-options');
if(isset($mount_options['mount-options']) && strpos($mount_options['mount-options'], 'noexec') !== false)
{
trigger_error('The test installation directory is on a file-system mounted with the \'noexec\' mount option. Re-mount the file-system appropriately or change the Phoronix Test Suite user configuration file to point to an alternative mount point.' . PHP_EOL . 'Location: ' . pts_client::test_install_root_path(), E_USER_ERROR);
trigger_error('The test installation directory is on a file-system mounted with the \'noexec\' mount option. Re-mount the file-system appropriately or change the Phoronix Test Suite user configuration file to point to an alternative mount point.' . PHP_EOL . 'Location: ' . pts_client::test_install_root_path(), E_USER_WARNING);
return false;
}
@@ -923,7 +923,7 @@ class pts_test_run_manager
}
else if(count($to_run) == 0)
{
//trigger_error('You must enter at least one test, suite, or result identifier to run.', E_USER_ERROR);
//trigger_error('You must enter at least one test, suite, or result identifier to run.', E_USER_WARNING);
return false;
}
@@ -1385,7 +1385,7 @@ class pts_test_run_manager
if(count($tests_missing) == 1)
{
trigger_error($tests_missing[0] . ' is not installed.', E_USER_ERROR);
trigger_error($tests_missing[0] . ' is not installed.', E_USER_WARNING);
// PHP_EOL . 'To install, run: phoronix-test-suite install ' . $tests_missing[0]
}
else
@@ -1718,7 +1718,7 @@ class pts_test_run_manager
}
else
{
trigger_error($run_object . ' is not recognized.', E_USER_ERROR);
trigger_error($run_object . ' is not recognized.', E_USER_WARNING);
continue;
}
}

View File

@@ -366,6 +366,15 @@ class phodevi_cpu extends phodevi_device_interface
$pm[] = 'INT340x Workload Type: ' . $workload_type;
}
}
if(is_file('/sys/bus/platform/drivers/amd_x3d_vcache/AMDI0101:00/amd_x3d_mode'))
{
// 3D V-Cache X3D mode
$amd_x3d_mode = pts_file_io::file_get_contents('/sys/bus/platform/drivers/amd_x3d_vcache/AMDI0101:00/amd_x3d_mode');
if(!empty($amd_x3d_mode))
{
$pm[] = 'amd_x3d_mode: ' . $amd_x3d_mode;
}
}
return implode(' - ', $pm);
}
@@ -869,6 +878,22 @@ class phodevi_cpu extends phodevi_device_interface
break;
}
}
else if($implementer == '0x4e')
{
$new_info = 'NVIDIA';
switch($part)
{
case '0x004':
$new_info .= ' Carmel';
break;
case '0x10':
$new_info .= ' Olympus';
break;
case '0x010':
$new_info .= ' Olympus';
break;
}
}
else if($implementer == '0x46')
{
$new_info = 'Fujitsu';

View File

@@ -1290,6 +1290,10 @@ class phodevi_gpu extends phodevi_device_interface
$info_pci = $controller_3d;
}
}
else if(stripos($info_pci, 'aspeed') !== false && phodevi_linux_parser::read_pci('Processing accelerators', true))
{
$info_pci = str_replace('Device ', '', phodevi_linux_parser::read_pci('Processing accelerators', true));
}
if(!empty($info_pci) && strpos($info_pci, 'Device ') === false)
{

View File

@@ -131,7 +131,7 @@ class pts_compression
}
else if(PTS_IS_CLIENT)
{
trigger_error('Failed to find ZIP support for extracting file: ' . $zip_file . '. Install PHP ZIP support or the unzip utility.', E_USER_ERROR);
trigger_error('Failed to find ZIP support for extracting file: ' . $zip_file . '. Install PHP ZIP support or the unzip utility.', E_USER_WARNING);
}
return $success;

View File

@@ -175,7 +175,7 @@ class pts_openbenchmarking
}
else if(PTS_IS_CLIENT && isset($json_response['openbenchmarking']['result']['error']))
{
trigger_error($json_response['openbenchmarking']['result']['error'], E_USER_ERROR);
trigger_error($json_response['openbenchmarking']['result']['error'], E_USER_WARNING);
}
return $valid;
@@ -654,7 +654,7 @@ class pts_openbenchmarking
{
if(!defined('PHOROMATIC_SERVER'))
{
trigger_error('Unable to obtain ' . $qualified_identifier . ' from OpenBenchmarking.org. ' . (!pts_network::internet_support_available() ? 'Internet connection disabled/unavailable.' : 'If this issue persists, file an issue @ https://github.com/phoronix-test-suite/phoronix-test-suite/issues') . PHP_EOL, E_USER_ERROR);
trigger_error('Unable to obtain ' . $qualified_identifier . ' from OpenBenchmarking.org. ' . (!pts_network::internet_support_available() ? 'Internet connection disabled/unavailable.' : 'If this issue persists, file an issue @ https://github.com/phoronix-test-suite/phoronix-test-suite/issues') . PHP_EOL, E_USER_WARNING);
}
return false;
}
@@ -682,7 +682,7 @@ class pts_openbenchmarking
else
{
unlink($file);
//trigger_error('Test definition not found for ' . $qualified_identifier . '.' . PHP_EOL, E_USER_ERROR);
//trigger_error('Test definition not found for ' . $qualified_identifier . '.' . PHP_EOL, E_USER_WARNING);
return false;
}
}
@@ -914,7 +914,7 @@ class pts_openbenchmarking
{
if(!defined('PHOROMATIC_SERVER'))
{
trigger_error('Unable to obtain ' . $qualified_identifier . ' from OpenBenchmarking.org. ' . (!pts_network::internet_support_available() ? 'Internet connection disabled/unavailable.' : 'If this issue persists, file an issue @ https://github.com/phoronix-test-suite/phoronix-test-suite/issues') . PHP_EOL, E_USER_ERROR);
trigger_error('Unable to obtain ' . $qualified_identifier . ' from OpenBenchmarking.org. ' . (!pts_network::internet_support_available() ? 'Internet connection disabled/unavailable.' : 'If this issue persists, file an issue @ https://github.com/phoronix-test-suite/phoronix-test-suite/issues') . PHP_EOL, E_USER_WARNING);
}
return false;
}

View File

@@ -156,13 +156,13 @@ class pts_openbenchmarking_upload extends pts_openbenchmarking
if(!is_array($json_response))
{
trigger_error('Unhandled Exception', E_USER_ERROR);
trigger_error('Unhandled Exception', E_USER_WARNING);
return false;
}
if(isset($json_response['openbenchmarking']['upload']['error']))
{
trigger_error($json_response['openbenchmarking']['upload']['error'], E_USER_ERROR);
trigger_error($json_response['openbenchmarking']['upload']['error'], E_USER_WARNING);
}
if(isset($json_response['openbenchmarking']['upload']['url']))
{

View File

@@ -247,7 +247,7 @@ class pts_user_io
{
foreach(self::$readline_completion_possibilities as $possibility)
{
if(substr($possibility, 0, $input_length) == $input)
if(!empty($possibility) && substr($possibility, 0, $input_length) == $input)
{
$possibilities[] = $possibility;
}

View File

@@ -23,6 +23,7 @@
include('../phoromatic_functions.php');
phoromatic_init_web_page_setup();
phoromatic_server::prepare_database();
phoromatic_quit_if_invalid_input_found();
?>

View File

@@ -45,7 +45,7 @@ if(isset($_GET['phoromatic_info']))
else
{
include('../../pts-core.php');
echo pts_core::program_title() . ' Phoromatic Server [' . $_SERVER['SERVER_SOFTWARE'] . ']';
echo pts_core::program_title() . ' Phoromatic Server [' . (isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : '') . ']';
}
?>

View File

@@ -15,7 +15,7 @@
<ColoredConsole>AUTO</ColoredConsole>
</General>
<Modules>
<AutoLoadModules>toggle_screensaver, update_checker, perf_tips, ob_auto_compare, load_dynamic_result_viewer</AutoLoadModules>
<AutoLoadModules>toggle_screensaver, perf_tips, ob_auto_compare, load_dynamic_result_viewer</AutoLoadModules>
</Modules>
<Installation>
<RemoveDownloadFiles>FALSE</RemoveDownloadFiles>