How to use phoromatic_result class

Best Phoronix-test-suite code snippet using phoromatic_result

phoromatic_result.php

Source:phoromatic_result.php Github

copy

Full Screen

...14 GNU General Public License for more details.15 You should have received a copy of the GNU General Public License16 along with this program. If not, see <http://www.gnu.org/licenses/>.17*/18class phoromatic_result implements pts_webui_interface19{20 protected static $schedule_id = false;21 public static function page_title()22 {23 return 'Result';24 }25 public static function page_header()26 {27 return null;28 }29 public static function preload($PAGE)30 {31 return true;32 }33 public static function render_page_process($PATH)34 {35 $main = null;36 if(isset($PATH[0]))37 {38 $upload_ids = explode(',', $PATH[0]);39 foreach($upload_ids as $i => &$upload_id)40 {41 if(($x = strpos($upload_id, '&')) !== false)42 {43 $upload_id = substr($upload_id, 0, $x);44 }45 if(isset($upload_id[5]) && substr($upload_id, 0, 2) == 'S:')46 {47 $t = explode(':', $upload_id);48 $stmt = phoromatic_server::$db->prepare('SELECT UploadID, UploadTime FROM phoromatic_results WHERE AccountID = :account_id AND ScheduleID = :schedule_id ORDER BY UploadTime DESC');49 $stmt->bindValue(':account_id', $_SESSION['AccountID']);50 $stmt->bindValue(':schedule_id', $t[1]);51 $test_result_result = $stmt->execute();52 $cutoff_time = is_numeric($t[2]) ? strtotime('today -' . $t[2] . ' days') : false;53 while($test_result_row = $test_result_result->fetchArray())54 {55 if($cutoff_time !== false && strtotime($test_result_row['UploadTime']) < $cutoff_time)56 break;57 $upload_ids[] = $test_result_row['UploadID'];58 }59 unset($upload_ids[$i]);60 }61 }62 $upload_ids = array_unique($upload_ids);63 $result_files = array();64 $display_rows = array();65 $system_types = array();66 $schedule_types = array();67 $trigger_types = array();68 $benchmark_tickets = array();69 $tickets = array();70 $showed_progress_msg = false;71 foreach($upload_ids as $id)72 {73 $result_share_opt = phoromatic_server::read_setting('force_result_sharing') ? '1 = 1' : 'AccountID = (SELECT AccountID FROM phoromatic_account_settings WHERE LetOtherGroupsViewResults = "1" AND AccountID = phoromatic_results.AccountID)';74 $stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_results WHERE PPRID = :pprid AND (AccountID = :account_id OR ' . $result_share_opt . ') LIMIT 1');75 $stmt->bindValue(':pprid', $id);76 $stmt->bindValue(':account_id', $_SESSION['AccountID']);77 $result = $stmt->execute();78 $row = $result->fetchArray();79 if(empty($row))80 continue;81 $composite_xml = phoromatic_server::phoromatic_account_result_path($row['AccountID'], $row['UploadID']) . 'composite.xml';82 if(!is_file($composite_xml))83 {84 echo 'File Not Found: ' . $composite_xml;85 return false;86 }87 $has_system_logs = is_file(phoromatic_server::phoromatic_account_result_path($_SESSION['AccountID'], $row['UploadID']) . 'system-logs.zip') ? $row['UploadID'] : false;88 $display_rows[$composite_xml] = $row;89 pts_arrays::unique_push($benchmark_tickets, $row['BenchmarkTicketID']);90 pts_arrays::unique_push($system_types, $row['SystemID']);91 pts_arrays::unique_push($schedule_types, $row['ScheduleID']);92 pts_arrays::unique_push($trigger_types, $row['Trigger']);93 pts_arrays::unique_push($tickets, $row['BenchmarkTicketID']);94 if($row['InProgress'] > 0 && !$showed_progress_msg)95 {96 $showed_progress_msg = true;97 $main .= '<p align="center"><strong style="color: red;">The result file being shown is still undergoing testing, results being shown for completed results.</strong></p>';98 }99 // Update view counter100 $stmt_view = phoromatic_server::$db->prepare('UPDATE phoromatic_results SET TimesViewed = (TimesViewed + 1) WHERE AccountID = :account_id AND UploadID = :upload_id');101 $stmt_view->bindValue(':account_id', $_SESSION['AccountID']);102 $stmt_view->bindValue(':upload_id', $row['UploadID']);103 $stmt_view->execute();104 }105 $result_file_title = null;106 if(count($system_types) == 1)107 {108 $result_file_title = phoromatic_system_id_to_name($system_types[0]) . ' Tests';109 }110 if(!empty($tickets) && $tickets[0] != null)111 {112 $system_name_format = 'ORIGINAL_DATA';113 }114 else if(count($trigger_types) == 1 && $trigger_types[0] != null && $benchmark_tickets[0] != null && count($display_rows) > 1)115 {116 $system_name_format = 'TRIGGER_AND_SYSTEM';117 }118 else if(empty($schedule_types[0]))119 {120 $system_name_format = 'ORIGINAL_DATA';121 }122 else if(count($display_rows) == 1)123 {124 $system_name_format = 'SYSTEM_NAME';125 }126 else if(count($schedule_types) == 1 && count($system_types) == 1)127 {128 $system_name_format = 'TRIGGER';129 $result_file_title = phoromatic_schedule_id_to_name($schedule_types[0]);130 }131 else if(count($schedule_types) == 1)132 {133 $system_name_format = 'TRIGGER_AND_SYSTEM';134 }135 else if(false && count($trigger_types) == 1)136 {137 // TODO XXX: this approach yields garbage strings generally without refining the selector138 // i.e. first make sure all the schedules match or are comparable139 $system_name_format = 'SYSTEM_AND_SCHEDULE';140 }141 else142 {143 $system_name_format = null;144 }145 if(count($schedule_types) == 1 && $schedule_types[0] != 0)146 {147 self::$schedule_id = $schedule_types[0];148 }149 if(count($display_rows) == 1)150 {151 // Rather than going through the merge logic and all that, when just one result file, present as is152 $result_file = new pts_result_file(array_pop(array_keys($display_rows)), true);153 }154 else155 {156 foreach($display_rows as $composite_xml => $row)157 {158 switch($system_name_format)159 {160 case 'ORIGINAL_DATA':161 $system_name = null;162 break;163 case 'SYSTEM_NAME':164 $system_name = phoromatic_system_id_to_name($row['SystemID']);165 break;166 case 'TRIGGER':167 $system_name = $row['Trigger'];168 break;169 case 'TRIGGER_AND_SYSTEM':170 $system_name = phoromatic_system_id_to_name($row['SystemID']) . ': ' . $row['Trigger'];171 break;172 case 'SYSTEM_AND_SCHEDULE':173 $system_name = phoromatic_schedule_id_to_name($row['ScheduleID']) . ': ' . $row['Trigger'];174 break;175 default:176 $system_name = phoromatic_system_id_to_name($row['SystemID']) . ' - ' . phoromatic_schedule_id_to_name($row['ScheduleID']) . ' - ' . $row['Trigger'];177 }178 if($system_name == null)179 {180 $rf = new pts_result_file($composite_xml);181 $identifiers = $rf->get_system_identifiers();182 if(count($identifiers) == 1)183 {184 $system_name = $identifiers[0];185 }186 }187 if(($replacement = phoromatic_system_id_to_name($row['SystemID'])) != null)188 {189 $system_name = str_replace('.SYSTEM', $replacement, $system_name);190 }191 if(($replacement = phoromatic_account_id_to_group_name($row['AccountID'])) != null)192 {193 $system_name = str_replace('.GROUP', $replacement, $system_name);194 }195 $system_variables = explode(';', phoromatic_server::system_id_variables($row['SystemID'], $row['AccountID']));196 foreach($system_variables as $var)197 {198 $var = explode('=', $var);199 if(count($var) == 2)200 {201 $system_name = str_replace('.' . $var[0], $var[1], $system_name);202 }203 }204 $rf = new pts_result_file($composite_xml);205 $rf->rename_run(null, $system_name);206 $result_files[] = $rf;207 }208 $result_file = new pts_result_file(null, true);209 if(!empty($result_files))210 {211 $attributes = array('new_result_file_title' => $result_file_title);212 if(!empty($result_files))213 {214 $result_file->merge($result_files, $attributes);215 }216 }217 }218 $embed = new pts_result_viewer_embed($result_file);219 $embed->allow_modifying_results(!PHOROMATIC_USER_IS_VIEWER);220 $embed->allow_deleting_results(!PHOROMATIC_USER_IS_VIEWER);221 $embed->show_html_result_table(false);222 $embed->show_test_metadata_helper(false);223 $embed->include_page_print_only_helpers(false);224 $main .= $embed->get_html();225 }226 $right = null;227 if(self::$schedule_id && !empty(self::$schedule_id))228 {229 $stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_schedules WHERE AccountID = :account_id AND ScheduleID = :schedule_id LIMIT 1');230 $stmt->bindValue(':account_id', $_SESSION['AccountID']);231 $stmt->bindValue(':schedule_id', self::$schedule_id);232 $result = $stmt->execute();233 $row = $result->fetchArray();234 if(!empty($row))235 {236 $right .= '<h3><a href="?schedules/' . $row['ScheduleID'] . '">' . $row['Title'] . '</a></h3>';237 if(!empty($row['ActiveOn']))238 {239 $right .= '<p align="center"><strong>' . phoromatic_schedule_activeon_string($row['ActiveOn'], $row['RunAt']) . '</strong></p>';240 }241 $right .= '<p>Compare this result file to the latest results from the past: ';242 $right .= '<select name="view_results_from_past" id="view_results_from_past" onchange="phoromatic_jump_to_results_from(\'' . $row['ScheduleID'] . '\', \'view_results_from_past\', \'' . $PATH[0] . ',\');">';243 $oldest_upload_time = strtotime(phoromatic_oldest_result_for_schedule(self::$schedule_id));244 $opts = array(245 'Week' => 7,246 'Three Weeks' => 21,247 'Month' => 30,248 'Quarter' => 90,249 'Six Months' => 180,250 'Year' => 365,251 );252 foreach($opts as $str_name => $time_offset)253 {254 if($oldest_upload_time > (time() - (86400 * $time_offset)))255 break;256 $right .= '<option value="' . $time_offset . '">' . $str_name . '</option>';257 }258 $right .= '<option value="all">All Results</option>';259 $right .= '</select>';260 $right .= '</p>';261 }262 }263 if(true)264 {265 $compare_results = array();266 $hash_matches = 0;267 $ticket_matches = 0;268 $stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_results WHERE AccountID = :account_id AND ComparisonHash = :comparison_hash AND PPRID NOT IN (:pprid) ORDER BY UploadTime DESC LIMIT 12');269 $stmt->bindValue(':account_id', $_SESSION['AccountID']);270 $stmt->bindValue(':comparison_hash', $result_file->get_contained_tests_hash(false));271 $stmt->bindValue(':pprid', implode(',', $upload_ids));272 $result = $stmt->execute();273 while($row = $result->fetchArray())274 {275 $compare_results[$row['PPRID']] = $row;276 $hash_matches++;277 }278 foreach($benchmark_tickets as $ticket_id)279 {280 $stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_results WHERE AccountID = :account_id AND BenchmarkTicketID = :ticket_id AND PPRID NOT IN (:pprid) ORDER BY UploadTime DESC LIMIT 12');281 $stmt->bindValue(':account_id', $_SESSION['AccountID']);282 $stmt->bindValue(':ticket_id', $ticket_id);283 $stmt->bindValue(':pprid', implode(',', $upload_ids));284 $result = $stmt->execute();285 while($row = $result->fetchArray())286 {287 $compare_results[$row['PPRID']] = $row;288 $ticket_matches++;289 }290 }291 if(!empty($compare_results))292 {293 $right .= '<hr /><h3>Compare Results</h3><form name="compare_similar_results" onsubmit="return false;">294 <input type="hidden" value="' . implode(',', $upload_ids) . '" id="compare_similar_results_this" />';...

