How to use available_tests method of pts_openbenchmarking class

Best Phoronix-test-suite code snippet using pts_openbenchmarking.available_tests

pts_openbenchmarking_client.php

Source:pts_openbenchmarking_client.php Github

copy

Full Screen

...38 return pts_openbenchmarking_upload::upload_usage_data($task, $data);39 }40 public static function recently_updated_tests($limit = -1)41 {42 $available_tests = array();43 foreach(pts_openbenchmarking::linked_repositories() as $repo)44 {45 $repo_index = pts_openbenchmarking::read_repository_index($repo);46 if(isset($repo_index['tests']) && is_array($repo_index['tests']))47 {48 foreach(array_keys($repo_index['tests']) as $identifier)49 {50 if($repo_index['tests'][$identifier]['title'] == null)51 {52 continue;53 }54 $version = array_shift($repo_index['tests'][$identifier]['versions']);55 $update_time = $repo_index['tests'][$identifier]['last_updated'];56 $available_tests[$update_time] = $repo . '/' . $identifier . '-' . $version;57 }58 }59 }60 krsort($available_tests);61 if($limit > 0)62 {63 $available_tests = array_slice($available_tests, 0, $limit);64 }65 return $available_tests;66 }67 public static function recently_added_tests($limit = -1)68 {69 $available_tests = array();70 foreach(pts_openbenchmarking::linked_repositories() as $repo)71 {72 $repo_index = pts_openbenchmarking::read_repository_index($repo);73 if(isset($repo_index['tests']) && is_array($repo_index['tests']))74 {75 foreach(array_keys($repo_index['tests']) as $identifier)76 {77 if($repo_index['tests'][$identifier]['title'] == null)78 {79 continue;80 }81 $version = array_shift($repo_index['tests'][$identifier]['versions']);82 $add_time = $repo_index['tests'][$identifier]['first_added'];83 $available_tests[$add_time] = $repo . '/' . $identifier . '-' . $version;84 }85 }86 }87 krsort($available_tests);88 if($limit > 0)89 {90 $available_tests = array_slice($available_tests, 0, $limit, true);91 }92 return $available_tests;93 }94 public static function popular_tests($limit = -1, $test_type = null)95 {96 $available_tests = array();97 foreach(pts_openbenchmarking::linked_repositories() as $repo)98 {99 $repo_index = pts_openbenchmarking::read_repository_index($repo);100 if(isset($repo_index['tests']) && is_array($repo_index['tests']))101 {102 foreach(array_keys($repo_index['tests']) as $identifier)103 {104 if($repo_index['tests'][$identifier]['title'] == null)105 {106 continue;107 }108 $popularity = $repo_index['tests'][$identifier]['popularity'];109 if($popularity < 1 || ($test_type != null && $repo_index['tests'][$identifier]['test_type'] != $test_type))110 {111 continue;112 }113 $available_tests[$repo . '/' . $identifier] = $popularity;114 }115 }116 }117 asort($available_tests);118 if($limit > 0)119 {120 $available_tests = array_slice($available_tests, 0, $limit);121 }122 return array_keys($available_tests);123 }124 public static function search_tests($search, $test_titles_only = true)125 {126 $matching_tests = array();127 foreach(pts_openbenchmarking::linked_repositories() as $repo)128 {129 $repo_index = pts_openbenchmarking::read_repository_index($repo);130 if(isset($repo_index['tests']) && is_array($repo_index['tests']))131 {132 foreach(array_keys($repo_index['tests']) as $identifier)133 {134 if(stripos($identifier, $search) !== false || stripos($repo_index['tests'][$identifier]['title'], $search) !== false)135 {136 $matching_tests[] = $repo . '/' . $identifier;137 }138 else if($test_titles_only == false && (stripos(implode(' ', $repo_index['tests'][$identifier]['internal_tags']), $search) !== false || stripos($repo_index['tests'][$identifier]['test_type'], $search) !== false || stripos($repo_index['tests'][$identifier]['description'], $search) !== false))139 {140 $matching_tests[] = $repo . '/' . $identifier;141 }142 }143 }144 }145 return $matching_tests;146 }147 public static function tests_available()148 {149 $test_count = 0;150 foreach(pts_openbenchmarking::linked_repositories() as $repo)151 {152 $repo_index = pts_openbenchmarking::read_repository_index($repo);153 if(isset($repo_index['tests']) && is_array($repo_index['tests']))154 {155 $test_count += count($repo_index['tests']);156 }157 }158 return $test_count;159 }160 public static function init_account($openbenchmarking, $settings)161 {162 if(isset($openbenchmarking['user_name']) && isset($openbenchmarking['communication_id']) && isset($openbenchmarking['sav']))163 {164 if(IS_FIRST_RUN_TODAY && pts_network::internet_support_available())165 {166 // Might as well make sure OpenBenchmarking.org account has the latest system info167 // But don't do it everytime to preserve bandwidth168 $openbenchmarking['s_s'] = base64_encode(phodevi::system_software(true));169 $openbenchmarking['s_h'] = base64_encode(phodevi::system_hardware(true));170 $return_state = pts_openbenchmarking::make_openbenchmarking_request('account_verify', $openbenchmarking);171 $json = json_decode($return_state, true);172 if(isset($json['openbenchmarking']['account']['valid']))173 {174 // The account is valid175 self::$openbenchmarking_account = $openbenchmarking;176 self::$client_settings = $json['openbenchmarking']['account']['settings'];177 pts_storage_object::set_in_file(PTS_CORE_STORAGE, 'openbenchmarking_account_settings', $json['openbenchmarking']['account']['settings']);178 }179 else180 {181 pts_storage_object::set_in_file(PTS_CORE_STORAGE, 'openbenchmarking', false);182 trigger_error('Invalid OpenBenchmarking.org account supplied, please re-login.', E_USER_ERROR);183 }184 }185 else186 {187 self::$openbenchmarking_account = $openbenchmarking;188 self::$client_settings = $settings;189 }190 }191 }192 public static function get_openbenchmarking_account()193 {194 return self::$openbenchmarking_account;195 }196 public static function auto_upload_results()197 {198 return isset(self::$client_settings['AutoUploadResults']) && self::$client_settings['AutoUploadResults'];199 }200 public static function override_client_setting($key, $value)201 {202 self::$client_settings[$key] = $value;203 }204 public static function read_repository_test_profile_attribute($test_profile, $attribute)205 {206 if(empty($test_profile))207 {208 return;209 }210 list($repo, $tp) = explode('/', $test_profile);211 if(($x = strrpos($tp, '-')))212 {213 $tp = substr($tp, 0, $x);214 }215 $repo_index = pts_openbenchmarking::read_repository_index($repo);216 return isset($repo_index['tests'][$tp][$attribute]) ? $repo_index['tests'][$tp][$attribute] : null;217 }218 public static function test_profile_newer_minor_version_available(&$test_profile)219 {220 $test_identifier = $test_profile->get_identifier(false);221 $test_current_version = $test_profile->get_test_profile_version();222 $versions = pts_openbenchmarking_client::read_repository_test_profile_attribute($test_identifier, 'versions');223 if($versions && ($x = strrpos($test_current_version, '.')) !== false)224 {225 $current_version_short = substr($test_current_version, 0, $x);226 $current_version_minor_number = substr($test_current_version, ($x + 1));227 $new_minor_version = false;228 foreach($versions as $v)229 {230 if(substr($v, 0, strlen($current_version_short)) == $current_version_short)231 {232 if(substr($v, (strrpos($v, '.') + 1)) > $current_version_minor_number)233 {234 $new_minor_version = $v;235 break;236 }237 }238 }239 if($new_minor_version)240 {241 pts_openbenchmarking::download_test_profile($test_identifier . '-' . $new_minor_version);242 $tp = new pts_test_profile($test_identifier . '-' . $new_minor_version);243 if($tp->get_test_profile_version() == $new_minor_version)244 {245 // can read version correctly, thus test is there246 return $tp;247 }248 }249 }250 return false;251 }252 public static function read_repository_test_suite_attribute($test_profile, $attribute)253 {254 list($repo, $ts) = explode('/', $test_profile);255 if(($x = strrpos($ts, '-')))256 {257 $ts = substr($ts, 0, $x);258 }259 $repo_index = pts_openbenchmarking::read_repository_index($repo);260 return isset($repo_index['suites'][$ts][$attribute]) ? $repo_index['suites'][$ts][$attribute] : null;261 }262 public static function popular_openbenchmarking_results()263 {264 $index_file = PTS_OPENBENCHMARKING_SCRATCH_PATH . 'popular.results';265 if(!is_file($index_file) || filemtime($index_file) < (time() - 1800))266 {267 // Refresh the repository change-log just once a day should be fine268 $server_index = pts_openbenchmarking::make_openbenchmarking_request('interesting_results');269 if(json_decode($server_index) != false)270 {271 file_put_contents($index_file, $server_index);272 }273 }274 $results = is_file($index_file) ? json_decode(file_get_contents($index_file), true) : false;275 return $results ? $results['results'] : false;276 }277 public static function fetch_repository_changelog($repo_name)278 {279 $index_file = PTS_OPENBENCHMARKING_SCRATCH_PATH . $repo_name . '.changes';280 if(!is_file($index_file) || filemtime($index_file) < (time() - 86400))281 {282 // Refresh the repository change-log just once a day should be fine283 $server_index = pts_openbenchmarking::make_openbenchmarking_request('repo_changes', array('repo' => $repo_name));284 if(json_decode($server_index) != false)285 {286 file_put_contents($index_file, $server_index);287 }288 }289 return is_file($index_file) ? json_decode(file_get_contents($index_file), true) : false;290 }291 public static function fetch_repository_test_profile_changelog($test_profile_identifier_sans_version)292 {293 $server_index = pts_openbenchmarking::make_openbenchmarking_request('repo_changes', array('test_profile' => $test_profile_identifier_sans_version));294 return ($j = json_decode($server_index, true)) != false ? $j : false;295 }296 public static function fetch_repository_changelog_full($repo_name)297 {298 // Fetch the complete OpenBenchmarking.org change-log for this user/repository299 $server_index = pts_openbenchmarking::make_openbenchmarking_request('repo_changes', array('repo' => $repo_name, 'full' => 'full'));300 if(($j = json_decode($server_index, true)) != false)301 {302 return $j;303 }304 return false;305 }306 public static function user_name()307 {308 return isset(self::$openbenchmarking_account['user_name']) ? self::$openbenchmarking_account['user_name'] : false;309 }310 public static function request_gsid()311 {312 if(!pts_network::internet_support_available())313 {314 return false;315 }316 $payload = array(317 'client_version' => PTS_VERSION,318 'client_os' => phodevi::read_property('system', 'vendor-identifier')319 );320 $json = pts_openbenchmarking::make_openbenchmarking_request('request_gsid', $payload);321 $json = json_decode($json, true);322 return isset($json['openbenchmarking']['gsid']) ? $json['openbenchmarking']['gsid'] : false;323 }324 public static function update_gsid()325 {326 if(!pts_network::internet_support_available())327 {328 return false;329 }330 $payload = array(331 'client_version' => PTS_VERSION,332 'client_os' => phodevi::read_property('system', 'vendor-identifier')333 );334 pts_openbenchmarking::make_openbenchmarking_request('update_gsid', $payload);335 }336 public static function retrieve_gsid()337 {338 if(!pts_network::internet_support_available())339 {340 return false;341 }342 // If the GSID_E and GSID_P are not known due to being from an old client343 $json = pts_openbenchmarking::make_openbenchmarking_request('retrieve_gsid', array());344 $json = json_decode($json, true);345 return isset($json['openbenchmarking']['gsid']) ? $json['openbenchmarking']['gsid'] : false;346 }347 public static function compare_test_json_download_counts($a, $b)348 {349 $a = $a['downloads'];350 $b = $b['downloads'];351 if($a == $b)352 {353 return 0;354 }355 return ($a > $b) ? -1 : 1;356 }357 public static function compare_test_last_updated($a, $b)358 {359 $a = $a['last_updated'];360 $b = $b['last_updated'];361 if($a == $b)362 {363 return 0;364 }365 return ($a > $b) ? -1 : 1;366 }367 public static function most_popular_tests($limit = 10)368 {369 $only_show_available_cached_tests = pts_network::internet_support_available() == false;370 $tests = array();371 foreach(pts_openbenchmarking::available_tests(false, false, false, false, $only_show_available_cached_tests) as $identifier)372 {373 $repo = substr($identifier, 0, strpos($identifier, '/'));374 $id = substr($identifier, strlen($repo) + 1);375 $repo_index = pts_openbenchmarking::read_repository_index($repo);376 if((!empty($repo_index['tests'][$id]['supported_platforms']) && !in_array(phodevi::os_under_test(), $repo_index['tests'][$id]['supported_platforms'])) || empty($repo_index['tests'][$id]['title']))377 {378 // Don't show unsupported tests379 continue;380 }381 if(!empty($repo_index['tests'][$id]['status']) && $repo_index['tests'][$id]['status'] != 'Verified')382 {383 // Don't show unsupported tests384 continue;385 }386 if($repo_index['tests'][$id]['last_updated'] < (time() - (60 * 60 * 24 * 365)))387 {388 // Don't show tests not actively maintained389 continue;390 }391 if($repo_index['tests'][$id]['test_type'] == 'Graphics' && !phodevi::is_display_server_active())392 {393 // Don't show graphics tests if no display active394 continue;395 }396 $tests[$id] = $repo_index['tests'][$id];397 }398 uasort($tests, array('pts_openbenchmarking_client', 'compare_test_json_download_counts'));399 return array_slice($tests, 0, $limit);400 }401 public static function new_and_recently_updated_tests($days_old_limit = 14, $test_limit = 10, $just_new = false)402 {403 $only_show_available_cached_tests = pts_network::internet_support_available() == false;404 $tests = array();405 $q = $just_new ? 'first_added' : 'last_updated';406 $cutoff_time = time() - ($days_old_limit * 86400);407 foreach(pts_openbenchmarking::available_tests(false, false, false, false, $only_show_available_cached_tests) as $identifier)408 {409 $repo = substr($identifier, 0, strpos($identifier, '/'));410 $id = substr($identifier, strlen($repo) + 1);411 $repo_index = pts_openbenchmarking::read_repository_index($repo);412 if($repo_index['tests'][$id][$q] < $cutoff_time)413 {414 // Don't show tests not actively maintained415 continue;416 }417 if((!empty($repo_index['tests'][$id]['supported_platforms']) && !in_array(phodevi::os_under_test(), $repo_index['tests'][$id]['supported_platforms'])) || empty($repo_index['tests'][$id]['title']))418 {419 // Don't show unsupported tests420 continue;421 }...

Full Screen

Full Screen

available_tests

Using AI Code Generation

copy

Full Screen

1$pts = new pts_openbenchmarking();2$tests = $pts->available_tests();3print_r($tests);4$pts = new pts_openbenchmarking();5$tests = $pts->available_tests();6print_r($tests);7$pts = new pts_openbenchmarking();8$tests = $pts->available_tests();9print_r($tests);10$pts = new pts_openbenchmarking();11$tests = $pts->available_tests();12print_r($tests);13$pts = new pts_openbenchmarking();14$tests = $pts->available_tests();15print_r($tests);16$pts = new pts_openbenchmarking();17$tests = $pts->available_tests();18print_r($tests);19$pts = new pts_openbenchmarking();20$tests = $pts->available_tests();21print_r($tests);22$pts = new pts_openbenchmarking();23$tests = $pts->available_tests();24print_r($tests);25$pts = new pts_openbenchmarking();26$tests = $pts->available_tests();27print_r($tests);28$pts = new pts_openbenchmarking();29$tests = $pts->available_tests();30print_r($tests);31$pts = new pts_openbenchmarking();32$tests = $pts->available_tests();33print_r($tests);34$pts = new pts_openbenchmarking();

Full Screen

Full Screen

available_tests

Using AI Code Generation

copy

Full Screen

1require_once('pts_openbenchmarking.php');2$ob = new pts_openbenchmarking();3$available_tests = $ob->available_tests();4print_r($available_tests);5require_once('pts_openbenchmarking.php');6$ob = new pts_openbenchmarking();7$available_tests = $ob->available_tests();8print_r($available_tests);9require_once('pts_openbenchmarking.php');10$ob = new pts_openbenchmarking();11$available_tests = $ob->available_tests();12print_r($available_tests);13require_once('pts_openbenchmarking.php');14$ob = new pts_openbenchmarking();15$available_tests = $ob->available_tests();16print_r($available_tests);17require_once('pts_openbenchmarking.php');18$ob = new pts_openbenchmarking();19$available_tests = $ob->available_tests();20print_r($available_tests);21require_once('pts_openbenchmarking.php');22$ob = new pts_openbenchmarking();23$available_tests = $ob->available_tests();24print_r($available_tests);25require_once('pts_openbenchmarking.php');26$ob = new pts_openbenchmarking();27$available_tests = $ob->available_tests();28print_r($available_tests);29require_once('pts_openbenchmarking.php');30$ob = new pts_openbenchmarking();31$available_tests = $ob->available_tests();32print_r($available_tests);

Full Screen

Full Screen

available_tests

Using AI Code Generation

copy

Full Screen

1require_once('pts_openbenchmarking.php');2$openbenchmarking = new pts_openbenchmarking();3$tests = $openbenchmarking->available_tests();4print_r($tests);5require_once('pts_openbenchmarking.php');6$openbenchmarking = new pts_openbenchmarking();7$tests = $openbenchmarking->available_tests();8print_r($tests);9require_once('pts_openbenchmarking.php');10$openbenchmarking = new pts_openbenchmarking();11$tests = $openbenchmarking->available_tests();12print_r($tests);13require_once('pts_openbenchmarking.php');14$openbenchmarking = new pts_openbenchmarking();15$tests = $openbenchmarking->available_tests();16print_r($tests);17require_once('pts_openbenchmarking.php');18$openbenchmarking = new pts_openbenchmarking();19$tests = $openbenchmarking->available_tests();20print_r($tests);21require_once('pts_openbenchmarking.php');22$openbenchmarking = new pts_openbenchmarking();23$tests = $openbenchmarking->available_tests();24print_r($tests);25require_once('pts_openbenchmarking.php');26$openbenchmarking = new pts_openbenchmarking();27$tests = $openbenchmarking->available_tests();28print_r($tests);29require_once('pts_openbenchmarking.php');30$openbenchmarking = new pts_openbenchmarking();

Full Screen

Full Screen

available_tests

Using AI Code Generation

copy

Full Screen

1require_once('pts-core.php');2$openbenchmarking = new pts_openbenchmarking();3$openbenchmarking->available_tests();4require_once('pts-core.php');5$openbenchmarking = new pts_openbenchmarking();6$openbenchmarking->available_results('test_name');7require_once('pts-core.php');8$openbenchmarking = new pts_openbenchmarking();9$openbenchmarking->latest_results('test_name');10require_once('pts-core.php');11$openbenchmarking = new pts_openbenchmarking();12$openbenchmarking->available_results('test_name', 'system_name');13require_once('pts-core.php');14$openbenchmarking = new pts_openbenchmarking();15$openbenchmarking->latest_results('test_name', 'system_name');16require_once('pts-core.php');17$openbenchmarking = new pts_openbenchmarking();18$openbenchmarking->available_results('test_name', 'system_name');19require_once('pts-core.php');20$openbenchmarking = new pts_openbenchmarking();21$openbenchmarking->latest_results('test_name', 'system_name');

Full Screen

Full Screen

available_tests

Using AI Code Generation

copy

Full Screen

1require_once('pts_openbenchmarking.php');2$pts_openbenchmarking = new pts_openbenchmarking();3$available_tests = $pts_openbenchmarking->available_tests();4print_r($available_tests);5require_once('pts_openbenchmarking.php');6$pts_openbenchmarking = new pts_openbenchmarking();7$available_tests = $pts_openbenchmarking->available_tests();8echo 'Available tests: ';9echo '<table border="1" width="100%">';10echo '<tr><th>Test Name</th><th>Test Description</th></tr>';11foreach($available_tests as $test_name => $test_description){12echo '<tr><td>' . $test_name . '</td><td>' . $test_description . '</td></tr>';13}14echo '</table>';15require_once('pts_openbenchmarking.php');16$pts_openbenchmarking = new pts_openbenchmarking();17$available_tests = $pts_openbenchmarking->available_tests();18echo 'Available tests: ';19echo '<table border="1" width="100%">';20echo '<tr><th>Test Name</th><th>Test Description</th></tr>';21foreach($available_tests as $test_name => $test_description){

Full Screen

Full Screen

available_tests

Using AI Code Generation

copy

Full Screen

1require_once('pts_openbenchmarking.php');2';3$available_tests = pts_openbenchmarking::available_tests();4';5foreach($available_tests as $test)6{7';8}9echo '</table>';10require_once('pts_openbenchmarking.php');11';12$test_information = pts_openbenchmarking::test_information('pts/pts-filesystem-1.0.1');13';

Full Screen

Full Screen

available_tests

Using AI Code Generation

copy

Full Screen

1require_once('pts_client.php');2pts_client::init_environment();3$tests = pts_openbenchmarking::available_tests();4';5';6foreach($tests as $test)7{8 echo $test->get_identifier() . ' | ' . $test->get_title() . ' | ' . $test->get_description() . ' | ' . $test->get_test_hardware_type() . ' | ' . $test->get_maintainer() . '9';10}

Full Screen

Full Screen

available_tests

Using AI Code Generation

copy

Full Screen

1print_r(pts_openbenchmarking::available_tests());2print_r(pts_openbenchmarking::download_test('pts/ffmpeg-1.2', '/home/pts/'));3print_r(pts_openbenchmarking::download_test('pts/ffmpeg-1.2', '/home/pts/'));4print_r(pts_openbenchmarking::download_test('pts/ffmpeg-1.2', '/home/pts/'));5print_r(pts_openbenchmarking::download_test('pts/ffmpeg-1.2', '/home/pts/'));6print_r(pts_openbenchmarking::download_test('pts/ffmpeg-1.2', '/home/pts/'));

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.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful