How to use make_openbenchmarking_request method of pts_openbenchmarking class

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

pts_openbenchmarking_client.php

Source:pts_openbenchmarking_client.php Github

copy

Full Screen

...135 if(isset(self::$client_settings['ResultUploadsDefaultDisplayStatus']) && is_numeric(self::$client_settings['ResultUploadsDefaultDisplayStatus']))136 {137 $to_post['display_status'] = self::$client_settings['ResultUploadsDefaultDisplayStatus'];138 }139 $json_response = pts_openbenchmarking::make_openbenchmarking_request('upload_test_result', $to_post);140 $json_response = json_decode($json_response, true);141 if(!is_array($json_response))142 {143 trigger_error('Unhandled Exception', E_USER_ERROR);144 return false;145 }146 if(isset($json_response['openbenchmarking']['upload']['error']))147 {148 trigger_error($json_response['openbenchmarking']['upload']['error'], E_USER_ERROR);149 }150 if(isset($json_response['openbenchmarking']['upload']['url']))151 {152 echo PHP_EOL . 'Results Uploaded To: ' . $json_response['openbenchmarking']['upload']['url'] . PHP_EOL;153 pts_module_manager::module_process('__event_openbenchmarking_upload', $json_response);154 }155 //$json['openbenchmarking']['upload']['id']156 if(isset(self::$client_settings['RemoveLocalResultsOnUpload']) && self::$client_settings['RemoveLocalResultsOnUpload'] && $local_file_name != null)157 {158 pts_client::remove_saved_result_file($local_file_name);159 }160 if($return_json_data)161 {162 return isset($json_response['openbenchmarking']['upload']) ? $json_response['openbenchmarking']['upload'] : false;163 }164 return isset($json_response['openbenchmarking']['upload']['url']) ? $json_response['openbenchmarking']['upload']['url'] : false;165 }166 public static function recently_updated_tests($limit = -1)167 {168 $available_tests = array();169 foreach(pts_openbenchmarking::linked_repositories() as $repo)170 {171 $repo_index = pts_openbenchmarking::read_repository_index($repo);172 if(isset($repo_index['tests']) && is_array($repo_index['tests']))173 {174 foreach(array_keys($repo_index['tests']) as $identifier)175 {176 if($repo_index['tests'][$identifier]['title'] == null)177 {178 continue;179 }180 $version = array_shift($repo_index['tests'][$identifier]['versions']);181 $update_time = $repo_index['tests'][$identifier]['last_updated'];182 $available_tests[$update_time] = $repo . '/' . $identifier . '-' . $version;183 }184 }185 }186 krsort($available_tests);187 if($limit > 0)188 {189 $available_tests = array_slice($available_tests, 0, $limit);190 }191 return $available_tests;192 }193 public static function popular_tests($limit = -1, $test_type = null)194 {195 $available_tests = array();196 foreach(pts_openbenchmarking::linked_repositories() as $repo)197 {198 $repo_index = pts_openbenchmarking::read_repository_index($repo);199 if(isset($repo_index['tests']) && is_array($repo_index['tests']))200 {201 foreach(array_keys($repo_index['tests']) as $identifier)202 {203 if($repo_index['tests'][$identifier]['title'] == null)204 {205 continue;206 }207 $popularity = $repo_index['tests'][$identifier]['popularity'];208 if($popularity < 1 || ($test_type != null && $repo_index['tests'][$identifier]['test_type'] != $test_type))209 {210 continue;211 }212 $available_tests[$repo . '/' . $identifier] = $popularity;213 }214 }215 }216 asort($available_tests);217 if($limit > 0)218 {219 $available_tests = array_slice($available_tests, 0, $limit);220 }221 return array_keys($available_tests);222 }223 public static function search_tests($search, $test_titles_only = true)224 {225 $matching_tests = array();226 foreach(pts_openbenchmarking::linked_repositories() as $repo)227 {228 $repo_index = pts_openbenchmarking::read_repository_index($repo);229 if(isset($repo_index['tests']) && is_array($repo_index['tests']))230 {231 foreach(array_keys($repo_index['tests']) as $identifier)232 {233 if(stripos($identifier, $search) !== false || stripos($repo_index['tests'][$identifier]['title'], $search) !== false)234 {235 $matching_tests[] = $repo . '/' . $identifier;236 }237 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))238 {239 $matching_tests[] = $repo . '/' . $identifier;240 }241 }242 }243 }244 return $matching_tests;245 }246 public static function tests_available()247 {248 $test_count = 0;249 foreach(pts_openbenchmarking::linked_repositories() as $repo)250 {251 $repo_index = pts_openbenchmarking::read_repository_index($repo);252 if(isset($repo_index['tests']) && is_array($repo_index['tests']))253 {254 $test_count += count($repo_index['tests']);255 }256 }257 return $test_count;258 }259 public static function init_account($openbenchmarking, $settings)260 {261 if(isset($openbenchmarking['user_name']) && isset($openbenchmarking['communication_id']) && isset($openbenchmarking['sav']))262 {263 if(IS_FIRST_RUN_TODAY && pts_network::internet_support_available())264 {265 // Might as well make sure OpenBenchmarking.org account has the latest system info266 // But don't do it everytime to preserve bandwidth267 $openbenchmarking['s_s'] = base64_encode(phodevi::system_software(true));268 $openbenchmarking['s_h'] = base64_encode(phodevi::system_hardware(true));269 $return_state = pts_openbenchmarking::make_openbenchmarking_request('account_verify', $openbenchmarking);270 $json = json_decode($return_state, true);271 if(isset($json['openbenchmarking']['account']['valid']))272 {273 // The account is valid274 self::$openbenchmarking_account = $openbenchmarking;275 self::$client_settings = $json['openbenchmarking']['account']['settings'];276 pts_storage_object::set_in_file(PTS_CORE_STORAGE, 'openbenchmarking_account_settings', $json['openbenchmarking']['account']['settings']);277 }278 else279 {280 pts_storage_object::set_in_file(PTS_CORE_STORAGE, 'openbenchmarking', false);281 trigger_error('Invalid OpenBenchmarking.org account supplied, please re-login.', E_USER_ERROR);282 }283 }284 else285 {286 self::$openbenchmarking_account = $openbenchmarking;287 self::$client_settings = $settings;288 }289 }290 }291 public static function get_openbenchmarking_account()292 {293 return self::$openbenchmarking_account;294 }295 public static function auto_upload_results()296 {297 return isset(self::$client_settings['AutoUploadResults']) && self::$client_settings['AutoUploadResults'];298 }299 public static function override_client_setting($key, $value)300 {301 self::$client_settings[$key] = $value;302 }303 protected static function result_upload_supported(&$result_file)304 {305 foreach($result_file->get_result_objects() as $result_object)306 {307 $test_profile = new pts_test_profile($result_object->test_profile->get_identifier());308 if($test_profile->allow_results_sharing() == false)309 {310 echo PHP_EOL . $result_object->test_profile->get_identifier() . ' does not allow test results to be uploaded.' . PHP_EOL . PHP_EOL;311 return false;312 }313 }314 return true;315 }316 public static function read_repository_test_profile_attribute($test_profile, $attribute)317 {318 list($repo, $tp) = explode('/', $test_profile);319 $tp = substr($tp, 0, strrpos($tp, '-'));320 $repo_index = pts_openbenchmarking::read_repository_index($repo);321 return isset($repo_index['tests'][$tp][$attribute]) ? $repo_index['tests'][$tp][$attribute] : null;322 }323 public static function popular_openbenchmarking_results()324 {325 $index_file = PTS_OPENBENCHMARKING_SCRATCH_PATH . 'popular.results';326 if(!is_file($index_file) || filemtime($index_file) < (time() - 1800))327 {328 // Refresh the repository change-log just once a day should be fine329 $server_index = pts_openbenchmarking::make_openbenchmarking_request('interesting_results');330 if(json_decode($server_index) != false)331 {332 file_put_contents($index_file, $server_index);333 }334 }335 $results = is_file($index_file) ? json_decode(file_get_contents($index_file), true) : false;336 return $results ? $results['results'] : false;337 }338 public static function fetch_repository_changelog($repo_name)339 {340 $index_file = PTS_OPENBENCHMARKING_SCRATCH_PATH . $repo_name . '.changes';341 if(!is_file($index_file) || filemtime($index_file) < (time() - 86400))342 {343 // Refresh the repository change-log just once a day should be fine344 $server_index = pts_openbenchmarking::make_openbenchmarking_request('repo_changes', array('repo' => $repo_name));345 if(json_decode($server_index) != false)346 {347 file_put_contents($index_file, $server_index);348 }349 }350 return is_file($index_file) ? json_decode(file_get_contents($index_file), true) : false;351 }352 public static function user_name()353 {354 return isset(self::$openbenchmarking_account['user_name']) ? self::$openbenchmarking_account['user_name'] : false;355 }356 public static function upload_usage_data($task, $data)357 {358 if(!pts_network::internet_support_available())359 {360 return false;361 }362 switch($task)363 {364 case 'test_install':365 list($test_install, $time_elapsed) = $data;366 $upload_data = array('test_identifier' => $test_install->test_profile->get_identifier(), 'test_version' => $test_install->test_profile->get_test_profile_version(), 'elapsed_time' => $time_elapsed);367 pts_network::http_upload_via_post(pts_openbenchmarking::openbenchmarking_host() . 'extern/statistics/report-test-install.php', $upload_data);368 break;369 case 'test_complete':370 list($test_result, $time_elapsed) = $data;371 $upload_data = array('test_identifier' => $test_result->test_profile->get_identifier(), 'test_version' => $test_result->test_profile->get_test_profile_version(), 'elapsed_time' => $time_elapsed);372 pts_network::http_upload_via_post(pts_openbenchmarking::openbenchmarking_host() . 'extern/statistics/report-test-completion.php', $upload_data);373 break;374 case 'test_install_failure':375 list($test_install, $error) = $data;376 $upload_data = array('test_identifier' => $test_install->test_profile->get_identifier(), 'error' => $error, 'os' => phodevi::read_property('system', 'vendor-identifier'));377 pts_network::http_upload_via_post(pts_openbenchmarking::openbenchmarking_host() . 'extern/statistics/report-test-install-failure.php', $upload_data);378 break;379 }380 }381 public static function request_gsid()382 {383 if(!pts_network::internet_support_available())384 {385 return false;386 }387 $payload = array(388 'client_version' => PTS_VERSION,389 'client_os' => phodevi::read_property('system', 'vendor-identifier')390 );391 $json = pts_openbenchmarking::make_openbenchmarking_request('request_gsid', $payload);392 $json = json_decode($json, true);393 return isset($json['openbenchmarking']['gsid']) ? $json['openbenchmarking']['gsid'] : false;394 }395 public static function update_gsid()396 {397 if(!pts_network::internet_support_available())398 {399 return false;400 }401 $payload = array(402 'client_version' => PTS_VERSION,403 'client_os' => phodevi::read_property('system', 'vendor-identifier')404 );405 pts_openbenchmarking::make_openbenchmarking_request('update_gsid', $payload);406 }407 public static function retrieve_gsid()408 {409 if(!pts_network::internet_support_available())410 {411 return false;412 }413 // If the GSID_E and GSID_P are not known due to being from an old client414 $json = pts_openbenchmarking::make_openbenchmarking_request('retrieve_gsid', array());415 $json = json_decode($json, true);416 return isset($json['openbenchmarking']['gsid']) ? $json['openbenchmarking']['gsid'] : false;417 }418}419?>...

