当前位置: 首页>>代码示例>>PHP>>正文


PHP pts_openbenchmarking::download_test_profile方法代码示例

本文整理汇总了PHP中pts_openbenchmarking::download_test_profile方法的典型用法代码示例。如果您正苦于以下问题:PHP pts_openbenchmarking::download_test_profile方法的具体用法?PHP pts_openbenchmarking::download_test_profile怎么用?PHP pts_openbenchmarking::download_test_profile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pts_openbenchmarking的用法示例。


在下文中一共展示了pts_openbenchmarking::download_test_profile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: evaluate_string_to_qualifier

 public static function evaluate_string_to_qualifier($supplied, $bind_version = true, $check_only_type = false)
 {
     $qualified = false;
     $c_repo = null;
     $repos = self::linked_repositories();
     if (($c = strpos($supplied, '/')) !== false) {
         // A repository was explicitly defined
         $c_repo = substr($supplied, 0, $c);
         $test = substr($supplied, $c + 1);
         // If it's in the linked repo list it should have refreshed when starting client
         if (!in_array($c_repo, $repos)) {
             // Pull in this repository's index
             pts_openbenchmarking::refresh_repository_lists($repos);
         }
         $repos = array($c_repo);
     } else {
         // If it's in the linked repo list it should have refreshed when starting client
         $test = $supplied;
     }
     if (($c = strrpos($test, '-')) !== false) {
         $version = substr($test, $c + 1);
         // TODO: functionalize this and read against types.xsd
         if (isset($version[2]) && !isset($version[8]) && pts_strings::string_only_contains($version, pts_strings::CHAR_NUMERIC | pts_strings::CHAR_DECIMAL)) {
             $test = substr($test, 0, $c);
         } else {
             $version = null;
         }
     } else {
         $version = null;
     }
     if ($test == null) {
         return false;
     }
     foreach ($repos as $repo) {
         if ($repo == 'local') {
             if (self::check_only_type_compare($check_only_type, 'test')) {
                 if (is_file(PTS_TEST_PROFILE_PATH . $repo . '/' . $test . '/test-definition.xml')) {
                     return $repo . '/' . $test;
                     // ($bind_version ? '-' . $version : null)
                 } else {
                     if (is_file(PTS_TEST_PROFILE_PATH . $repo . '/' . $test . '-' . $version . '/test-definition.xml')) {
                         return $repo . '/' . $test . '-' . $version;
                         // ($bind_version ? '-' . $version : null)
                     }
                 }
             }
             if (self::check_only_type_compare($check_only_type, 'suite')) {
                 if (is_file(PTS_TEST_SUITE_PATH . $repo . '/' . $test . '/suite-definition.xml')) {
                     return $repo . '/' . $test;
                     // ($bind_version ? '-' . $version : null)
                 } else {
                     if (is_file(PTS_TEST_SUITE_PATH . $repo . '/' . $test . '-' . $version . '/suite-definition.xml')) {
                         return $repo . '/' . $test . '-' . $version;
                         // ($bind_version ? '-' . $version : null)
                     }
                 }
             }
         }
         $repo_index = pts_openbenchmarking::read_repository_index($repo);
         if (is_array($repo_index) && isset($repo_index['tests'][$test]) && self::check_only_type_compare($check_only_type, 'test')) {
             // The test profile at least exists
             // Looking for a particular test profile version?
             if ($version != null) {
                 if (!in_array($version, $repo_index['tests'][$test]['versions'])) {
                     // Grep to see if the version passed was e.g. 1.3 instead of 1.3.3
                     $versions = $repo_index['tests'][$test]['versions'];
                     sort($versions);
                     foreach (array_reverse($versions) as $check_version) {
                         if (strstr($check_version, $version) != false) {
                             $version = $check_version;
                             break;
                         }
                     }
                 }
                 if (in_array($version, $repo_index['tests'][$test]['versions'])) {
                     pts_openbenchmarking::download_test_profile($repo . '/' . $test . '-' . $version);
                     return $repo . '/' . $test . ($bind_version ? '-' . $version : null);
                 }
             } else {
                 // Assume to use the latest version unless something else is installed
                 $available_versions = $repo_index['tests'][$test]['versions'];
                 $version = $available_versions[0];
                 // the latest version available
                 if (pts_c::$test_flags & pts_c::is_run_process) {
                     // Check to see if an older version of the test profile is currently installed
                     foreach ($available_versions as $i => $v) {
                         if (is_file(pts_client::test_install_root_path() . $repo . '/' . $test . '-' . $v . '/pts-install.xml')) {
                             $version = $v;
                             if ($i > 0 && pts_c::$test_flags ^ pts_c::batch_mode) {
                                 // It's not the latest test profile version available
                                 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);
                             }
                             break;
                         }
                     }
                 }
                 pts_openbenchmarking::download_test_profile($repo . '/' . $test . '-' . $version);
                 return $repo . '/' . $test . ($bind_version ? '-' . $version : null);
             }
         }
//.........这里部分代码省略.........
开发者ID:pchiruma,项目名称:phoronix-test-suite,代码行数:101,代码来源:pts_openbenchmarking.php

示例2: run

 public static function run($r)
 {
     pts_client::$display->generic_heading('Available Tests');
     $available_tests = pts_openbenchmarking::available_tests(false);
     $available_suites = pts_openbenchmarking::available_suites(false);
     $test_count = count($available_tests);
     $suite_count = count($available_suites);
     $total_count = $test_count + $suite_count;
     $total_cache_count = 0;
     $total_cache_size = 0;
     if ($test_count == 0 || !pts_network::internet_support_available()) {
         echo PHP_EOL . 'No tests found. Please check that you have Internet connectivity to download test profile data from OpenBenchmarking.org. The Phoronix Test Suite has documentation on configuring the network setup, proxy settings, and PHP network options. Please contact Phoronix Media if you continuing to experience problems.' . PHP_EOL . PHP_EOL;
         return false;
     }
     $terminal_width = pts_client::terminal_width();
     // Cache test profiles
     foreach ($available_tests as $i => $identifier) {
         $repo = substr($identifier, 0, strpos($identifier, '/'));
         $test = substr($identifier, strlen($repo) + 1);
         $repo_index = pts_openbenchmarking::read_repository_index($repo);
         echo $i . '/' . $total_count . ': ' . ($repo_index['tests'][$test]['title'] != null ? $repo_index['tests'][$test]['title'] . ' [' . $repo_index['tests'][$test]['test_type'] . ']' : null) . PHP_EOL;
         foreach ($repo_index['tests'][$test]['versions'] as $version) {
             $qualified_identifier = $repo . '/' . $test . '-' . $version;
             echo $qualified_identifier;
             $success = pts_openbenchmarking::download_test_profile($repo . '/' . $test . '-' . $version);
             if ($success && is_file(PTS_OPENBENCHMARKING_SCRATCH_PATH . $qualified_identifier . '.zip')) {
                 $file_size = round(filesize(PTS_OPENBENCHMARKING_SCRATCH_PATH . $qualified_identifier . '.zip') / 1024, 2);
                 $info = $file_size . 'KB - ' . sha1_file(PTS_OPENBENCHMARKING_SCRATCH_PATH . $qualified_identifier . '.zip');
                 $r_size = $terminal_width - strlen($qualified_identifier) - 3 - strlen($info);
                 if ($r_size > 0) {
                     echo ' ' . str_repeat('.', $terminal_width - strlen($qualified_identifier) - 3 - strlen($info)) . ' ' . $info . PHP_EOL;
                 }
                 $total_cache_count++;
                 $total_cache_size += $file_size;
             }
         }
         echo PHP_EOL;
     }
     // Cache test suites
     foreach ($available_suites as $i => $identifier) {
         $repo = substr($identifier, 0, strpos($identifier, '/'));
         $test = substr($identifier, strlen($repo) + 1);
         $repo_index = pts_openbenchmarking::read_repository_index($repo);
         echo $i + $test_count . '/' . $total_count . ': ' . $repo_index['suites'][$test]['title'] . PHP_EOL;
         foreach ($repo_index['suites'][$test]['versions'] as $version) {
             $qualified_identifier = $repo . '/' . $test . '-' . $version;
             echo $qualified_identifier;
             $success = pts_openbenchmarking::download_test_suite($repo . '/' . $test . '-' . $version);
             if ($success && is_file(PTS_OPENBENCHMARKING_SCRATCH_PATH . $qualified_identifier . '.zip')) {
                 $file_size = round(filesize(PTS_OPENBENCHMARKING_SCRATCH_PATH . $qualified_identifier . '.zip') / 1024, 2);
                 $info = $file_size . 'KB - ' . sha1_file(PTS_OPENBENCHMARKING_SCRATCH_PATH . $qualified_identifier . '.zip');
                 $dot_size = $terminal_width - strlen($qualified_identifier) - 3 - strlen($info);
                 echo ' ' . str_repeat('.', $dot_size >= 0 ? $dot_size : 0) . ' ' . $info . PHP_EOL;
                 $total_cache_count++;
                 $total_cache_size += $file_size;
             }
         }
         echo PHP_EOL;
     }
     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;
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:61,代码来源:make_openbenchmarking_cache.php


注:本文中的pts_openbenchmarking::download_test_profile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。