本文整理汇总了PHP中pts_openbenchmarking::download_test_suite方法的典型用法代码示例。如果您正苦于以下问题:PHP pts_openbenchmarking::download_test_suite方法的具体用法?PHP pts_openbenchmarking::download_test_suite怎么用?PHP pts_openbenchmarking::download_test_suite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pts_openbenchmarking
的用法示例。
在下文中一共展示了pts_openbenchmarking::download_test_suite方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: evaluate_string_to_qualifier
//.........这里部分代码省略.........
}
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);
}
}
if (is_array($repo_index) && isset($repo_index['suites'][$test]) && self::check_only_type_compare($check_only_type, 'suite')) {
// The test profile at least exists
// Looking for a particular test profile version?
if ($version != null) {
if (!in_array($version, $repo_index['suites'][$test]['versions'])) {
// Grep to see if the version passed was e.g. 1.3 instead of 1.3.3
$versions = $repo_index['suites'][$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['suites'][$test]['versions'])) {
pts_openbenchmarking::download_test_suite($repo . '/' . $test . '-' . $version);
return $repo . '/' . $test . ($bind_version ? '-' . $version : null);
}
} else {
// Assume to use the latest version
$version = array_shift($repo_index['suites'][$test]['versions']);
pts_openbenchmarking::download_test_suite($repo . '/' . $test . '-' . $version);
return $repo . '/' . $test . ($bind_version ? '-' . $version : null);
}
}
}
return false;
}
示例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;
}