Full Screen

Full Screen

phoromatic_result

Using AI Code Generation

copy

Full Screen

1include_once('phoromatic_result.php');2$phoromatic_result = new phoromatic_result();3$phoromatic_result->add_result('Test Name', 'Result Value');4$phoromatic_result->save_result('Result Title', 'Result Description');5$phoromatic_result->save_result('Result Title', 'Result Description', 'Result Type');6$phoromatic_result->save_result('Result Title', 'Result Description', 'Result Type', 'Result Unit');7$phoromatic_result->save_result('Result Title', 'Result Description', 'Result Type', 'Result Unit', 'Result Precision');8$phoromatic_result->save_result('Result Title', 'Result Description', 'Result Type', 'Result Unit', 'Result Precision', 'Result Comparison');9$phoromatic_result->save_result('Result Title', 'Result Description', 'Result Type', 'Result Unit', 'Result Precision', 'Result Comparison', 'Result Identifier');10$phoromatic_result->save_result('Result Title', 'Result Description', 'Result Type', 'Result Unit', 'Result Precision', 'Result Comparison', 'Result Identifier', 'Result Value');

Full Screen

Full Screen

phoromatic_result

Using AI Code Generation

copy

Full Screen

1require_once('phoromatic_result.php');2$test = new phoromatic_result();3$test->set_test_name('test_name');4$test->set_test_description('test_description');5$test->set_test_result('test_result');6$test->set_test_units('test_units');7$test->set_test_type('test_type');8$test->set_test_environment('test_environment');9$test->set_test_options('test_options');10$test->set_test_arguments('test_arguments');11$test->set_test_system('test_system');12$test->set_test_system_version('test_system_version');13$test->set_test_system_architecture('test_system_architecture');14$test->set_test_system_compiler('test_system_compiler');15$test->set_test_system_compiler_version('test_system_compiler_version');16$test->set_test_system_compiler_flags('test_system_compiler_flags');17$test->set_test_system_kernel('test_system_kernel');18$test->set_test_system_kernel_version('test_system_kernel_version');19$test->set_test_system_kernel_configuration('test_system_kernel_configuration');20$test->set_test_system_architecture('test_system_architecture');21$test->set_test_system_cpu('test_system_cpu');22$test->set_test_system_cpu_cores('test_system_cpu_cores');23$test->set_test_system_cpu_frequency('test_system_cpu_frequency');24$test->set_test_system_cpu_flags('test_system_cpu_flags');25$test->set_test_system_cpu_l1_cache('test_system_cpu_l1_cache');26$test->set_test_system_cpu_l2_cache('test_system_cpu_l2_cache');27$test->set_test_system_cpu_l3_cache('test_system

Full Screen

Full Screen

phoromatic_result

Using AI Code Generation

copy

Full Screen

1$phoromatic_result = new phoromatic_result();2$phoromatic_result->set_result_file("2.php");3$phoromatic_result->set_test_name("Test2");4$phoromatic_result->set_test_description("Test2 description");5$phoromatic_result->set_test_version("1.0.0");6$phoromatic_result->set_test_result("Pass");7$phoromatic_result->set_test_execution_time("1.0");8$phoromatic_result->set_test_execution_time("1.0");9$phoromatic_result->set_test_execution_time("1.0");10$phoromatic_result->set_test_execution_time("1.0");11$phoromatic_result->set_test_execution_time("1.0");12$phoromatic_result->set_test_execution_time("1.0");13$phoromatic_result->set_test_execution_time("1.0");14$phoromatic_result->set_test_execution_time("1.0");15$phoromatic_result->set_test_execution_time("1.0");16$phoromatic_result->set_test_execution_time("1.0");17$phoromatic_result->set_test_execution_time("1.0");18$phoromatic_result->set_test_execution_time("1.0");19$phoromatic_result->set_test_execution_time("1.0");20$phoromatic_result->set_test_execution_time("1.0");21$phoromatic_result->set_test_execution_time("1.0");22$phoromatic_result->set_test_execution_time("1.0");23$phoromatic_result->set_test_execution_time("1.0");24$phoromatic_result->set_test_execution_time("1.0");25$phoromatic_result->set_test_execution_time("1.0");

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Phoronix-test-suite automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used methods in phoromatic_result

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful