How to use download_test_suite method of pts_openbenchmarking class

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

pts_openbenchmarking.php

Source:pts_openbenchmarking.php Github

copy

Full Screen

...504 {505 if($download_suites && pts_network::internet_support_available())506 {507 $version = array_shift($repo_index['suites'][$identifier]['versions']);508 if(self::download_test_suite($repo . '/' . $identifier . '-' . $version) == false)509 {510 continue;511 }512 }513 $available_suites[] = $repo . '/' . $identifier;514 }515 }516 }517 return $available_suites;518 }519 public static function download_test_suite($qualified_identifier)520 {521 if(is_file(PTS_TEST_SUITE_PATH . $qualified_identifier . '/suite-definition.xml'))522 {523 return true;524 }525 $file = PTS_OPENBENCHMARKING_SCRATCH_PATH . $qualified_identifier . '.zip';526 if(pts_network::internet_support_available())527 {528 $hash_json = pts_openbenchmarking::make_openbenchmarking_request('suite_hash', array('i' => $qualified_identifier));529 $hash_json = json_decode($hash_json, true);530 $hash_check = isset($hash_json['openbenchmarking']['suite']['hash']) ? $hash_json['openbenchmarking']['suite']['hash'] : null; // should also check for ['openbenchmarking']['suite']['error'] problems531 }532 if(!is_file($file))533 {534 if(pts_network::internet_support_available())535 {536 $test_suite = pts_openbenchmarking::make_openbenchmarking_request('download_suite', array('i' => $qualified_identifier));537 if($test_suite != null && ($hash_check == null || $hash_check == sha1($test_suite)))538 {539 // save it540 file_put_contents($file, $test_suite);541 $hash_check = null;542 }543 else if(is_file('/var/cache/phoronix-test-suite/openbenchmarking.org/' . $qualified_identifier . '.zip') && ($hash_check == null || sha1_file('/var/cache/phoronix-test-suite/openbenchmarking.org/' . $qualified_identifier . '.zip') == $hash_check))544 {545 copy('/var/cache/phoronix-test-suite/openbenchmarking.org/' . $qualified_identifier . '.zip', $file);546 }547 }548 if(!is_file($file) && $test_suite = self::phoromatic_server_ob_cache_request('suite', substr($qualified_identifier, 0, strpos($qualified_identifier, '/')), substr($qualified_identifier, strpos($qualified_identifier, '/') + 1)))549 {550 if($b64 = base64_decode($test_suite))551 {552 $test_suite = $b64;553 }554 file_put_contents($file, $test_suite);555 }556 if(PTS_IS_CLIENT && !is_file($file))557 {558 trigger_error('Network support is needed to obtain ' . $qualified_identifier . ' data.' . PHP_EOL, E_USER_ERROR);559 return false;560 }561 }562 if(!is_file(PTS_TEST_SUITE_PATH . $qualified_identifier . '/suite-definition.xml') && is_file($file) && ($hash_check == null || (is_file($file) && sha1_file($file) == $hash_check)))563 {564 // extract it565 pts_file_io::mkdir(PTS_TEST_SUITE_PATH . dirname($qualified_identifier));566 pts_file_io::mkdir(PTS_TEST_SUITE_PATH . $qualified_identifier);567 pts_compression::zip_archive_extract($file, PTS_TEST_SUITE_PATH . $qualified_identifier);568 if(is_file(PTS_TEST_SUITE_PATH . $qualified_identifier . '/suite-definition.xml'))569 {570 return true;571 }572 else573 {574 unlink($file);575 return false;576 }577 }578 return false;579 }580 protected static function check_only_type_compare($check_only_type, $is_type)581 {582 return $check_only_type == false || $check_only_type === $is_type;583 }584 public static function evaluate_string_to_qualifier($supplied, $bind_version = true, $check_only_type = false)585 {586 $qualified = false;587 $c_repo = null;588 $repos = self::linked_repositories();589 if(($c = strpos($supplied, '/')) !== false)590 {591 // A repository was explicitly defined592 $c_repo = substr($supplied, 0, $c);593 $test = substr($supplied, ($c + 1));594 // If it's in the linked repo list it should have refreshed when starting client595 if(!in_array($c_repo, $repos))596 {597 // Pull in this repository's index598 pts_openbenchmarking::refresh_repository_lists($repos);599 }600 $repos = array($c_repo);601 }602 else603 {604 // If it's in the linked repo list it should have refreshed when starting client605 $test = $supplied;606 }607 if(($c = strrpos($test, '-')) !== false)608 {609 $version = substr($test, ($c + 1));610 // TODO: functionalize this and read against types.xsd611 if(isset($version[2]) && !isset($version[8]) && pts_strings::string_only_contains($version, (pts_strings::CHAR_NUMERIC | pts_strings::CHAR_DECIMAL)))612 {613 $test = substr($test, 0, $c);614 }615 else616 {617 $version = null;618 }619 }620 else621 {622 $version = null;623 }624 if($test == null)625 return false;626 foreach($repos as $repo)627 {628 if($repo == 'local')629 {630 if(self::check_only_type_compare($check_only_type, 'test'))631 {632 if(is_file(PTS_TEST_PROFILE_PATH . $repo . '/' . $test . '/test-definition.xml'))633 {634 return $repo . '/' . $test; // ($bind_version ? '-' . $version : null)635 }636 else if(is_file(PTS_TEST_PROFILE_PATH . $repo . '/' . $test . '-' . $version . '/test-definition.xml'))637 {638 return $repo . '/' . $test . '-' . $version; // ($bind_version ? '-' . $version : null)639 }640 }641 if(self::check_only_type_compare($check_only_type, 'suite'))642 {643 if(is_file(PTS_TEST_SUITE_PATH . $repo . '/' . $test . '/suite-definition.xml'))644 {645 return $repo . '/' . $test; // ($bind_version ? '-' . $version : null)646 }647 else if(is_file(PTS_TEST_SUITE_PATH . $repo . '/' . $test . '-' . $version . '/suite-definition.xml'))648 {649 return $repo . '/' . $test . '-' . $version; // ($bind_version ? '-' . $version : null)650 }651 }652 }653 $repo_index = pts_openbenchmarking::read_repository_index($repo);654 if(is_array($repo_index) && isset($repo_index['tests'][$test]) && self::check_only_type_compare($check_only_type, 'test'))655 {656 // The test profile at least exists657 // Looking for a particular test profile version?658 if($version != null)659 {660 if(!in_array($version, $repo_index['tests'][$test]['versions']))661 {662 // Grep to see if the version passed was e.g. 1.3 instead of 1.3.3663 $versions = $repo_index['tests'][$test]['versions'];664 sort($versions);665 foreach(array_reverse($versions) as $check_version)666 {667 if(strstr($check_version, $version) != false)668 {669 $version = $check_version;670 break;671 }672 }673 }674 if(in_array($version, $repo_index['tests'][$test]['versions']))675 {676 pts_openbenchmarking::download_test_profile($repo . '/' . $test . '-' . $version);677 return $repo . '/' . $test . ($bind_version ? '-' . $version : null);678 }679 }680 else681 {682 // Assume to use the latest version unless something else is installed683 $available_versions = $repo_index['tests'][$test]['versions'];684 $version = $available_versions[0]; // the latest version available685 if(PTS_IS_CLIENT && pts_client::current_command() == 'pts_test_run_manager')686 {687 // Check to see if an older version of the test profile is currently installed to ru nthat since no version specified688 foreach($available_versions as $i => $v)689 {690 if(is_file(pts_client::test_install_root_path() . $repo . '/' . $test . '-' . $v . '/pts-install.xml'))691 {692 $version = $v;693 if($i > 0)694 {695 // It's not the latest test profile version available696 trigger_error($repo . '/' . $test . ': The latest test profile version available for upgrade is ' . $available_versions[0] . ' but version ' . $version . ' is the latest currently installed.', E_USER_WARNING);697 }698 break;699 }700 }701 }702 pts_openbenchmarking::download_test_profile($repo . '/' . $test . '-' . $version);703 return $repo . '/' . $test . ($bind_version ? '-' . $version : null);704 }705 }706 if(is_array($repo_index) && isset($repo_index['suites'][$test]) && self::check_only_type_compare($check_only_type, 'suite'))707 {708 // The test profile at least exists709 // Looking for a particular test profile version?710 if($version != null)711 {712 if(!in_array($version, $repo_index['suites'][$test]['versions']))713 {714 // Grep to see if the version passed was e.g. 1.3 instead of 1.3.3715 $versions = $repo_index['suites'][$test]['versions'];716 sort($versions);717 foreach(array_reverse($versions) as $check_version)718 {719 if(strstr($check_version, $version) != false)720 {721 $version = $check_version;722 break;723 }724 }725 }726 if(in_array($version, $repo_index['suites'][$test]['versions']))727 {728 pts_openbenchmarking::download_test_suite($repo . '/' . $test . '-' . $version);729 return $repo . '/' . $test . ($bind_version ? '-' . $version : null);730 }731 }732 else733 {734 // Assume to use the latest version735 $version = array_shift($repo_index['suites'][$test]['versions']);736 pts_openbenchmarking::download_test_suite($repo . '/' . $test . '-' . $version);737 return $repo . '/' . $test . ($bind_version ? '-' . $version : null);738 }739 }740 }741 return false;742 }743 public static function upload_test_result(&$object, $return_json_data = false, $prompts = true)744 {745 return pts_openbenchmarking_client::upload_test_result($object, $return_json_data, $prompts);746 }747}748?>...

Full Screen

Full Screen

make_openbenchmarking_cache.php

Source:make_openbenchmarking_cache.php Github

copy

Full Screen

...72 foreach($repo_index['suites'][$test]['versions'] as $version)73 {74 $qualified_identifier = $repo . '/' . $test . '-' . $version;75 echo $qualified_identifier;76 $success = pts_openbenchmarking::download_test_suite($repo . '/' . $test . '-' . $version);77 if($success && is_file(PTS_OPENBENCHMARKING_SCRATCH_PATH . $qualified_identifier . '.zip'))78 {79 $file_size = round(filesize(PTS_OPENBENCHMARKING_SCRATCH_PATH . $qualified_identifier . '.zip') / 1024, 2);80 $info = $file_size . 'KB - ' . sha1_file(PTS_OPENBENCHMARKING_SCRATCH_PATH . $qualified_identifier . '.zip');81 $dot_size = $terminal_width - strlen($qualified_identifier) - 3 - strlen($info);82 echo ' ' . str_repeat('.', ($dot_size >= 0 ? $dot_size : 0)) . ' ' . $info . PHP_EOL;83 $total_cache_count++;84 $total_cache_size += $file_size;85 }86 }87 echo PHP_EOL;88 }89 echo PHP_EOL . $total_cache_count . ' Files Cached' . PHP_EOL . $test_count . ' Test Profiles' . PHP_EOL . $suite_count . ' Test Suites' . PHP_EOL . $total_cache_size . 'KB Total Cache Size' . PHP_EOL . PHP_EOL;90 }...

