本文整理汇总了PHP中pts_client::test_install_root_path方法的典型用法代码示例。如果您正苦于以下问题:PHP pts_client::test_install_root_path方法的具体用法?PHP pts_client::test_install_root_path怎么用?PHP pts_client::test_install_root_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pts_client
的用法示例。
在下文中一共展示了pts_client::test_install_root_path方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: partially_installed_tests
public static function partially_installed_tests()
{
$cleaned_tests = array();
$repo = '*';
$install_root_path = pts_client::test_install_root_path();
$install_root_path_length = strlen($install_root_path);
foreach (pts_file_io::glob($install_root_path . $repo . '/*') as $identifier_path) {
array_push($cleaned_tests, substr($identifier_path, $install_root_path_length));
}
return $cleaned_tests;
}
示例2: standard_install
public static function standard_install($items_to_install, $force_install = false, $no_prompts = false, $skip_tests_with_missing_dependencies = false)
{
// Refresh the pts_client::$display in case we need to run in debug mode
if (pts_client::$display == false || !pts_client::$display instanceof pts_websocket_display_mode) {
pts_client::init_display_mode();
}
// Create a lock
$lock_path = pts_client::temporary_directory() . '/phoronix-test-suite.active';
pts_client::create_lock($lock_path);
// Get the test profiles
$unknown_tests = array();
$test_profiles = pts_types::identifiers_to_test_profile_objects($items_to_install, true, true, $unknown_tests);
// Any external dependencies?
pts_external_dependencies::install_dependencies($test_profiles, $no_prompts, $skip_tests_with_missing_dependencies);
// Install tests
if (!is_writable(pts_client::test_install_root_path())) {
trigger_error('The test installation directory is not writable.' . PHP_EOL . 'Location: ' . pts_client::test_install_root_path(), E_USER_ERROR);
return false;
}
pts_test_installer::start_install($test_profiles, $unknown_tests, $force_install, $no_prompts);
pts_client::release_lock($lock_path);
return $test_profiles;
}
示例3: file_lookaside_test_installations
public static function file_lookaside_test_installations(&$test_file_download)
{
// Check to see if the same package name with the same package check-sum is already present in another test installation
$package_match = false;
foreach (pts_file_io::glob(pts_client::test_install_root_path() . '*/*/' . $test_file_download->get_filename()) as $possible_package_match) {
// Check to see if the same package name with the same package check-sum is already present in another test installation
if ($test_file_download->check_file_hash($possible_package_match)) {
$package_match = $possible_package_match;
break;
}
}
return $package_match;
}
示例4: get_install_dir
public function get_install_dir()
{
return pts_client::test_install_root_path() . $this->identifier . '/';
}
示例5: initial_checks
public function initial_checks(&$to_run, $override_display_mode = false)
{
// Refresh the pts_client::$display in case we need to run in debug mode
if (pts_client::$display == false || !pts_client::$display instanceof pts_websocket_display_mode) {
pts_client::init_display_mode($override_display_mode);
}
$to_run = pts_types::identifiers_to_objects($to_run);
if ($this->batch_mode && $this->batch_mode['Configured'] == false && !$this->auto_mode) {
trigger_error('The batch mode must first be configured.' . PHP_EOL . 'To configure, run phoronix-test-suite batch-setup', E_USER_ERROR);
return false;
}
if (!is_writable(pts_client::test_install_root_path())) {
trigger_error('The test installation directory is not writable.' . PHP_EOL . 'Location: ' . pts_client::test_install_root_path(), E_USER_ERROR);
return false;
}
// Cleanup tests to run
if (pts_test_run_manager::cleanup_tests_to_run($to_run) == false) {
return false;
} else {
if (count($to_run) == 0) {
trigger_error('You must enter at least one test, suite, or result identifier to run.', E_USER_ERROR);
return false;
}
}
return true;
}
示例6: sw_filesystem
public static function sw_filesystem()
{
// Determine file-system type
$fs = null;
if (phodevi::is_macosx()) {
$fs = phodevi_osx_parser::read_osx_system_profiler('SPSerialATADataType', 'FileSystem');
if ($fs == null && pts_client::executable_in_path('mount')) {
$mount = shell_exec('mount 2>&1');
if (stripos($mount, ' on / (hfs, local, journaled)') !== false) {
$fs = 'Journaled HFS+';
} else {
if (stripos($mount, ' on / (hfs') !== false) {
$fs = 'HFS+';
}
}
}
} else {
if (phodevi::is_bsd()) {
if (pts_client::executable_in_path('mount')) {
$mount = shell_exec('mount 2>&1');
if (($start = strpos($mount, 'on / (')) != false) {
// FreeBSD, DragonflyBSD mount formatting
/*
-bash-4.0$ mount
ROOT on / (hammer, local)
/dev/da0s1a on /boot (ufs, local)
/pfs/@@-1:00001 on /var (null, local)
/pfs/@@-1:00002 on /tmp (null, local)
/pfs/@@-1:00003 on /usr (null, local)
/pfs/@@-1:00004 on /home (null, local)
/pfs/@@-1:00005 on /usr/obj (null, local)
/pfs/@@-1:00006 on /var/crash (null, local)
/pfs/@@-1:00007 on /var/tmp (null, local)
procfs on /proc (procfs, local)
*/
// TODO: improve this in case there are other partitions, etc
$fs = substr($mount, $start + 6);
$fs = substr($fs, 0, strpos($fs, ','));
} else {
if (($start = strpos($mount, 'on / type')) != false) {
// OpenBSD 5.0 formatting is slightly different from above FreeBSD example
// TODO: improve this in case there are other partitions, etc
$fs = substr($mount, $start + 10);
$fs = substr($fs, 0, strpos($fs, ' '));
}
}
}
} else {
if (phodevi::is_hurd()) {
// Very rudimentary Hurd filesystem detection support but works for at least a clean Debian GNU/Hurd EXT2 install
if (pts_client::executable_in_path('mount')) {
$mount = shell_exec('mount 2>&1');
if (($start = strpos($mount, 'on / type')) != false) {
$fs = substr($mount, $start + 10);
$fs = substr($fs, 0, strpos($fs, ' '));
if (substr($fs, -2) == 'fs') {
$fs = substr($fs, 0, -2);
}
}
}
} else {
if (phodevi::is_linux() || phodevi::is_solaris()) {
$fs = trim(shell_exec('stat ' . pts_client::test_install_root_path() . ' -L -f -c %T 2> /dev/null'));
switch ($fs) {
case 'ext2/ext3':
if (isset(phodevi::$vfs->mounts)) {
$fstab = phodevi::$vfs->mounts;
$fstab = str_replace('/boot ', 'IGNORE', $fstab);
$using_ext2 = strpos($fstab, ' ext2') !== false;
$using_ext3 = strpos($fstab, ' ext3') !== false;
$using_ext4 = strpos($fstab, ' ext4') !== false;
if (!$using_ext2 && !$using_ext3 && $using_ext4) {
$fs = 'ext4';
} else {
if (!$using_ext2 && !$using_ext4 && $using_ext3) {
$fs = 'ext3';
} else {
if (!$using_ext3 && !$using_ext4 && $using_ext2) {
$fs = 'ext2';
} else {
if (is_dir('/proc/fs/ext4/')) {
$fs = 'ext4';
} else {
if (is_dir('/proc/fs/ext3/')) {
$fs = 'ext3';
}
}
}
}
}
}
break;
case 'Case-sensitive Journaled HFS+':
$fs = 'HFS+';
break;
case 'MS-DOS FAT32':
$fs = 'FAT32';
break;
case 'UFSD_NTFS_COMPR':
$fs = 'NTFS';
//.........这里部分代码省略.........
示例7: 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);
}
}
//.........这里部分代码省略.........
示例8: hdd_string
public static function hdd_string()
{
$disks = array();
if (phodevi::is_macosx()) {
// TODO: Support reading non-SATA drives and more than one drive
$capacity = phodevi_osx_parser::read_osx_system_profiler('SPSerialATADataType', 'Capacity');
$model = phodevi_osx_parser::read_osx_system_profiler('SPSerialATADataType', 'Model');
if (($cut = strpos($capacity, ' (')) !== false) {
$capacity = substr($capacity, 0, $cut);
}
if (($cut = strpos($capacity, ' ')) !== false) {
if (is_numeric(substr($capacity, 0, $cut))) {
$capacity = floor(substr($capacity, 0, $cut)) . substr($capacity, $cut);
}
}
$capacity = str_replace(' GB', 'GB', $capacity);
if (!empty($capacity) && !empty($model)) {
$disks = array($capacity . ' ' . $model);
}
} else {
if (phodevi::is_bsd()) {
$i = 0;
do {
$disk = phodevi_bsd_parser::read_sysctl('dev.ad.' . $i . '.%desc');
if ($disk != false && strpos($disk, 'DVD') === false && strpos($disk, 'ATAPI') === false) {
array_push($disks, $disk);
}
$i++;
} while (($disk != false || $i < 9) && $i < 128);
// On some systems, the first drive seems to be at dev.ad.8 rather than starting at dev.ad.0
if (empty($disks) && pts_client::executable_in_path('camcontrol')) {
$camcontrol = trim(shell_exec('camcontrol devlist 2>&1'));
foreach (explode(PHP_EOL, $camcontrol) as $line) {
if (substr($line, 0, 1) == '<' && ($model_end = strpos($line, '>')) !== false && strpos($line, 'DVD') === false && strpos($line, 'ATAPI') === false) {
$disk = self::prepend_disk_vendor(substr($line, 1, $model_end - 1));
array_push($disks, $disk);
}
}
}
} else {
if (phodevi::is_solaris()) {
if (is_executable('/usr/ddu/bin/i386/hd_detect')) {
$hd_detect = explode(PHP_EOL, trim(shell_exec('/usr/ddu/bin/i386/hd_detect -l 2>&1')));
foreach ($hd_detect as $hd_line) {
if (isset($hd_line) && ($hd_pos = strpos($hd_line, ':/')) != false) {
$disk = trim(substr($hd_line, 0, $hd_pos));
$disk = self::prepend_disk_vendor($disk);
if ($disk != 'blkdev') {
array_push($disks, $disk);
}
}
}
}
} else {
if (phodevi::is_linux()) {
$disks_formatted = array();
$disks = array();
foreach (array_merge(pts_file_io::glob('/sys/block/sd*'), pts_file_io::glob('/sys/block/mmcblk*')) as $sdx) {
if (strpos($sdx, 'boot') !== false) {
// Don't include devices like /sys/block/mmcblk0boot[0,1] as it's repeat of /sys/block/mmcblk0
continue;
}
if ((is_file($sdx . '/device/name') || is_file($sdx . '/device/model')) && is_file($sdx . '/size')) {
$disk_size = pts_file_io::file_get_contents($sdx . '/size');
$disk_model = pts_file_io::file_get_contents($sdx . (is_file($sdx . '/device/model') ? '/device/model' : '/device/name'));
$disk_removable = pts_file_io::file_get_contents($sdx . '/removable');
if ($disk_removable == '1') {
// Don't count removable disks
continue;
}
$disk_size = round($disk_size * 512 / 1000000000) . 'GB';
$disk_model = self::prepend_disk_vendor($disk_model);
if (strpos($disk_model, $disk_size . ' ') === false && strpos($disk_model, ' ' . $disk_size) === false && $disk_size != '1GB') {
$disk_model = $disk_size . ' ' . $disk_model;
}
if ($disk_size > 0) {
array_push($disks_formatted, $disk_model);
}
}
}
for ($i = 0; $i < count($disks_formatted); $i++) {
if (!empty($disks_formatted[$i])) {
$times_found = 1;
for ($j = $i + 1; $j < count($disks_formatted); $j++) {
if ($disks_formatted[$i] == $disks_formatted[$j]) {
$times_found++;
$disks_formatted[$j] = '';
}
}
$disk = ($times_found > 1 ? $times_found . ' x ' : null) . $disks_formatted[$i];
array_push($disks, $disk);
}
}
}
}
}
}
if (count($disks) == 0) {
$root_disk_size = ceil(disk_total_space('/') / 1073741824);
$pts_disk_size = ceil(disk_total_space(pts_client::test_install_root_path()) / 1073741824);
//.........这里部分代码省略.........