Best Phoronix-test-suite code snippet using pts_core.user_home_directory
pts-core.php
Source:pts-core.php
...28 $php_version = explode('.', PHP_VERSION);29 pts_define('PHP_VERSION_ID', ($php_version[0] * 10000 + $php_version[1] * 100 + $php_version[2]));30 }31 }32 public static function user_home_directory()33 {34 // Gets the system user's home directory35 static $userhome = null;36 if($userhome == null)37 {38 if(function_exists('posix_getpwuid') && function_exists('posix_getuid'))39 {40 $userinfo = posix_getpwuid(posix_getuid());41 $userhome = $userinfo['dir'];42 }43 else if(($home = pts_client::read_env('HOME')))44 {45 $userhome = $home;46 }47 else if(($home = pts_client::read_env('HOMEPATH')))48 {49 $userhome = pts_client::read_env('HOMEDRIVE') . $home;50 }51 else if(PTS_IS_DAEMONIZED_SERVER_PROCESS)52 {53 $userhome = PTS_USER_PATH;54 }55 else if(substr(__FILE__, 0, 6) == '/home/')56 {57 $home_dir = substr(__FILE__, 0, strpos(__FILE__, '/', 7)) . '/';58 if(is_dir($home_dir) && is_dir($home_dir . '.phoronix-test-suite'))59 {60 $userhome = $home_dir;61 }62 }63 else64 {65 if(!is_writable('/'))66 {67 echo PHP_EOL . 'ERROR: Cannot find home directory.' . PHP_EOL;68 }69 $userhome = null;70 }71 $userhome = pts_strings::add_trailing_slash($userhome);72 }73 return $userhome;74 }75 public static function codename($full_string = false)76 {77 $codename = ucwords(strtolower(PTS_CODENAME));78 return ($full_string ? 'PhoronixTestSuite/' : null) . $codename;79 }80 public static function program_title($show_codename = false)81 {82 return 'Phoronix Test Suite v' . PTS_VERSION . ($show_codename ? ' (' . pts_core::codename() . ')' : null);83 }84}85function pts_define($name, $value = null)86{87 static $defines;88 if($name === -1)89 {90 return $defines;91 }92 else if(isset($defines[$name]))93 {94 return false;95 }96 $defines[$name] = $value;97 define($name, $value);98}99function pts_define_directories()100{101 // User's home directory for storing results, module files, test installations, etc.102 pts_define('PTS_CORE_PATH', PTS_PATH . 'pts-core/');103 pts_define('PTS_IS_DAEMONIZED_SERVER_PROCESS', PTS_IS_CLIENT && is_writable('/var/lib/') && is_writable('/etc') ? true : false);104 if(($user_path_override = getenv('PTS_USER_PATH_OVERRIDE')) != false && is_dir($user_path_override))105 {106 pts_define('PTS_USER_PATH', $user_path_override);107 }108 if(PTS_IS_DAEMONIZED_SERVER_PROCESS)109 {110 if(!is_dir('/var/cache/phoronix-test-suite/'))111 {112 mkdir('/var/cache/phoronix-test-suite/');113 }114 pts_define('PTS_USER_PATH', '/var/lib/phoronix-test-suite/');115 pts_define('PTS_CORE_STORAGE', PTS_USER_PATH . 'core.pt2so');116 pts_define('PTS_DOWNLOAD_CACHE_PATH', '/var/cache/phoronix-test-suite/download-cache/');117 pts_define('PTS_OPENBENCHMARKING_SCRATCH_PATH', '/var/cache/phoronix-test-suite/openbenchmarking.org/');118 pts_define('PTS_TEST_PROFILE_PATH', PTS_USER_PATH . 'test-profiles/');119 pts_define('PTS_TEST_SUITE_PATH', PTS_USER_PATH . 'test-suites/');120 }121 else if(PTS_IS_CLIENT)122 {123 /* if(!is_dir(pts_core::user_home_directory() . '.phoronix-test-suite') && stripos(PHP_OS, 'win') !== false && getenv('AppData'))124 {125 pts_define('PTS_USER_PATH', getenv('AppData') . DIRECTORY_SEPARATOR . 'phoronix-test-suite' . DIRECTORY_SEPARATOR);126 }127 else128 { */129 pts_define('PTS_USER_PATH', pts_core::user_home_directory() . '.phoronix-test-suite' . DIRECTORY_SEPARATOR);130 //}131 pts_define('PTS_CORE_STORAGE', PTS_USER_PATH . 'core.pt2so');132 pts_define('PTS_DOWNLOAD_CACHE_PATH', PTS_USER_PATH . 'download-cache/');133 pts_define('PTS_OPENBENCHMARKING_SCRATCH_PATH', PTS_USER_PATH . 'openbenchmarking.org/');134 pts_define('PTS_TEST_PROFILE_PATH', PTS_USER_PATH . 'test-profiles/');135 pts_define('PTS_TEST_SUITE_PATH', PTS_USER_PATH . 'test-suites/');136 }137 else if(defined('PTS_STORAGE_PATH'))138 {139 pts_define('PTS_OPENBENCHMARKING_SCRATCH_PATH', PTS_STORAGE_PATH . 'openbenchmarking.org/');140 pts_define('PTS_TEST_PROFILE_PATH', PTS_STORAGE_PATH . 'test-profiles/');141 pts_define('PTS_TEST_SUITE_PATH', PTS_STORAGE_PATH . 'test-suites/');142 }143 else if(defined('PATH_TO_PHOROMATIC_STORAGE'))...
user_home_directory
Using AI Code Generation
1include_once('pts-core.php');2$pts_core = new pts_core();3$user_home_directory = $pts_core->user_home_directory();4echo $user_home_directory;5include_once('pts-core.php');6$pts_core = new pts_core();7$user_home_directory = $pts_core->user_home_directory();8echo $user_home_directory;9include_once('pts-core.php');10$pts_core = new pts_core();11$user_home_directory = $pts_core->user_home_directory();12echo $user_home_directory;13include_once('pts-core.php');14$pts_core = new pts_core();15$user_home_directory = $pts_core->user_home_directory();16echo $user_home_directory;17include_once('pts-core.php');18$pts_core = new pts_core();19$user_home_directory = $pts_core->user_home_directory();20echo $user_home_directory;21include_once('pts-core.php');22$pts_core = new pts_core();23$user_home_directory = $pts_core->user_home_directory();24echo $user_home_directory;25include_once('pts-core.php');26$pts_core = new pts_core();27$user_home_directory = $pts_core->user_home_directory();28echo $user_home_directory;29include_once('pts-core.php');30$pts_core = new pts_core();31$user_home_directory = $pts_core->user_home_directory();32echo $user_home_directory;33include_once('pts-core.php');34$pts_core = new pts_core();35$user_home_directory = $pts_core->user_home_directory();36echo $user_home_directory;37include_once('pts-core.php');38$pts_core = new pts_core();
user_home_directory
Using AI Code Generation
1require_once('pts-core/pts-core.php');2$home_dir = pts_core::user_home_directory();3echo $home_dir;4require_once('pts-core/pts-core.php');5$home_dir = pts_core::user_home_directory();6echo $home_dir;7require_once('pts-core/pts-core.php');8$home_dir = pts_core::user_home_directory();9echo $home_dir;10require_once('pts-core/pts-core.php');11$home_dir = pts_core::user_home_directory();12echo $home_dir;13require_once('pts-core/pts-core.php');14$home_dir = pts_core::user_home_directory();15echo $home_dir;16require_once('pts-core/pts-core.php');17$home_dir = pts_core::user_home_directory();18echo $home_dir;19require_once('pts-core/pts-core.php');20$home_dir = pts_core::user_home_directory();21echo $home_dir;22require_once('pts-core/pts-core.php');23$home_dir = pts_core::user_home_directory();24echo $home_dir;25require_once('pts-core/pts-core.php');26$home_dir = pts_core::user_home_directory();27echo $home_dir;28require_once('pts-core/pts-core.php');29$home_dir = pts_core::user_home_directory();30echo $home_dir;31require_once('pts-core/pts-core.php');32$home_dir = pts_core::user_home_directory();33echo $home_dir;
user_home_directory
Using AI Code Generation
1require_once('pts-core.php');2$pts_core = new pts_core();3$pts_core->user_home_directory();4require_once('pts-core.php');5$pts_core = new pts_core();6$pts_core->user_home_directory();
user_home_directory
Using AI Code Generation
1$pts_core = new pts_core();2$user_home = $pts_core->user_home_directory();3echo $user_home;4$pts_core = new pts_core();5$curr_dir = $pts_core->current_working_directory();6echo $curr_dir;7$pts_core = new pts_core();8$curr_script_dir = $pts_core->current_script_directory();9echo $curr_script_dir;10$pts_core = new pts_core();11$curr_script_filename = $pts_core->current_script_filename();12echo $curr_script_filename;13$pts_core = new pts_core();14$curr_script_path = $pts_core->current_script_path();15echo $curr_script_path;16$pts_core = new pts_core();17$curr_script_filename_without_extension = $pts_core->current_script_filename_without_extension();18echo $curr_script_filename_without_extension;19$pts_core = new pts_core();20$curr_script_filename_with_extension = $pts_core->current_script_filename_with_extension();21echo $curr_script_filename_with_extension;22$pts_core = new pts_core();
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Execute automation tests with user_home_directory on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.
Test now for FreeGet 100 minutes of automation test minutes FREE!!