Full Screen

Full Screen

make_openbenchmarking_request

Using AI Code Generation

copy

Full Screen

1require_once('pts-core/objects/pts_openbenchmarking.php');2$openbenchmarking = new pts_openbenchmarking();3require_once('pts-core/objects/pts_openbenchmarking.php');4$openbenchmarking = new pts_openbenchmarking();5require_once('pts-core/objects/pts_openbenchmarking.php');6$openbenchmarking = new pts_openbenchmarking();7require_once('pts-core/objects/pts_openbenchmarking.php');8$openbenchmarking = new pts_openbenchmarking();9require_once('pts-core/objects/pts_openbenchmarking.php');10$openbenchmarking = new pts_openbenchmarking();11require_once('pts-core/objects/pts_openbenchmarking.php');12$openbenchmarking = new pts_openbenchmarking();13require_once('pts-core/objects/pts_openbenchmarking.php');14$openbenchmarking = new pts_openbenchmarking();

Full Screen

Full Screen

make_openbenchmarking_request

Using AI Code Generation

copy

Full Screen

1require_once('pts-core/objects/pts_openbenchmarking.php');2$openbenchmarking = new pts_openbenchmarking();3$openbenchmarking->make_openbenchmarking_request('GET', '2.0/test/pts/test-profiles', array('test_profile' => 'pts/test-profiles'));4require_once('pts-core/objects/pts_openbenchmarking.php');5$openbenchmarking = new pts_openbenchmarking();6$openbenchmarking->make_openbenchmarking_request('GET', '2.0/test/pts/test-profiles', array('test_profile' => 'pts/test-profiles', 'test_profile_version' => '1.0.0'));7require_once('pts-core/objects/pts_openbenchmarking.php');8$openbenchmarking = new pts_openbenchmarking();9$openbenchmarking->make_openbenchmarking_request('GET', '2.0/test/pts/test-profiles', array('test_profile' => 'pts/test-profiles', 'test_profile_version' => '1.0.0', 'test_profile_version_timestamp' => '2017-06-22T17:06:32Z'));10require_once('pts-core/objects/pts_openbenchmarking.php');11$openbenchmarking = new pts_openbenchmarking();12$openbenchmarking->make_openbenchmarking_request('GET', '2.0/test/pts/test-profiles', array('test_profile' => 'pts/test-profiles', 'test_profile_version' => '1.0.0', 'test_profile_version_timestamp' => '2017-06-22T17:06:32Z', 'test_profile_version_md5' => 'a0d4f5c5a5f5c5a5f5c5a5f5c5a5f5c5'));13require_once('pts-core/objects/pts_openbenchmarking.php');14$openbenchmarking = new pts_openbenchmarking();

Full Screen

Full Screen

make_openbenchmarking_request

Using AI Code Generation

copy

Full Screen

1require_once('pts-core/pts-openbenchmarking.php');2$openbenchmarking = new pts_openbenchmarking();3$openbenchmarking->make_openbenchmarking_request('results/2');4require_once('pts-core/pts-openbenchmarking.php');5$openbenchmarking = new pts_openbenchmarking();6$openbenchmarking->make_openbenchmarking_request('results/3');7require_once('pts-core/pts-openbenchmarking.php');8$openbenchmarking = new pts_openbenchmarking();9$openbenchmarking->make_openbenchmarking_request('results/4');10require_once('pts-core/pts-openbenchmarking.php');11$openbenchmarking = new pts_openbenchmarking();12$openbenchmarking->make_openbenchmarking_request('results/5');13require_once('pts-core/pts-openbenchmarking.php');14$openbenchmarking = new pts_openbenchmarking();15$openbenchmarking->make_openbenchmarking_request('results/6');16require_once('pts-core/pts-openbenchmarking.php');17$openbenchmarking = new pts_openbenchmarking();18$openbenchmarking->make_openbenchmarking_request('results/7');19require_once('pts-core/pts-openbenchmarking.php');20$openbenchmarking = new pts_openbenchmarking();21$openbenchmarking->make_openbenchmarking_request('results/8');22require_once('pts-core/pts-openbenchmarking.php');23$openbenchmarking = new pts_openbenchmarking();

