public static function run($args) { $result_file = new pts_result_file($args[0]); $result_file_identifiers = $result_file->get_system_identifiers(); if (count($result_file_identifiers) < 2) { echo PHP_EOL . 'There are not multiple test runs in this result file.' . PHP_EOL; return false; } echo PHP_EOL . 'Enter The New Order To Display The New Results, From Left To Right.' . PHP_EOL; $sorted_identifiers = array(); do { $extract_identifier = pts_user_io::prompt_text_menu('Select the test run to be showed next', $result_file_identifiers); $sorted_identifiers[] = $extract_identifier; $old_identifiers = $result_file_identifiers; $result_file_identifiers = array(); foreach ($old_identifiers as $identifier) { if ($identifier != $extract_identifier) { $result_file_identifiers[] = $identifier; } } } while (count($result_file_identifiers) > 0); $result_file->reorder_runs($sorted_identifiers); pts_client::save_test_result($result_file->get_file_location(), $result_file->get_xml()); pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $args[0] . '/index.html'); }
public static function run($r) { $result_file = new pts_result_file($r[0]); $result_file_identifiers = $result_file->get_system_identifiers(); if (count($result_file_identifiers) < 2) { echo PHP_EOL . 'There are not multiple test runs in this result file.' . PHP_EOL; return false; } $remove_identifiers = explode(',', pts_user_io::prompt_text_menu('Select the test run(s) to remove', $result_file_identifiers, true)); $result_file->remove_run($remove_identifiers); $result_dir = dirname($result_file->get_file_location()) . '/'; foreach (array('test-logs', 'system-logs', 'installation-logs') as $dir_name) { foreach ($remove_identifiers as $remove_identifier) { if (is_dir($result_dir . $dir_name . '/' . $remove_identifier)) { pts_file_io::delete($result_dir . $dir_name . '/' . $remove_identifier, null, true); } } } pts_client::save_test_result($result_file->get_file_location(), $result_file->get_xml()); pts_client::display_web_page($result_dir . '/index.html'); }
public static function run($args) { $result_file = new pts_result_file($args[0]); $result_file_identifiers = $result_file->get_system_identifiers(); if (count($result_file_identifiers) < 2) { echo PHP_EOL . 'There are not multiple test runs in this result file.' . PHP_EOL; return false; } $extract_selects = array(); echo PHP_EOL . 'Automatically sorting the results...' . PHP_EOL; sort($result_file_identifiers); $result_file->reorder_runs($result_file_identifiers); pts_client::save_test_result($result_file->get_file_location(), $result_file->get_xml()); pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $args[0] . '/index.html'); }
public static function run($r) { $result = $r[0]; $result_file = new pts_result_file($result); $result_file_identifiers = $result_file->get_system_identifiers(); $rename_identifier = pts_user_io::prompt_text_menu('Select the test run to rename', $result_file_identifiers); $rename_identifier_new = pts_user_io::prompt_user_input('Enter the new identifier'); foreach (array('test-logs', 'system-logs', 'installation-logs') as $dir_name) { if (is_dir(PTS_SAVE_RESULTS_PATH . $r[0] . '/' . $dir_name . '/' . $rename_identifier)) { rename(PTS_SAVE_RESULTS_PATH . $r[0] . '/' . $dir_name . '/' . $rename_identifier, PTS_SAVE_RESULTS_PATH . $r[0] . '/' . $dir_name . '/' . $rename_identifier_new); } } $result_file->rename_run($rename_identifier, $rename_identifier_new); pts_client::save_test_result($result_file->get_file_location(), $result_file->get_xml()); pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $r[0] . '/index.html'); }
public static function run($r) { $result_file = new pts_result_file($r[0]); $result_title = $result_file->get_title(); echo PHP_EOL . 'Current Result Title: ' . $result_title . PHP_EOL; $new_title = pts_user_io::prompt_user_input('Enter New Title'); if (!empty($new_title)) { $result_file->set_title($new_title); } $result_description = $result_file->get_description(); echo PHP_EOL . 'Current Result Description: ' . $result_description . PHP_EOL; $new_description = pts_user_io::prompt_user_input('Enter New Description'); if (!empty($new_description)) { $result_file->set_description($new_description); } pts_client::save_test_result($result_file->get_file_location(), $result_file->get_xml()); pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $r[0] . '/index.html'); }
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) { $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) { $ret = pts_openbenchmarking::clone_openbenchmarking_result($public_id); if ($ret) { $result_file = new pts_result_file($public_id); $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); pts_client::save_test_result($result_file->get_file_location(), $result_file->get_xml()); $compare_results[] = $public_id; } } if (count($compare_results) > 0) { $result_file = new pts_result_file(null, true); $result_file->merge($compare_results); $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); } pts_client::save_test_result('auto-comparison/composite.xml', $result_file->get_xml()); } } pts_test_installer::standard_install(array('auto-comparison')); $test_run_manager = new pts_test_run_manager(); $test_run_manager->standard_run(array('auto-comparison')); }