本文整理汇总了PHP中phodevi::system_software方法的典型用法代码示例。如果您正苦于以下问题:PHP phodevi::system_software方法的具体用法?PHP phodevi::system_software怎么用?PHP phodevi::system_software使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phodevi
的用法示例。
在下文中一共展示了phodevi::system_software方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public static function run($r)
{
echo PHP_EOL . 'If you have not already registered for your free OpenBenchmarking.org account, you can do so at http://openbenchmarking.org/' . PHP_EOL . PHP_EOL . 'Once you have registered your account and clicked the link within the verification email, enter your log-in information below.' . PHP_EOL . PHP_EOL;
echo 'User-Name: ';
$username = pts_user_io::read_user_input();
echo 'Password: ';
$password = pts_user_io::read_user_input();
$login_payload = array('s_u' => $username, 's_p' => sha1($password), 's_s' => base64_encode(phodevi::system_software(true)), 's_h' => base64_encode(phodevi::system_hardware(true)));
$login_state = pts_openbenchmarking::make_openbenchmarking_request('account_login', $login_payload);
$json = json_decode($login_state, true);
if (isset($json['openbenchmarking']['response']['error'])) {
trigger_error($json['openbenchmarking']['response']['error'], E_USER_ERROR);
pts_storage_object::remove_in_file(PTS_CORE_STORAGE, 'openbenchmarking');
} else {
$openbenchmarking_payload = array('user_name' => $json['openbenchmarking']['account']['user_name'], 'communication_id' => $json['openbenchmarking']['account']['communication_id'], 'sav' => $json['openbenchmarking']['account']['sav']);
pts_storage_object::set_in_file(PTS_CORE_STORAGE, 'openbenchmarking', $openbenchmarking_payload);
echo PHP_EOL . PHP_EOL . 'The Account Has Been Setup.' . PHP_EOL . PHP_EOL;
}
}
示例2: run
public static function run($r)
{
pts_client::$display->generic_heading('System Information');
echo 'Hardware:' . PHP_EOL . phodevi::system_hardware(true) . PHP_EOL . PHP_EOL;
echo 'Software:' . PHP_EOL . phodevi::system_software(true) . PHP_EOL . PHP_EOL;
//
// Processor Information
//
$cpu_flags = phodevi_cpu::get_cpu_flags();
echo PHP_EOL . 'PROCESSOR:' . PHP_EOL . PHP_EOL;
echo 'Core Count: ' . phodevi_cpu::cpuinfo_core_count() . PHP_EOL;
echo 'Thread Count: ' . phodevi_cpu::cpuinfo_thread_count() . PHP_EOL;
echo 'Cache Size: ' . phodevi_cpu::cpuinfo_cache_size() . ' KB' . PHP_EOL;
echo 'Instruction Set Extensions: ' . phodevi_cpu::instruction_set_extensions() . PHP_EOL;
echo 'AES Encryption: ' . ($cpu_flags & phodevi_cpu::get_cpu_feature_constant('aes') ? 'YES' : 'NO') . PHP_EOL;
echo 'Energy Performance Bias: ' . ($cpu_flags & phodevi_cpu::get_cpu_feature_constant('epb') ? 'YES' : 'NO') . PHP_EOL;
echo 'Virtualization: ' . (phodevi_cpu::virtualization_technology() ? phodevi_cpu::virtualization_technology() : 'NO') . PHP_EOL;
// Other info
foreach (pts_arrays::to_array(pts_test_run_manager::pull_test_notes(true)) as $test_note_head => $test_note) {
echo ucwords(str_replace('-', ' ', $test_note_head)) . ': ' . $test_note . PHP_EOL;
}
}
示例3: process_hand_shake
protected function process_hand_shake($user, $buffer)
{
$buffer_wrote = parent::process_hand_shake($user, $buffer);
return $buffer_wrote;
// TODO potentially don't need below code for this back-end XXX
if ($buffer_wrote > 0) {
$resource = substr($user->res, strrpos($user->res, '/') + 1);
switch (strstr($resource . ' ', ' ', true)) {
case 'start-user-session':
$json = array();
$json['pts']['msg']['name'] = 'user_session_start';
$this->add_to_status('Starting Session', $json);
$this->send_json_data($user->socket, $json);
// Phodevi
$this->add_to_status('Generating Phodevi Cache + VFS', $json);
$this->send_json_data($user->socket, $json);
phodevi::system_software(true);
phodevi::system_hardware(true);
$this->phodevi_vfs = new phodevi_vfs();
$this->phodevi_vfs->list_cache_nodes();
// Sensors
$this->add_to_status('Starting Phodevi Sensor Handler', $json);
$this->send_json_data($user->socket, $json);
$this->sensor_logging = new phodevi_sensor_monitor(array('all'));
$this->sensor_logging->sensor_logging_start();
// Test Information
$this->add_to_status('Downloading Test Information', $json);
$this->send_json_data($user->socket, $json);
pts_openbenchmarking::available_tests(true);
// Complete
$this->add_to_status('Session Startup Complete', $json);
$this->send_json_data($user->socket, $json);
//$this->disconnect($user->socket);
break;
}
return true;
}
}
示例4: run
public static function run($r)
{
$compare_tests = array();
$compare_subsystems = array();
foreach ($r as $test_object) {
$test_object = pts_types::identifier_to_object($test_object);
if ($test_object instanceof pts_test_profile) {
array_push($compare_tests, $test_object->get_identifier(false));
if (!isset($compare_subsystems[$test_object->get_test_hardware_type()])) {
$compare_subsystems[$test_object->get_test_hardware_type()] = 1;
} else {
$compare_subsystems[$test_object->get_test_hardware_type()] += 1;
}
}
}
if (empty($compare_tests)) {
$subsystem_under_test = pts_user_io::prompt_text_menu('Sub-System To Test', array('Processor', 'Graphics', 'Disk'));
} else {
arsort($compare_subsystems);
$compare_subsystems = array_keys($compare_subsystems);
$subsystem_under_test = array_shift($compare_subsystems);
}
$system_info = array_merge(phodevi::system_hardware(false), phodevi::system_software(false));
$to_include = array();
$to_exclude = array();
if (isset($system_info[$subsystem_under_test])) {
$compare_component = $system_info[$subsystem_under_test];
} else {
return;
}
switch ($subsystem_under_test) {
case 'Processor':
self::system_component_to_format($system_info, $to_include, array('OS', 'Compiler', 'Kernel', 'Motherboard'), true);
break;
case 'Graphics':
self::system_component_to_format($system_info, $to_include, array('OS', 'Display Driver', 'OpenGL', 'Processor', 'Kernel', 'Desktop'), true);
break;
case 'OS':
self::system_component_to_format($system_info, $to_include, array('Processor', 'Motherboard', 'Graphics', 'Disk'), true);
self::system_component_to_format($system_info, $to_exclude, array('OS'));
break;
case 'Disk':
self::system_component_to_format($system_info, $to_include, array('Processor', 'OS', 'Chipset', 'Motherboard', 'Kernel'), true);
break;
}
$payload = array('subsystem_under_test' => $subsystem_under_test, 'component_under_test' => $compare_component, 'include_components' => implode(',', $to_include), 'exclude_components' => implode(',', $to_exclude), 'include_tests' => implode(',', $compare_tests));
echo PHP_EOL . 'Querying test data from OpenBenchmarking.org...' . PHP_EOL;
$json = pts_openbenchmarking::make_openbenchmarking_request('auto_generate_comparison', $payload);
$json = json_decode($json, true);
if (isset($json['auto_compare']['public_ids']) && isset($json['auto_compare']['count']) && $json['auto_compare']['count'] > 0) {
echo 'Found ' . $json['auto_compare']['count'] . ' comparable results on OpenBenchmarking.org with a ' . $json['auto_compare']['accuracy'] . '% accuracy.' . PHP_EOL;
$compare_results = array();
foreach ($json['auto_compare']['public_ids'] as $public_id) {
$result_xml = pts_openbenchmarking::clone_openbenchmarking_result($public_id, true);
if ($result_xml) {
$result_file = new pts_result_file($result_xml);
$result_objects = $result_file->get_result_objects();
foreach ($result_objects as $i => &$result_object) {
if (!empty($compare_tests)) {
if (!in_array($result_object->test_profile->get_identifier(false), $compare_tests)) {
unset($result_objects[$i]);
}
} else {
if ($result_object->test_profile->get_test_hardware_type() != $subsystem_under_test) {
unset($result_objects[$i]);
}
}
}
if (count($result_objects) == 0) {
continue;
}
$result_file->override_result_objects($result_objects);
array_push($compare_results, $result_file);
}
}
if (count($compare_results) > 0) {
$result_xml = pts_merge::merge_test_results_array($compare_results);
if (count($compare_results) > 2) {
$result_file = new pts_result_file($result_xml);
$result_objects = $result_file->get_result_objects();
$system_count = $result_file->get_system_count();
$result_count = count($result_objects);
$result_match_count = array();
if ($result_count > 3) {
foreach ($result_objects as $i => &$result_object) {
$result_match_count[$i] = $result_object->test_result_buffer->get_count();
}
arsort($result_match_count);
$biggest_size = pts_arrays::first_element($result_match_count);
if ($biggest_size == $system_count || $biggest_size > 3) {
foreach ($result_match_count as $key => $value) {
if ($value < 2) {
unset($result_objects[$key]);
}
}
}
$result_file->override_result_objects($result_objects);
$result_xml = pts_merge::merge_test_results_array(array($result_file));
}
}
//.........这里部分代码省略.........
示例5: cache_software_calls
public static function cache_software_calls()
{
phodevi::system_software(true);
}
示例6: init_account
public static function init_account($openbenchmarking, $settings)
{
if (isset($openbenchmarking['user_name']) && isset($openbenchmarking['communication_id']) && isset($openbenchmarking['sav'])) {
if (IS_FIRST_RUN_TODAY && pts_network::internet_support_available()) {
// Might as well make sure OpenBenchmarking.org account has the latest system info
// But don't do it everytime to preserve bandwidth
$openbenchmarking['s_s'] = base64_encode(phodevi::system_software(true));
$openbenchmarking['s_h'] = base64_encode(phodevi::system_hardware(true));
$return_state = pts_openbenchmarking::make_openbenchmarking_request('account_verify', $openbenchmarking);
$json = json_decode($return_state, true);
if (isset($json['openbenchmarking']['account']['valid'])) {
// The account is valid
self::$openbenchmarking_account = $openbenchmarking;
self::$client_settings = $json['openbenchmarking']['account']['settings'];
pts_storage_object::set_in_file(PTS_CORE_STORAGE, 'openbenchmarking_account_settings', $json['openbenchmarking']['account']['settings']);
} 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);
}
} else {
self::$openbenchmarking_account = $openbenchmarking;
self::$client_settings = $settings;
}
}
}
示例7: run
public static function run($r)
{
pts_client::$display->generic_heading('System Information');
echo 'Hardware:' . PHP_EOL . phodevi::system_hardware(true) . PHP_EOL . PHP_EOL;
echo 'Software:' . PHP_EOL . phodevi::system_software(true) . PHP_EOL . PHP_EOL;
}
示例8: save_results_prompt
public function save_results_prompt()
{
if (!$this->auto_mode) {
pts_client::$display->generic_heading('System Information');
echo 'Hardware:' . PHP_EOL . phodevi::system_hardware(true) . PHP_EOL . PHP_EOL;
echo 'Software:' . PHP_EOL . phodevi::system_software(true) . PHP_EOL . PHP_EOL;
}
if (($this->prompt_save_results || $this->force_save_results) && count($this->tests_to_run) > 0) {
if ($this->force_save_results || pts_client::read_env('TEST_RESULTS_NAME')) {
$save_results = true;
} else {
if ($this->batch_mode) {
$save_results = $this->batch_mode['SaveResults'];
} else {
if (pts_client::is_debug_mode()) {
$save_results = false;
} else {
$save_results = pts_user_io::prompt_bool_input('Would you like to save these test results', true);
}
}
}
if ($save_results) {
// Prompt Save File Name
$this->prompt_save_name();
// Prompt Identifier
$this->prompt_results_identifier();
if (!isset($this->run_description[16]) || strpos($this->run_description, 'via the Phoronix Test Suite') !== false) {
// Write the auto-description if nothing is set or attempt to auto-detect if it was a previous auto-description saved
$this->run_description = self::auto_generate_description();
}
// Prompt Description
if (!$this->batch_mode || $this->batch_mode['PromptForTestDescription']) {
if ($this->run_description == null) {
$this->run_description = 'N/A';
}
if (pts_client::read_env('TEST_RESULTS_DESCRIPTION')) {
if (strlen(pts_client::read_env('TEST_RESULTS_DESCRIPTION')) > 1) {
$this->run_description = pts_client::read_env('TEST_RESULTS_DESCRIPTION');
echo 'Test Description: ' . $this->run_description . PHP_EOL;
}
} else {
if (!$this->auto_mode) {
//echo PHP_EOL . 'Current Title: ' . $this->file_name_title . PHP_EOL;
pts_client::$display->generic_heading('If you wish, enter a new description below to better describe this result set / system configuration under test.' . PHP_EOL . 'Press ENTER to proceed without changes.');
echo 'Current Description: ' . $this->run_description . PHP_EOL . PHP_EOL . 'New Description: ';
$new_test_description = pts_user_io::read_user_input();
if (!empty($new_test_description)) {
$this->run_description = $new_test_description;
}
}
}
}
}
}
}
示例9: run
public static function run($r)
{
pts_openbenchmarking::refresh_repository_lists();
pts_client::$display->generic_heading('Interactive Benchmarking');
echo 'System Hardware:' . PHP_EOL . phodevi::system_hardware(true) . (phodevi::read_property('motherboard', 'serial-number') != null ? PHP_EOL . 'System Serial Number: ' . phodevi::read_property('motherboard', 'serial-number') : null) . PHP_EOL . PHP_EOL . PHP_EOL;
$reboot_on_exit = false;
do {
$options = array('RUN_TEST' => 'Run A Test', 'RUN_SUITE' => 'Run A Suite [A Collection Of Tests]', 'RUN_SYSTEM_TEST' => 'Run Complex System Test', 'SHOW_INFO' => 'Show System Hardware / Software Information', 'SHOW_SENSORS' => 'Show Auto-Detected System Sensors', 'SET_RUN_COUNT' => 'Set Test Run Repetition');
if (count(pts_client::saved_test_results()) > 0) {
$options['BACKUP_RESULTS_TO_USB'] = 'Backup Results To Media Storage';
}
$options['EXIT'] = $reboot_on_exit ? 'Exit & Reboot' : 'Exit';
$response = pts_user_io::prompt_text_menu('Select Task', $options, false, true);
switch ($response) {
case 'RUN_TEST':
$supported_tests = pts_openbenchmarking::available_tests();
$supported_tests = pts_types::identifiers_to_test_profile_objects($supported_tests, false, true);
$longest_title_length = 0;
foreach ($supported_tests as $i => &$test_profile) {
if ($test_profile->get_title() == null) {
unset($supported_tests[$i]);
continue;
}
$longest_title_length = max($longest_title_length, strlen($test_profile->get_title()));
}
$t = array();
foreach ($supported_tests as $i => &$test_profile) {
if ($test_profile instanceof pts_test_profile) {
$t[$test_profile->get_identifier()] = sprintf('%-' . ($longest_title_length + 1) . 'ls - %-10ls', $test_profile->get_title(), $test_profile->get_test_hardware_type());
}
}
$supported_tests = $t;
asort($supported_tests);
$tests_to_run = pts_user_io::prompt_text_menu('Select Test', $supported_tests, true, true);
$tests_to_run = explode(',', $tests_to_run);
pts_test_installer::standard_install($tests_to_run);
$run_manager = new pts_test_run_manager(false, 2);
$run_manager->standard_run($tests_to_run);
if ($run_manager != false) {
pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $run_manager->get_file_name() . '/index.html', null, true, true);
}
break;
case 'RUN_SUITE':
$possible_suites = pts_openbenchmarking::available_suites();
foreach (array_map('strtolower', pts_types::subsystem_targets()) as $subsystem) {
array_push($possible_suites, 'pts/' . $subsystem);
}
$suites_to_run = pts_user_io::prompt_text_menu('Select Suite', $possible_suites, true);
foreach (explode(',', $suites_to_run) as $suite_to_run) {
pts_test_installer::standard_install($suite_to_run);
$run_manager = new pts_test_run_manager(false, 2);
$run_manager->standard_run($suite_to_run);
}
break;
case 'SELECT_DRIVE_MOUNT':
self::select_drive_mount();
break;
case 'RUN_SYSTEM_TEST':
pts_client::$display->generic_heading('System Test');
$system_tests = array('apache', 'c-ray', 'ramspeed', 'postmark');
pts_test_installer::standard_install($system_tests);
$run_manager = new pts_test_run_manager(false, 2);
$run_manager->standard_run($system_tests);
if ($run_manager != false) {
pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $run_manager->get_file_name() . '/index.html', null, true, true);
}
break;
case 'SHOW_INFO':
pts_client::$display->generic_heading('System Software / Hardware Information');
echo 'Hardware:' . PHP_EOL . phodevi::system_hardware(true) . PHP_EOL . PHP_EOL;
echo 'Software:' . PHP_EOL . phodevi::system_software(true) . PHP_EOL . PHP_EOL;
break;
case 'SHOW_SENSORS':
pts_client::$display->generic_heading('Detected System Sensors');
foreach (phodevi::supported_sensors() as $sensor) {
echo phodevi::sensor_name($sensor) . ': ' . phodevi::read_sensor($sensor) . ' ' . phodevi::read_sensor_unit($sensor) . PHP_EOL;
}
break;
case 'SET_RUN_COUNT':
$run_count = pts_user_io::prompt_user_input('Set the minimum number of times each test should repeat', false);
putenv('FORCE_TIMES_TO_RUN=' . trim($run_count));
break;
case 'BACKUP_RESULTS_TO_USB':
pts_client::$display->generic_heading('Backing Up Test Results');
foreach (pts_file_io::glob('/media/*') as $media_dir) {
if (!is_writable($media_dir)) {
echo PHP_EOL . $media_dir . ' is not writable.' . PHP_EOL;
continue;
}
echo PHP_EOL . 'Writing Test Results To: ' . $media_dir . PHP_EOL;
pts_file_io::copy(PTS_SAVE_RESULTS_PATH, $media_dir . '/');
break;
}
break;
}
echo PHP_EOL . PHP_EOL;
} while ($response != 'EXIT');
if ($reboot_on_exit) {
if (is_dir('/media/pts-auto-mount')) {
pts_file_io::delete('/media/pts-auto-mount/pts', null, true);
//.........这里部分代码省略.........
示例10: add_current_system_information
public function add_current_system_information()
{
$this->xml_writer->addXmlNode('PhoronixTestSuite/System/Identifier', $this->result_identifier);
$this->xml_writer->addXmlNode('PhoronixTestSuite/System/Hardware', phodevi::system_hardware(true));
$this->xml_writer->addXmlNode('PhoronixTestSuite/System/Software', phodevi::system_software(true));
$this->xml_writer->addXmlNode('PhoronixTestSuite/System/User', pts_client::current_user());
$this->xml_writer->addXmlNode('PhoronixTestSuite/System/TimeStamp', date('Y-m-d H:i:s'));
$this->xml_writer->addXmlNode('PhoronixTestSuite/System/TestClientVersion', PTS_VERSION);
//$this->xml_writer->addXmlNode('PhoronixTestSuite/System/Notes', pts_test_notes_manager::generate_test_notes($test_type));
}
示例11: run_connection
public static function run_connection($args)
{
if (pts_client::create_lock(PTS_USER_PATH . 'phoromatic_lock') == false) {
trigger_error('Phoromatic is already running.', E_USER_ERROR);
return false;
}
define('PHOROMATIC_PROCESS', true);
if (pts_client::$pts_logger == false) {
pts_client::$pts_logger = new pts_logger();
}
pts_client::$pts_logger->log(pts_title(true) . ' [' . PTS_CORE_VERSION . '] starting Phoromatic client');
if (phodevi::system_uptime() < 60) {
echo 'PHOROMATIC: Sleeping for 60 seconds as system freshly started.' . PHP_EOL;
pts_client::$pts_logger->log('Sleeping for 60 seconds as system freshly started');
sleep(60);
}
$server_setup = self::setup_server_addressing($args);
//$http_comm = new phoromatic_client_comm_http();
if (!$server_setup) {
if (PTS_IS_DAEMONIZED_SERVER_PROCESS) {
if (pts_client::executable_in_path('reboot')) {
shell_exec('reboot');
sleep(5);
}
}
return false;
}
$times_failed = 0;
$has_success = false;
$do_exit = false;
$just_started = true;
self::setup_system_environment();
pts_client::$pts_logger->log('SYSTEM HARDWARE: ' . phodevi::system_hardware(true));
pts_client::$pts_logger->log('SYSTEM SOFTWARE: ' . phodevi::system_software(true));
while ($do_exit == false) {
$server_response = phoromatic::upload_to_remote_server(array('r' => 'start'));
if ($server_response == false) {
$times_failed++;
pts_client::$pts_logger->log('Server response failed');
if ($times_failed >= 2) {
trigger_error('Communication with server failed.', E_USER_ERROR);
if (PTS_IS_DAEMONIZED_SERVER_PROCESS == false && $times_failed > 5) {
return false;
} else {
if (PTS_IS_DAEMONIZED_SERVER_PROCESS && $times_failed > 10) {
if (pts_client::executable_in_path('reboot')) {
shell_exec('reboot');
sleep(5);
}
}
}
}
} else {
if (substr($server_response, 0, 1) == '[') {
// Likely a notice/warning from server
echo PHP_EOL . substr($server_response, 0, strpos($server_response, PHP_EOL)) . PHP_EOL;
} else {
if (substr($server_response, 0, 1) == '{') {
$times_failed = 0;
$json = json_decode($server_response, true);
if ($has_success == false) {
$has_success = true;
pts_module::save_file('last-phoromatic-server', self::$server_address . ':' . self::$server_http_port . '/' . self::$account_id);
}
if ($json != null) {
if (isset($json['phoromatic']['error']) && !empty($json['phoromatic']['error'])) {
trigger_error($json['phoromatic']['error'], E_USER_ERROR);
}
if (isset($json['phoromatic']['response']) && !empty($json['phoromatic']['response'])) {
echo PHP_EOL . $json['phoromatic']['response'] . PHP_EOL;
}
}
if ($just_started) {
if (PTS_IS_DAEMONIZED_SERVER_PROCESS) {
$pid = pcntl_fork();
if ($pid == 0) {
// Start the tick thread
self::tick_thread();
}
}
$just_started = false;
}
if (isset($json['phoromatic']['pre_set_sys_env_vars']) && !empty($json['phoromatic']['pre_set_sys_env_vars'])) {
// pre_set_sys_env_vars was added during PTS 5.8 development
// Sets environment variables on client as specified via the Phoromatic Server's systems page
foreach (explode(';', $json['phoromatic']['pre_set_sys_env_vars']) as $i => $v_string) {
$var = explode('=', $v_string);
if (count($var) == 2) {
putenv($var[0] . '=' . $var[1]);
}
}
}
switch (isset($json['phoromatic']['task']) ? $json['phoromatic']['task'] : null) {
case 'install':
phoromatic::update_system_status('Installing Tests');
pts_suite_nye_XmlReader::set_temporary_suite('pre-seed', $json['phoromatic']['test_suite']);
pts_test_installer::standard_install('pre-seed');
break;
case 'benchmark':
// Make sure all latest tests are available
//.........这里部分代码省略.........
示例12: update_system_details
protected static function update_system_details()
{
$server_response = phoromatic::upload_to_remote_server(array('r' => 'update_system_details', 'h' => phodevi::system_hardware(true), 's' => phodevi::system_software(true)));
self::$phoromatic_server_build = self::read_xml_value($server_response, M_PHOROMATIC_SERVER_BUILD);
return self::read_xml_value($server_response, M_PHOROMATIC_GEN_RESPONSE) == M_PHOROMATIC_RESPONSE_TRUE;
}
示例13: run
//.........这里部分代码省略.........
continue;
}
if ($is_moscow && pts_test_install_request::test_files_available_locally($test_profile) == false) {
// Don't show tests where files need to be downloaded
unset($supported_tests[$i]);
continue;
}
$longest_title_length = max($longest_title_length, strlen($test_profile->get_title()));
}
$t = array();
foreach ($supported_tests as $i => &$test_profile) {
if ($test_profile instanceof pts_test_profile) {
$t[$test_profile->get_identifier()] = sprintf('%-' . ($longest_title_length + 1) . 'ls - %-10ls', $test_profile->get_title(), $test_profile->get_test_hardware_type());
}
}
$supported_tests = $t;
asort($supported_tests);
$tests_to_run = pts_user_io::prompt_text_menu('Select Test', $supported_tests, true, true);
$tests_to_run = explode(',', $tests_to_run);
pts_test_installer::standard_install($tests_to_run);
$run_manager = pts_test_run_manager::standard_run($tests_to_run, pts_c::defaults_mode | pts_c::auto_mode);
if ($run_manager != false) {
pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $run_manager->get_file_name() . '/index.html', null, true, true);
}
break;
case 'RUN_SUITE':
$possible_suites = pts_openbenchmarking::available_suites();
foreach (array_map('strtolower', pts_types::subsystem_targets()) as $subsystem) {
array_push($possible_suites, 'pts/' . $subsystem);
}
$suites_to_run = pts_user_io::prompt_text_menu('Select Suite', $possible_suites, true);
foreach (explode(',', $suites_to_run) as $suite_to_run) {
pts_test_installer::standard_install($suite_to_run);
pts_test_run_manager::standard_run($suite_to_run, pts_c::defaults_mode | pts_c::auto_mode);
}
break;
case 'SELECT_DRIVE_MOUNT':
self::select_drive_mount();
break;
case 'RUN_SYSTEM_TEST':
pts_client::$display->generic_heading('System Test');
$system_tests = array('apache', 'c-ray', 'ramspeed', 'postmark');
pts_test_installer::standard_install($system_tests);
$run_manager = pts_test_run_manager::standard_run($system_tests, pts_c::defaults_mode | pts_c::auto_mode);
if ($run_manager != false) {
pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $run_manager->get_file_name() . '/index.html', null, true, true);
}
break;
case 'SHOW_INFO':
pts_client::$display->generic_heading('System Software / Hardware Information');
echo 'Hardware:' . PHP_EOL . phodevi::system_hardware(true) . PHP_EOL . PHP_EOL;
echo 'Software:' . PHP_EOL . phodevi::system_software(true) . PHP_EOL . PHP_EOL;
break;
case 'SHOW_SENSORS':
pts_client::$display->generic_heading('Detected System Sensors');
foreach (phodevi::supported_sensors() as $sensor) {
echo phodevi::sensor_name($sensor) . ': ' . phodevi::read_sensor($sensor) . ' ' . phodevi::read_sensor_unit($sensor) . PHP_EOL;
}
break;
case 'SET_RUN_COUNT':
$run_count = pts_user_io::prompt_user_input('Set the minimum number of times each test should repeat', false);
putenv('FORCE_TIMES_TO_RUN=' . trim($run_count));
break;
case 'BACKUP_RESULTS_TO_USB':
pts_client::$display->generic_heading('Backing Up Test Results');
if ($is_moscow) {
$drives = pts_file_io::glob('/dev/sd*');
sort($drives);
if (count($drives) > 0 && is_writable('/media/')) {
$select_drive = pts_user_io::prompt_text_menu('Select Drive / Partition To Save Results', $drives);
echo PHP_EOL . 'Attempting to mount: ' . $select_drive . PHP_EOL;
mkdir('/media/00-results-backup');
exec('mount ' . $select_drive . ' /media/00-results-backup');
}
}
foreach (pts_file_io::glob('/media/*') as $media_dir) {
if (!is_writable($media_dir)) {
echo PHP_EOL . $media_dir . ' is not writable.' . PHP_EOL;
continue;
}
echo PHP_EOL . 'Writing Test Results To: ' . $media_dir . PHP_EOL;
pts_file_io::copy(PTS_SAVE_RESULTS_PATH, $media_dir . '/');
break;
}
if ($is_moscow && is_dir('/media/00-results-backup')) {
exec('umount /media/00-results-backup');
rmdir('/media/00-results-backup');
}
break;
}
echo PHP_EOL . PHP_EOL;
} while ($response != 'EXIT');
if ($reboot_on_exit) {
if (is_dir('/media/pts-auto-mount')) {
pts_file_io::delete('/media/pts-auto-mount/pts', null, true);
exec('umount /media/pts-auto-mount 2>&1');
}
exec('reboot');
}
}