本文整理汇总了PHP中pts_client::current_command方法的典型用法代码示例。如果您正苦于以下问题:PHP pts_client::current_command方法的具体用法?PHP pts_client::current_command怎么用?PHP pts_client::current_command使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pts_client
的用法示例。
在下文中一共展示了pts_client::current_command方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cleanup_tests_to_run
public static function cleanup_tests_to_run(&$to_run_objects)
{
$skip_tests = ($e = pts_client::read_env('SKIP_TESTS')) ? pts_strings::comma_explode($e) : false;
$tests_verified = array();
$tests_missing = array();
foreach ($to_run_objects as &$run_object) {
if ($skip_tests && (in_array($run_object->get_identifier(false), $skip_tests) || $run_object instanceof pts_test_profile && in_array($run_object->get_identifier_base_name(), $skip_tests))) {
pts_client::$display->generic_sub_heading('Skipping: ' . $run_object->get_identifier());
continue;
} else {
if ($run_object instanceof pts_test_profile) {
if ($run_object->get_title() == null) {
pts_client::$display->generic_sub_heading('Not A Test: ' . $run_object);
continue;
} else {
if ($run_object->is_supported(false) == false) {
continue;
}
if ($run_object->is_test_installed() == false) {
// Check to see if older version of test is currently installed
// TODO: show change-log between installed versions and upstream
array_push($tests_missing, $run_object);
continue;
}
}
} else {
if ($run_object instanceof pts_result_file) {
$num_installed = 0;
foreach ($run_object->get_contained_test_profiles() as $test_profile) {
if ($test_profile == null || $test_profile->get_identifier() == null || $test_profile->is_supported(false) == false) {
continue;
} else {
if ($test_profile->is_test_installed() == false) {
array_push($tests_missing, $test_profile);
} else {
$num_installed++;
}
}
}
if ($num_installed == 0) {
continue;
}
} else {
if ($run_object instanceof pts_test_suite || $run_object instanceof pts_virtual_test_suite || $run_object instanceof pts_virtual_test_queue) {
if ($run_object->is_core_version_supported() == false) {
pts_client::$display->generic_sub_heading($run_object->get_title() . ' is a suite not supported by this version of the Phoronix Test Suite.');
continue;
}
$num_installed = 0;
foreach ($run_object->get_contained_test_profiles() as $test_profile) {
if ($test_profile == null || $test_profile->get_identifier() == null || $test_profile->is_supported(false) == false) {
continue;
}
if ($test_profile->is_test_installed() == false) {
array_push($tests_missing, $test_profile);
} else {
$num_installed++;
}
}
if ($num_installed == 0) {
continue;
}
} else {
pts_client::$display->generic_sub_heading('Not Recognized: ' . $run_object);
continue;
}
}
}
}
array_push($tests_verified, $run_object);
}
$to_run_objects = $tests_verified;
if (count($tests_missing) > 0 && !defined('PHOROMATIC_PROCESS')) {
$tests_missing = array_unique($tests_missing);
if (count($tests_missing) == 1) {
trigger_error($tests_missing[0] . ' is not installed.', E_USER_ERROR);
// PHP_EOL . 'To install, run: phoronix-test-suite install ' . $tests_missing[0]
} else {
$message = PHP_EOL . PHP_EOL . 'Multiple tests are not installed:' . PHP_EOL . PHP_EOL;
$message .= pts_user_io::display_text_list($tests_missing);
//$message .= PHP_EOL . 'To install, run: phoronix-test-suite install ' . implode(' ', $tests_missing) . PHP_EOL . PHP_EOL;
echo $message;
}
if (!$this->batch_mode && !$this->auto_mode && pts_client::current_command() != 'benchmark') {
$stop_and_install = pts_user_io::prompt_bool_input('Would you like to stop and install these tests now', true);
if ($stop_and_install) {
pts_test_installer::standard_install($tests_missing);
self::cleanup_tests_to_run($to_run_objects);
}
}
}
return true;
}
示例2: execute_command
public static function execute_command($command, $pass_args = null)
{
if (!class_exists($command, false) && is_file(PTS_COMMAND_PATH . $command . '.php')) {
include PTS_COMMAND_PATH . $command . '.php';
}
if (is_file(PTS_COMMAND_PATH . $command . '.php') && method_exists($command, 'argument_checks')) {
$argument_checks = call_user_func(array($command, 'argument_checks'));
foreach ($argument_checks as &$argument_check) {
$function_check = $argument_check->get_function_check();
$method_check = false;
if (is_array($function_check) && count($function_check) == 2) {
$method_check = $function_check[0];
$function_check = $function_check[1];
}
if (substr($function_check, 0, 1) == '!') {
$function_check = substr($function_check, 1);
$return_fails_on = true;
} else {
$return_fails_on = false;
}
if ($method_check != false) {
if (!method_exists($method_check, $function_check)) {
echo PHP_EOL . 'Method check fails.' . PHP_EOL;
continue;
}
$function_check = array($method_check, $function_check);
} else {
if (!function_exists($function_check)) {
continue;
}
}
if ($argument_check->get_argument_index() == 'VARIABLE_LENGTH') {
$return_value = null;
foreach ($pass_args as $arg) {
$return_value = call_user_func_array($function_check, array($arg));
if ($return_value == true) {
break;
}
}
} else {
$return_value = call_user_func_array($function_check, array(isset($pass_args[$argument_check->get_argument_index()]) ? $pass_args[$argument_check->get_argument_index()] : null));
}
if ($return_value == $return_fails_on) {
$command_alias = defined($command . '::doc_use_alias') ? constant($command . '::doc_use_alias') : $command;
if (isset($pass_args[$argument_check->get_argument_index()]) && !empty($pass_args[$argument_check->get_argument_index()]) || $argument_check->get_argument_index() == 'VARIABLE_LENGTH' && !empty($pass_args)) {
trigger_error('Invalid Argument: ' . implode(' ', $pass_args), E_USER_ERROR);
} else {
trigger_error('Phoronix Test Suite Argument Missing.', E_USER_ERROR);
}
echo PHP_EOL . 'CORRECT SYNTAX:' . PHP_EOL . 'phoronix-test-suite ' . str_replace('_', '-', $command_alias) . ' ' . implode(' ', $argument_checks) . PHP_EOL . PHP_EOL;
if (method_exists($command, 'invalid_command')) {
call_user_func_array(array($command, 'invalid_command'), $pass_args);
echo PHP_EOL;
}
return false;
} else {
if ($argument_check->get_function_return_key() != null && !isset($pass_args[$argument_check->get_function_return_key()])) {
$pass_args[$argument_check->get_function_return_key()] = $return_value;
}
}
}
}
pts_module_manager::module_process('__pre_option_process', $command);
if (is_file(PTS_COMMAND_PATH . $command . '.php')) {
self::$current_command = $command;
if (method_exists($command, 'run')) {
call_user_func(array($command, 'run'), $pass_args);
} else {
echo PHP_EOL . 'There is an error in the requested command: ' . $command . PHP_EOL . PHP_EOL;
}
} else {
if (($t = pts_module::valid_run_command($command)) != false) {
list($module, $module_command) = $t;
pts_module_manager::set_current_module($module);
pts_module_manager::run_command($module, $module_command, $pass_args);
pts_module_manager::set_current_module(null);
}
}
echo PHP_EOL;
pts_module_manager::module_process('__post_option_process', $command);
}
示例3: 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_IS_CLIENT && pts_client::current_command() == 'pts_test_run_manager') {
// Check to see if an older version of the test profile is currently installed to ru nthat since no version specified
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) {
// 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);
}
}
//.........这里部分代码省略.........