public static function run($args) { $result = $args[0]; $result_file = new pts_result_file($result); $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 . 'Enter The New Order To Display The New Results, From Left To Right.' . PHP_EOL; do { $extract_identifier = pts_user_io::prompt_text_menu('Select the test run to be showed next', $result_file_identifiers); array_push($extract_selects, new pts_result_merge_select($result, $extract_identifier)); $old_identifiers = $result_file_identifiers; $result_file_identifiers = array(); foreach ($old_identifiers as $identifier) { if ($identifier != $extract_identifier) { array_push($result_file_identifiers, $identifier); } } } while (count($result_file_identifiers) > 0); $ordered_result = pts_merge::merge_test_results_array($extract_selects); pts_client::save_test_result($args[0] . '/composite.xml', $ordered_result); pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $args[0] . '/index.html'); }
public static function run($r) { $identifier = $r[0]; $test_xml_files = pts_file_io::glob(PTS_SAVE_RESULTS_PATH . $identifier . '/test-*.xml'); if (count($test_xml_files) == 0) { echo PHP_EOL . 'No test XML data was found.' . PHP_EOL; return false; } pts_client::save_test_result($identifier . '/composite.xml', pts_merge::merge_test_results_array($test_xml_files)); pts_client::regenerate_graphs($identifier, 'The ' . $identifier . ' result file XML has been rebuilt.'); }
public static function run($args) { $result = $args[0]; $result_file = new pts_result_file($result); $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); foreach ($result_file_identifiers as $identifier) { array_push($extract_selects, new pts_result_merge_select($result, $identifier)); } $ordered_result = pts_merge::merge_test_results_array($extract_selects); pts_client::save_test_result($args[0] . '/composite.xml', $ordered_result); 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'); $merge_selects = array(); foreach ($result_file_identifiers as $identifier) { $this_merge_select = new pts_result_merge_select($result, $identifier); if ($identifier == $rename_identifier && $rename_identifier != $rename_identifier_new) { $this_merge_select->rename_identifier($rename_identifier_new); } array_push($merge_selects, $this_merge_select); } 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); } } $extract_result = pts_merge::merge_test_results_array($merge_selects); pts_client::save_test_result($r[0] . '/composite.xml', $extract_result); 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) { 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)); } } pts_client::save_test_result('auto-comparison/composite.xml', $result_xml); } } pts_test_installer::standard_install(array('auto-comparison')); pts_test_run_manager::standard_run(array('auto-comparison')); }
public static function multi_way_identifier_check($identifiers, &$system_hardware = null, &$result_file = null) { /* Samples To Use For Testing: 1109026-LI-AMDRADEON57 */ $systems = array(); $targets = array(); $is_multi_way = true; $is_multi_way_inverted = false; $is_ordered = true; $prev_system = null; foreach ($identifiers as $identifier) { $identifier_r = explode(':', $identifier); if (count($identifier_r) != 2 || isset($identifier[14]) && $identifier[4] == '-' && $identifier[13] == ':') { // the later check will fix 0000-00-00 00:00 as breaking into date return false; } if (false && $is_ordered && $prev_system != null && $prev_system != $identifier_r[0] && isset($systems[$identifier_r[0]])) { // The results aren't ordered $is_ordered = false; if ($result_file == null) { return false; } } $prev_system = $identifier_r[0]; $systems[$identifier_r[0]] = !isset($systems[$identifier_r[0]]) ? 1 : $systems[$identifier_r[0]] + 1; $targets[$identifier_r[1]] = !isset($targets[$identifier_r[1]]) ? 1 : $targets[$identifier_r[1]] + 1; } if (false && $is_ordered == false && $is_multi_way) { // TODO: get the reordering code to work if ($result_file instanceof pts_result_file) { // Reorder the result file $to_order = array(); sort($identifiers); foreach ($identifiers as $identifier) { array_push($to_order, new pts_result_merge_select($result_file, $identifier)); } $ordered_xml = pts_merge::merge_test_results_array($to_order); $result_file = new pts_result_file($ordered_xml); $is_multi_way = true; } else { $is_multi_way = false; } } $is_multi_way_inverted = $is_multi_way && count($targets) > count($systems); /* if($is_multi_way) { if(count($systems) < 3 && count($systems) != count($targets)) { $is_multi_way = false; } } */ // TODO XXX: for now temporarily disable inverted multi-way check to decide how to rework it appropriately /* if($is_multi_way) { $targets_count = count($targets); $systems_count = count($systems); if($targets_count > $systems_count) { $is_multi_way_inverted = true; } else if(is_array($system_hardware)) { $hardware = array_unique($system_hardware); //$software = array_unique($system_software); if($targets_count != $systems_count && count($hardware) == $systems_count) { $is_multi_way_inverted = true; } else if(count($hardware) == ($targets_count * $systems_count)) { $is_multi_way_inverted = true; } } } */ // TODO: figure out what else is needed to reasonably determine if the result file is a multi-way comparison return $is_multi_way ? array($is_multi_way, $is_multi_way_inverted) : false; }
Copyright (C) 2015, Phoronix Media Copyright (C) 2015, 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 the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ $result_share_opt = phoromatic_server::read_setting('force_result_sharing') ? '1 = 1' : 'AccountID IN (SELECT AccountID FROM phoromatic_account_settings WHERE LetOtherGroupsViewResults = "1")'; $stmt = phoromatic_server::$db->prepare('SELECT AccountID, UploadID FROM phoromatic_results WHERE (' . $result_share_opt . ' OR AccountID = :account_id) AND PPRID = :pprid LIMIT 1'); $stmt->bindValue(':account_id', ACCOUNT_ID); $stmt->bindValue(':pprid', $ID); $result = $stmt->execute(); if ($result && ($row = $result->fetchArray())) { $composite_xml = phoromatic_server::phoromatic_account_result_path($row['AccountID'], $row['UploadID']) . 'composite.xml'; if ($composite_xml) { $composite_xml = pts_merge::merge_test_results_array(array($composite_xml)); $json['phoromatic']['result']['composite_xml'] = base64_encode($composite_xml); //$json['phoromatic']['result']['system_logs_available'] = is_file($sys_log_file) ? sha1_file($sys_log_file) : false; echo json_encode($json); return; } }