Full Screen

Full Screen

download_test_suite

Using AI Code Generation

copy

Full Screen

1$openbenchmarking = new pts_openbenchmarking();2$test_suite = $openbenchmarking->download_test_suite('test_suite_name');3$test_profile = $openbenchmarking->download_test_profile('test_profile_name');4$openbenchmarking = new pts_openbenchmarking();5$test_suite = $openbenchmarking->download_test_suite('test_suite_name');6$test_profile = $openbenchmarking->download_test_profile('test_profile_name');7$openbenchmarking = new pts_openbenchmarking();8$test_suite = $openbenchmarking->download_test_suite('test_suite_name');9$test_profile = $openbenchmarking->download_test_profile('test_profile_name');10$openbenchmarking = new pts_openbenchmarking();11$test_suite = $openbenchmarking->download_test_suite('test_suite_name');12$test_profile = $openbenchmarking->download_test_profile('test_profile_name');13$openbenchmarking = new pts_openbenchmarking();14$test_suite = $openbenchmarking->download_test_suite('test_suite_name');15$test_profile = $openbenchmarking->download_test_profile('test_profile_name');16$openbenchmarking = new pts_openbenchmarking();17$test_suite = $openbenchmarking->download_test_suite('test_suite_name');18$test_profile = $openbenchmarking->download_test_profile('test_profile_name');19$openbenchmarking = new pts_openbenchmarking();20$test_suite = $openbenchmarking->download_test_suite('test_suite_name');