Full Screen

Full Screen

make_openbenchmarking_request

Using AI Code Generation

copy

Full Screen

1require_once('pts-core/objects/pts_openbenchmarking.php');2$ob = new pts_openbenchmarking();3$ob->make_openbenchmarking_request('test-profiles', 'show', 'pts/test-profiles', '2.php');4The OpenBenchmarking.org REST API method (in this case, test-profiles)5The REST API method action (in this case, show)6The OpenBenchmarking.org test profile identifier (in this case, pts/test-profiles)7The file to write the response to (in this case, 2.php)

Full Screen

Full Screen

make_openbenchmarking_request

Using AI Code Generation

copy

Full Screen

1require_once('pts_openbenchmarking.php');2$obj = new pts_openbenchmarking();3$result = $obj->make_openbenchmarking_request('tests', 'GET');4print_r($result);5require_once('pts_openbenchmarking.php');6$obj = new pts_openbenchmarking();7$result = $obj->make_openbenchmarking_request('test-profiles', 'GET');8print_r($result);9require_once('pts_openbenchmarking.php');10$obj = new pts_openbenchmarking();11$result = $obj->make_openbenchmarking_request('test-suites', 'GET');12print_r($result);13require_once('pts_openbenchmarking.php');14$obj = new pts_openbenchmarking();15$result = $obj->make_openbenchmarking_request('test-profiles/pts/pts-av1-encode', 'GET');16print_r($result);17require_once('pts_openbenchmarking.php');18$obj = new pts_openbenchmarking();

Full Screen

Full Screen

make_openbenchmarking_request

Using AI Code Generation

copy

Full Screen

1require_once('pts-core.php');2$openbenchmarking = new pts_openbenchmarking();3$openbenchmarking->make_openbenchmarking_request('test', 'test');4Warning: curl_setopt() expects parameter 2 to be long, string given in /var/www/pts-core/pts-core.php on line 5825Warning: curl_setopt() expects parameter 2 to be long, string given in /var/www/pts-core/pts-core.php on line 5836Warning: curl_setopt() expects parameter 2 to be long, string given in /var/www/pts-core/pts-core.php on line 5847Warning: curl_setopt() expects parameter 2 to be long, string given in /var/www/pts-core/pts-core.php on line 5858Warning: curl_setopt() expects parameter 2 to be long, string given in /var/www/pts-core/pts-core.php on line 5869Warning: curl_setopt() expects parameter 2 to be long, string given in /var/www/pts-core/pts-core.php on line 58710Warning: curl_setopt() expects parameter 2 to be long, string given in /var/www/pts-core/pts-core.php on line 58811Warning: curl_setopt() expects parameter 2 to be long, string given in /var/www/pts-core/pts-core.php on line 58912Warning: curl_setopt() expects parameter 2 to be long, string given in /var/www/pts-core/pts-core.php on line 59013Warning: curl_setopt() expects parameter 2 to be long, string given in /var/www/pts-core/pts-core.php on line 59114Warning: curl_setopt() expects parameter 2 to be long, string given in /var/www/pts-core/pts-core.php on line 59215Warning: curl_setopt() expects parameter 2 to be long, string given in /var/www/pts-core/pts-core.php on line 59316Warning: curl_setopt() expects parameter 2 to be long, string given in /var/www/pts-core/pts-core.php on line 59417Warning: curl_setopt() expects parameter 2 to be long, string

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