本文整理汇总了PHP中pts_openbenchmarking::read_repository_index方法的典型用法代码示例。如果您正苦于以下问题:PHP pts_openbenchmarking::read_repository_index方法的具体用法?PHP pts_openbenchmarking::read_repository_index怎么用?PHP pts_openbenchmarking::read_repository_index使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pts_openbenchmarking
的用法示例。
在下文中一共展示了pts_openbenchmarking::read_repository_index方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public static function run($r)
{
pts_client::$display->generic_heading('Available Tests');
$test_count = 0;
foreach (pts_openbenchmarking::available_tests(false) as $identifier) {
$repo = substr($identifier, 0, strpos($identifier, '/'));
$id = substr($identifier, strlen($repo) + 1);
$repo_index = pts_openbenchmarking::read_repository_index($repo);
if (!in_array(phodevi::operating_system(), $repo_index['tests'][$id]['supported_platforms']) || empty($repo_index['tests'][$id]['title'])) {
// Don't show unsupported tests
continue;
}
echo sprintf('%-30ls - %-35ls %-9ls', $identifier, $repo_index['tests'][$id]['title'], $repo_index['tests'][$id]['test_type']) . PHP_EOL;
$test_count++;
}
foreach (pts_file_io::glob(PTS_TEST_PROFILE_PATH . 'local/*/test-definition.xml') as $path) {
$test_profile = new pts_test_profile('local/' . basename(dirname($path)));
if ($test_profile->get_title() != null && $test_profile->is_supported(false)) {
echo sprintf('%-30ls - %-35ls %-9ls', $test_profile->get_identifier(), $test_profile->get_title(), $test_profile->get_test_hardware_type()) . PHP_EOL;
$test_count++;
}
}
if ($test_count == 0) {
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;
}
}
示例2: run
public static function run($r)
{
echo PHP_EOL . 'OpenBenchmarking.org Repositories:' . PHP_EOL . PHP_EOL;
foreach (pts_openbenchmarking::linked_repositories() as $repo) {
if ($repo == 'local') {
// Skip local since it's a fake repository
continue;
}
$repo_index = pts_openbenchmarking::read_repository_index($repo);
$generated_time = date('F d H:i', $repo_index['main']['generated']);
$tab = ' ';
foreach (array('tests', 'suites') as $t) {
echo PHP_EOL . str_repeat('=', 40) . PHP_EOL . strtoupper($repo . ' ' . $t) . PHP_EOL . 'Generated: ' . $generated_time . PHP_EOL . str_repeat('=', 40) . PHP_EOL . PHP_EOL;
foreach ($repo_index[$t] as $identifier => $test) {
echo 'Identifier: ' . $identifier . PHP_EOL;
foreach ($test as $i => $j) {
echo sprintf('%-22ls', $i) . ': ';
if (is_array($j)) {
echo implode(', ', $j);
} else {
echo $j;
}
echo PHP_EOL;
}
echo PHP_EOL;
}
}
}
}
示例3: run
public static function run($r)
{
echo PHP_EOL . 'Linked OpenBenchmarking.org Repositories:' . PHP_EOL . PHP_EOL;
foreach (pts_openbenchmarking::linked_repositories() as $repo) {
if ($repo == 'local') {
// Skip local since it's a fake repository
continue;
}
$repo_index = pts_openbenchmarking::read_repository_index($repo);
$test_count = count($repo_index['tests']);
$suite_count = count($repo_index['suites']);
$generated_time = date('F d H:i', $repo_index['main']['generated']);
echo sprintf(' REPO: %-20ls WEB: %-35ls' . PHP_EOL, $repo, 'http://openbenchmarking.org/user/' . $repo);
echo sprintf(' LAST GENERATED: %-3ls' . PHP_EOL, $generated_time);
echo sprintf(' TEST COUNT: %-3ls SUITE COUNT: %-3ls' . PHP_EOL, $test_count, $suite_count);
echo PHP_EOL;
}
}
示例4: run
public static function run($r)
{
pts_client::$display->generic_heading('Recently Updated OpenBenchmarking.org Tests');
$recently_updated = array();
foreach (pts_openbenchmarking::linked_repositories() as $repo) {
if ($repo == 'local') {
// Skip local since it's a fake repository
continue;
}
$repo_index = pts_openbenchmarking::read_repository_index($repo);
$changes[$repo] = pts_openbenchmarking_client::fetch_repository_changelog($repo);
if (isset($repo_index['tests']) && is_array($repo_index['tests'])) {
foreach (array_keys($repo_index['tests']) as $identifier) {
if ($repo_index['tests'][$identifier]['last_updated'] > time() - 90 * 86400) {
$recently_updated[$repo . '/' . $identifier] = $repo_index['tests'][$identifier];
}
}
}
}
if (count($recently_updated) > 0) {
// sort by date
uasort($recently_updated, array('openbenchmarking_changes', 'compare_time_stamps'));
// so that tests are shown from newest to oldest
$recently_updated = array_reverse($recently_updated);
$longest_identifier_length = array_keys($recently_updated);
$longest_identifier_length = strlen(pts_strings::find_longest_string($longest_identifier_length)) + 1;
foreach ($recently_updated as $test_profile => $repo_data) {
echo sprintf('%-' . $longest_identifier_length . 'ls - %-35ls', $test_profile, $repo_data['title']) . PHP_EOL;
$br = explode('/', $test_profile);
if (isset($changes[$br[0]]['tests'][$br[1]]['changes'])) {
foreach ($changes[$br[0]]['tests'][$br[1]]['changes'] as $test_profile_version => $data) {
echo 'v' . $test_profile_version . ' [' . date('d M Y', $data['last_updated']) . ']' . PHP_EOL;
echo ' - ' . $data['commit_description'] . PHP_EOL;
}
} else {
echo 'Last Updated: ' . date('d F Y', $repo_data['last_updated']) . PHP_EOL;
}
echo PHP_EOL;
// $repo_data['test_type']
}
} else {
echo PHP_EOL . 'No updated tests were found.' . PHP_EOL;
}
}
示例5: define
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// INIT
define('PHOROMATIC_SERVER', true);
//ini_set('memory_limit', '64M');
define('PTS_MODE', 'WEB_CLIENT');
define('PTS_AUTO_LOAD_OBJECTS', true);
//error_reporting(E_ALL);
include '../../pts-core.php';
pts_core::init();
if (isset($_GET['index'])) {
$requested_repo = str_replace(array('..', '/'), null, $_GET['repo']);
$repo_index = pts_openbenchmarking::read_repository_index($requested_repo, false);
echo $repo_index;
pts_logger::add_to_log($_SERVER['REMOTE_ADDR'] . ' downloaded a copy of the ' . $requested_repo . ' OpenBenchmarking.org repository index');
} else {
if (isset($_GET['repos'])) {
$index_files = pts_file_io::glob(PTS_OPENBENCHMARKING_SCRATCH_PATH . '*.index');
$json_repos = array();
foreach ($index_files as $index_file) {
$index_data = json_decode(file_get_contents($index_file), true);
$json_repos['repos'][basename($index_file, '.index')] = array('title' => basename($index_file, '.index'), 'generated' => $index_data['main']['generated']);
}
echo json_encode($json_repos);
} else {
if (isset($_GET['test'])) {
$repo = str_replace(array('..', '/'), null, $_GET['repo']);
$test = str_replace(array('..', '/'), null, $_GET['test']);
示例6: get_contained_test_profiles
public function get_contained_test_profiles()
{
$contained = array();
// read the repo
$repo_index = pts_openbenchmarking::read_repository_index($this->repo);
if (isset($repo_index['tests']) && is_array($repo_index['tests'])) {
foreach ($repo_index['tests'] as $test_identifier => &$test) {
if (!in_array(phodevi::operating_system(), $test['supported_platforms']) || empty($test['title'])) {
// Initial check to not do unsupported tests
continue;
}
if ($this->is_virtual_os_selector && !in_array($this->virtual, array_map('strtolower', $test['supported_platforms']))) {
// Doing a virtual suite of all tests specific to an OS, but this test profile is not supported there
continue;
} else {
if ($this->is_virtual_subsystem_selector && $this->virtual != strtolower($test['test_type'])) {
// Doing a virtual suite of all tests specific to a test_type, but this test profile is not supported there
continue;
} else {
if ($this->is_virtual_software_type && $this->virtual != strtolower($test['software_type'])) {
// Doing a virtual suite of all tests specific to a software_type, but this test profile is not supported there
continue;
} else {
if ($this->is_virtual_internal_tag && !in_array($this->virtual, array_map('strtolower', $test['internal_tags']))) {
// Doing a virtual suite of all tests matching an internal tag
continue;
}
}
}
}
$test_version = array_shift($test['versions']);
$test_profile = new pts_test_profile($this->repo . '/' . $test_identifier . '-' . $test_version);
if ($test_profile->get_display_format() != 'BAR_GRAPH' || !in_array($test_profile->get_license(), array('Free', 'Non-Free'))) {
// Also ignore these tests
continue;
}
if ($this->is_virtual_installed && $test_profile->is_test_installed() == false) {
// Test is not installed
continue;
}
if ($test_profile->is_supported(false)) {
// All checks passed, add to virtual suite
array_push($contained, $test_profile);
continue;
}
}
}
return $contained;
}
示例7: read_repository_test_profile_attribute
public static function read_repository_test_profile_attribute($test_profile, $attribute)
{
list($repo, $tp) = explode('/', $test_profile);
$tp = substr($tp, 0, strrpos($tp, '-'));
$repo_index = pts_openbenchmarking::read_repository_index($repo);
return isset($repo_index['tests'][$tp][$attribute]) ? $repo_index['tests'][$tp][$attribute] : null;
}
示例8: get_estimated_run_time
public function get_estimated_run_time()
{
// get estimated run-time (in seconds)
if ($this->test_installation != false && is_numeric($this->test_installation->get_average_run_time()) && $this->test_installation->get_average_run_time() > 0) {
$estimated_run_time = $this->test_installation->get_average_run_time();
} else {
$estimated_run_time = parent::get_estimated_run_time();
}
if ($estimated_run_time < 2 && PTS_IS_CLIENT) {
$identifier = explode('/', $this->get_identifier(false));
$repo_index = pts_openbenchmarking::read_repository_index($identifier[0]);
$estimated_run_time = isset($identifier[1]) && isset($repo_index['tests'][$identifier[1]]) && isset($repo_index['tests'][$identifier[1]]['average_run_time']) ? $repo_index['tests'][$identifier[1]]['average_run_time'] : 0;
}
return $estimated_run_time;
}
示例9: invalid_command_helper
public static function invalid_command_helper($passed_args)
{
$showed_recent_results = self::recently_saved_results();
if (!empty($passed_args)) {
$arg_soundex = soundex($passed_args);
$similar_tests = array();
foreach (pts_openbenchmarking::linked_repositories() as $repo) {
$repo_index = pts_openbenchmarking::read_repository_index($repo);
foreach (array('tests', 'suites') as $type) {
if (isset($repo_index[$type]) && is_array($repo_index[$type])) {
foreach (array_keys($repo_index[$type]) as $identifier) {
if (soundex($identifier) == $arg_soundex) {
array_push($similar_tests, array('- ' . $repo . '/' . $identifier, ' [' . ucwords(substr($type, 0, -1)) . ']'));
}
}
}
}
}
foreach (pts_client::saved_test_results() as $result) {
if (soundex($result) == $arg_soundex) {
array_push($similar_tests, array('- ' . $result, ' [Test Result]'));
}
}
if (count($similar_tests) > 0) {
echo 'Possible Suggestions:' . PHP_EOL;
if (isset($similar_tests[12])) {
// lots of tests... trim it down
$similar_tests = array_rand($similar_tests, 12);
}
echo pts_user_io::display_text_table($similar_tests) . PHP_EOL . PHP_EOL;
}
}
if ($showed_recent_results == false) {
echo 'See available tests to run by visiting OpenBenchmarking.org or running:' . PHP_EOL . PHP_EOL;
echo ' phoronix-test-suite list-tests' . PHP_EOL . PHP_EOL;
echo 'Tests can be installed by running:' . PHP_EOL . PHP_EOL;
echo ' phoronix-test-suite install <test-name>' . PHP_EOL;
}
}
示例10: 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);
}
}
//.........这里部分代码省略.........
示例11: 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;
}