Full Screen

Full Screen

download_test_suite

Using AI Code Generation

copy

Full Screen

1require_once('pts-core/classes/openbenchmarking.php');2$test_suite = pts_openbenchmarking::download_test_suite('pts/test-suites/test-suite-name');3print_r($test_suite->get_test_profile_objects());4require_once('pts-core/classes/openbenchmarking.php');5$test_suite = pts_openbenchmarking::download_test_suite('pts/test-suites/test-suite-name');6$test_suite->run_test('test-profile-identifier');7require_once('pts-core/classes/openbenchmarking.php');8$test_suite = pts_openbenchmarking::download_test_suite('pts/test-suites/test-suite-name');9$test_suite->run_test();10require_once('pts-core/classes/openbenchmarking.php');11$test_suite = pts_openbenchmarking::download_test_suite('pts/test-suites/test-suite-name');12$test_suite->run_test();13require_once('pts-core/classes/openbenchmarking.php');14$test_suite = pts_openbenchmarking::download_test_suite('pts/test-suites/test-suite-name');15$test_suite->run_test();

Full Screen

Full Screen

download_test_suite

Using AI Code Generation

copy

Full Screen

1require_once('phoromatic.php');2$test_suite = new pts_openbenchmarking();3$test_suite->download_test_suite('test_suite_name');4require_once('phoromatic.php');5$test_suite = new pts_openbenchmarking();6$test_suite->download_test_suite('test_suite_name', 'directory_name');7require_once('phoromatic.php');8$test_suite = new pts_openbenchmarking();9$test_suite->download_test_suite('test_suite_name', 'directory_name', true);10require_once('phoromatic.php');11$test_suite = new pts_openbenchmarking();12$test_suite->download_test_suite('test_suite_name', 'directory_name', true, true);13require_once('phoromatic.php');14$test_suite = new pts_openbenchmarking();15$test_suite->download_test_suite('test_suite_name', 'directory_name', true, true, true);16require_once('phoromatic

Full Screen

Full Screen

download_test_suite

Using AI Code Generation

copy

Full Screen

1require_once('pts_openbenchmarking.php');2$downloaded_test_suite = pts_openbenchmarking::download_test_suite('7-zip-1.0', '/home/username/Downloads/');3if($downloaded_test_suite != false)4{5 echo 'Downloaded test suite to: ' . $downloaded_test_suite . PHP_EOL;6}7require_once('pts_openbenchmarking.php');8$downloaded_test_suite = pts_openbenchmarking::download_test_suite('7-zip-1.0', '/home/username/Downloads/');9if($downloaded_test_suite != false)10{11 echo 'Downloaded test suite to: ' . $downloaded_test_suite . PHP_EOL;12}13require_once('pts_openbenchmarking.php');

Full Screen

Full Screen

download_test_suite

Using AI Code Generation

copy

Full Screen

1include("pts-core/pts-core.php");2echo pts_openbenchmarking::download_test_suite("test_suite_name");3include("pts-core/pts-core.php");4echo pts_openbenchmarking::download_test_profile("test_profile_name");5include("pts-core/pts-core.php");6echo pts_openbenchmarking::download_test_profile("test_profile_name");7include("pts-core/pts-core.php");8echo pts_openbenchmarking::download_test_profile("test_profile_name");9include("pts-core/pts-core.php");10echo pts_openbenchmarking::download_test_profile("test_profile_name");11include("pts-core/pts-core.php");12echo pts_openbenchmarking::download_test_profile("test_profile_name");13include("pts-core/pts-core.php");14echo pts_openbenchmarking::download_test_profile("test_profile_name");

Full Screen

Full Screen

download_test_suite

Using AI Code Generation

copy

Full Screen

1require_once('pts-core/pts-core.php');2require_once('pts-core/objects/pts_openbenchmarking.php');3$suite_name = $argv[1];4if(pts_openbenchmarking::download_test_suite($suite_name))5{6 echo "Test suite downloaded successfully";7}8{9 echo "Test suite download failed";10}11require_once('pts-core/pts-core.php');12require_once('pts-core/objects/pts_openbenchmarking.php');13$profile_name = $argv[1];14if(pts_openbenchmarking::download_test_profile($profile_name))15{16 echo "Test profile downloaded successfully";17}18{19 echo "Test profile download failed";20}

Full Screen

Full Screen

download_test_suite

Using AI Code Generation

copy

Full Screen

1$test_suite_id = 'pts/test-suites';2$test_suite = new pts_openbenchmarking();3$test_suite->download_test_suite($test_suite_id, true);4$test_suite_id = 'pts/test-suites';5$test_suite = new pts_openbenchmarking();6$test_suite->download_test_suite($test_suite_id, true);

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