How to use core_storage_init_process method of pts_client class

Best Phoronix-test-suite code snippet using pts_client.core_storage_init_process

pts_client.php

Source:pts_client.php Github

copy

Full Screen

...77 if(PTS_IS_CLIENT)78 {79 pts_network::client_startup();80 }81 self::core_storage_init_process();82 if(!is_file(PTS_TEMP_STORAGE))83 {84 self::build_temp_cache();85 }86 pts_define('PTS_TEST_INSTALL_DEFAULT_PATH', pts_strings::parse_for_home_directory(pts_config::read_user_config('PhoronixTestSuite/Options/Installation/EnvironmentDirectory', '~/.phoronix-test-suite/installed-tests/')));87 pts_define('PTS_SAVE_RESULTS_PATH', pts_strings::parse_for_home_directory(pts_config::read_user_config('PhoronixTestSuite/Options/Testing/ResultsDirectory', '~/.phoronix-test-suite/test-results/')));88 self::extended_init_process();89 $openbenchmarking = pts_storage_object::read_from_file(PTS_CORE_STORAGE, 'openbenchmarking');90 $openbenchmarking_account_settings = pts_storage_object::read_from_file(PTS_CORE_STORAGE, 'openbenchmarking_account_settings');91 if($openbenchmarking != null)92 {93 // OpenBenchmarking.org Account94 pts_openbenchmarking_client::init_account($openbenchmarking, $openbenchmarking_account_settings);95 }96 return true;97 }98 private static function extended_init_process()99 {100 // Extended Initalization Process101 $directory_check = array(102 PTS_TEST_INSTALL_DEFAULT_PATH,103 PTS_SAVE_RESULTS_PATH,104 PTS_MODULE_LOCAL_PATH,105 PTS_MODULE_DATA_PATH,106 PTS_DOWNLOAD_CACHE_PATH,107 PTS_OPENBENCHMARKING_SCRATCH_PATH,108 PTS_TEST_PROFILE_PATH,109 PTS_TEST_SUITE_PATH,110 PTS_TEST_PROFILE_PATH . 'local/',111 PTS_TEST_SUITE_PATH . 'local/'112 );113 foreach($directory_check as $dir)114 {115 pts_file_io::mkdir($dir);116 }117 // Setup ~/.phoronix-test-suite/xsl/118 pts_file_io::mkdir(PTS_USER_PATH . 'xsl/');119 copy(PTS_CORE_STATIC_PATH . 'xsl/pts-test-installation-viewer.xsl', PTS_USER_PATH . 'xsl/' . 'pts-test-installation-viewer.xsl');120 copy(PTS_CORE_STATIC_PATH . 'xsl/pts-user-config-viewer.xsl', PTS_USER_PATH . 'xsl/' . 'pts-user-config-viewer.xsl');121 copy(PTS_CORE_STATIC_PATH . 'images/pts-308x160.png', PTS_USER_PATH . 'xsl/' . 'pts-logo.png');122 // pts_compatibility ops here123 pts_client::init_display_mode();124 }125 public static function module_framework_init()126 {127 // Process initially called when PTS starts up128 // Check for modules to auto-load from the configuration file129 $load_modules = pts_config::read_user_config('PhoronixTestSuite/Options/Modules/LoadModules', null);130 if(!empty($load_modules))131 {132 foreach(pts_strings::comma_explode($load_modules) as $module)133 {134 $module_r = pts_strings::trim_explode('=', $module);135 if(count($module_r) == 2)136 {137 // TODO: end up hooking this into pts_module::read_variable() rather than using the real env138 pts_client::set_environment_variable($module_r[0], $module_r[1]);139 }140 else141 {142 pts_module_manager::attach_module($module);143 }144 }145 }146 // Check for modules to load manually in PTS_MODULES147 if(($load_modules = pts_client::read_env('PTS_MODULES')) !== false)148 {149 foreach(pts_strings::comma_explode($load_modules) as $module)150 {151 if(!pts_module_manager::is_module_attached($module))152 {153 pts_module_manager::attach_module($module);154 }155 }156 }157 // Detect modules to load automatically158 pts_module_manager::detect_modules_to_load();159 // Clean-up modules list160 pts_module_manager::clean_module_list();161 // Reset counter162 pts_module_manager::set_current_module(null);163 // Load the modules164 $module_store_list = array();165 foreach(pts_module_manager::attached_modules() as $module)166 {167 $class_vars = get_class_vars($module);168 $module_store_vars = isset($class_vars['module_store_vars']) ? $class_vars['module_store_vars'] : null;169 if(is_array($module_store_vars))170 {171 foreach($module_store_vars as $store_var)172 {173 if(!in_array($store_var, $module_store_list))174 {175 $module_store_list[] = $store_var;176 }177 }178 }179 }180 // Should any of the module options be saved to the results?181 foreach($module_store_list as $var)182 {183 $var_value = pts_client::read_env($var);184 if(!empty($var_value))185 {186 pts_module_manager::var_store_add($var, $var_value);187 }188 }189 pts_module_manager::module_process('__startup');190 pts_define('PTS_STARTUP_TASK_PERFORMED', true);191 register_shutdown_function(array('pts_module_manager', 'module_process'), '__shutdown');192 }193 public static function environmental_variables()194 {195 // The PTS environmental variables passed during the testing process, etc196 static $env_variables = null;197 if($env_variables == null)198 {199 $env_variables = array(200 'PTS_VERSION' => PTS_VERSION,201 'PTS_CODENAME' => PTS_CODENAME,202 'PTS_DIR' => PTS_PATH,203 'PHP_BIN' => PHP_BIN,204 'NUM_CPU_CORES' => phodevi::read_property('cpu', 'core-count'),205 'NUM_CPU_NODES' => phodevi::read_property('cpu', 'node-count'),206 'NUM_CPU_JOBS' => (phodevi::read_property('cpu', 'core-count') * 2),207 'SYS_MEMORY' => phodevi::read_property('memory', 'capacity'),208 'VIDEO_MEMORY' => phodevi::read_property('gpu', 'memory-capacity'),209 'VIDEO_WIDTH' => pts_arrays::first_element(phodevi::read_property('gpu', 'screen-resolution')),210 'VIDEO_HEIGHT' => pts_arrays::last_element(phodevi::read_property('gpu', 'screen-resolution')),211 'VIDEO_MONITOR_COUNT' => phodevi::read_property('monitor', 'count'),212 'VIDEO_MONITOR_LAYOUT' => phodevi::read_property('monitor', 'layout'),213 'VIDEO_MONITOR_SIZES' => phodevi::read_property('monitor', 'modes'),214 'OPERATING_SYSTEM' => phodevi::read_property('system', 'vendor-identifier'),215 'OS_VERSION' => phodevi::read_property('system', 'os-version'),216 'OS_ARCH' => phodevi::read_property('system', 'kernel-architecture'),217 'OS_TYPE' => phodevi::operating_system(),218 'THIS_RUN_TIME' => PTS_INIT_TIME,219 'DEBUG_REAL_HOME' => pts_core::user_home_directory()220 );221 if(!pts_client::executable_in_path('cc') && pts_client::executable_in_path('gcc') && getenv('CC') == false)222 {223 // This helps some test profiles build correctly if they don't do a cc check internally224 $env_variables['CC'] = 'gcc';225 }226 }227 return $env_variables;228 }229 public static function test_install_root_path()230 {231 if(getenv('PTS_TEST_INSTALL_ROOT_PATH') != false && is_dir(getenv('PTS_TEST_INSTALL_ROOT_PATH')) && is_writable(getenv('PTS_TEST_INSTALL_ROOT_PATH')))232 {233 return getenv('PTS_TEST_INSTALL_ROOT_PATH');234 }235 else236 {237 if(!defined('PTS_TEST_INSTALL_DEFAULT_PATH'))238 pts_define('PTS_TEST_INSTALL_DEFAULT_PATH', pts_strings::parse_for_home_directory(pts_config::read_user_config('PhoronixTestSuite/Options/Installation/EnvironmentDirectory', '~/.phoronix-test-suite/installed-tests/')));239 return PTS_TEST_INSTALL_DEFAULT_PATH;240 }241 }242 public static function user_run_save_variables()243 {244 static $runtime_variables = null;245 if($runtime_variables == null)246 {247 $runtime_variables = array(248 'VIDEO_RESOLUTION' => phodevi::read_property('gpu', 'screen-resolution-string'),249 'VIDEO_CARD' => phodevi::read_name('gpu'),250 'VIDEO_DRIVER' => phodevi::read_property('system', 'display-driver-string'),251 'OPENGL_DRIVER' => str_replace('(', '', phodevi::read_property('system', 'opengl-driver')),252 'OPERATING_SYSTEM' => phodevi::read_property('system', 'operating-system'),253 'PROCESSOR' => phodevi::read_name('cpu'),254 'MOTHERBOARD' => phodevi::read_name('motherboard'),255 'CHIPSET' => phodevi::read_name('chipset'),256 'KERNEL_VERSION' => phodevi::read_property('system', 'kernel'),257 'COMPILER' => phodevi::read_property('system', 'compiler'),258 'HOSTNAME' => phodevi::read_property('system', 'hostname')259 );260 }261 return $runtime_variables;262 }263 public static function supports_colored_text_output()264 {265 return (function_exists('posix_isatty') && posix_isatty(STDOUT)) || (PTS_IS_CLIENT && getenv('LS_COLORS'));266 }267 public static function cli_colored_text($str, $color, $bold = false)268 {269 if(!self::supports_colored_text_output() || empty($color))270 {271 return $str;272 }273 $attribute = ($bold ? '1' : '0');274 $colors = array(275 'black' => $attribute . ';30',276 'gray' => '1;30', // gray not bold doesn't look good in all consoles277 'blue' => $attribute . ';34',278 'green' => $attribute . ';32',279 'red' => $attribute . ';31',280 'cyan' => $attribute . ';36',281 );282 if(!isset($colors[$color]))283 {284 return $str;285 }286 return "\033[" . $colors[$color] . 'm' . $str . "\033[0m";287 }288 public static function cli_just_bold($str)289 {290 if(!self::supports_colored_text_output())291 {292 return $str;293 }294 return "\033[1m$str\033[0m";295 }296 public static function save_test_result($save_to = null, $save_results = null, $render_graphs = true, $result_identifier = null)297 {298 // Saves PTS result file299 if(substr($save_to, -4) != '.xml')300 {301 $save_to .= '.xml';302 }303 $save_to = str_replace(PTS_SAVE_RESULTS_PATH, null, $save_to);304 $save_to_dir = pts_client::setup_test_result_directory($save_to);305 if($save_to == null || $save_results == null)306 {307 $bool = false;308 }309 else310 {311 $save_name = basename($save_to, '.xml');312 if($save_name == 'composite' && $render_graphs)313 {314 pts_client::generate_result_file_graphs($save_results, $save_to_dir);315 }316 $bool = file_put_contents(PTS_SAVE_RESULTS_PATH . $save_to, $save_results);317 if($result_identifier != null && pts_config::read_bool_config('PhoronixTestSuite/Options/Testing/SaveSystemLogs', 'TRUE'))318 {319 // Save verbose system information here320 $system_log_dir = $save_to_dir . '/system-logs/' . $result_identifier . '/';321 pts_file_io::mkdir($system_log_dir, 0777, true);322 // Backup system files323 // TODO: move out these files/commands to log out to respective Phodevi components so only what's relevant will be logged324 $system_log_files = array(325 '/var/log/Xorg.0.log',326 '/proc/cpuinfo',327 '/proc/meminfo',328 '/proc/modules',329 '/proc/mounts',330 '/proc/cmdline',331 '/proc/version',332 '/proc/mdstat',333 '/etc/X11/xorg.conf',334 '/sys/kernel/debug/dri/0/radeon_pm_info',335 '/sys/kernel/debug/dri/0/i915_capabilities',336 '/sys/kernel/debug/dri/0/i915_cur_delayinfo',337 '/sys/kernel/debug/dri/0/i915_drpc_info',338 '/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies',339 );340 /*341 if(phodevi::is_linux())342 {343 // the kernel config file might just be too large to upload for now344 $system_log_files[] = '/boot/config-' . php_uname('r');345 }346 */347 foreach($system_log_files as $file)348 {349 if(is_file($file) && is_readable($file) && filesize($file) < 1000000)350 {351 // copy() can't be used in this case since it will result in a blank file for /proc/ file-system352 $file_contents = file_get_contents($file);353 $file_contents = pts_strings::remove_line_timestamps($file_contents);354 file_put_contents($system_log_dir . basename($file), $file_contents);355 }356 }357 // Generate logs from system commands to backup358 $system_log_commands = array(359 'lspci -mmkvvvnn',360 'lscpu',361 'cc -v',362 // 'lsusb',363 'lsmod',364 'sensors',365 'dmesg',366 'vdpauinfo',367 'cpufreq-info',368 'glxinfo',369 'clinfo',370 'vulkaninfo',371 'uname -a',372 // 'udisks --dump',373 'upower --dump',374 );375 if(phodevi::is_bsd())376 {377 $system_log_commands[] = 'sysctl -a';378 $system_log_commands[] = 'kenv';379 }380 if(is_readable('/dev/mem'))381 {382 $system_log_commands[] = 'dmidecode';383 }384 foreach($system_log_commands as $command_string)385 {386 $command = explode(' ', $command_string);387 if(($command_bin = pts_client::executable_in_path($command[0])))388 {389 $cmd_output = shell_exec('cd ' . dirname($command_bin) . ' && ./' . $command_string . ' 2>&1');390 if(strlen($cmd_output) > 900000)391 {392 // Don't preserve really large logs, likely filled with lots of junk393 $cmd_output = null;394 continue;395 }396 // Try to filter out any serial numbers, etc.397 phodevi_vfs::cleanse_file($cmd_output, $command[0]);398 $cmd_output = pts_strings::remove_line_timestamps($cmd_output);399 file_put_contents($system_log_dir . $command[0], $cmd_output);400 }401 }402 // Dump some common / important environmental variables403 $environment_variables = array(404 'PATH' => null,405 'CFLAGS' => null,406 'CXXFLAGS' => null,407 'LD_LIBRARY_PATH' => null,408 'CC' => null,409 'CXX' => null,410 'LIBGL_DRIVERS_PATH' => null411 );412 foreach($environment_variables as $variable => &$value)413 {414 $v = getenv($variable);415 if($v != null)416 {417 $value = $v;418 }419 else420 {421 unset($environment_variables[$variable]);422 }423 }424 if(!empty($environment_variables))425 {426 $variable_dump = null;427 foreach($environment_variables as $variable => $value)428 {429 $variable_dump .= $variable . '=' . $value . PHP_EOL;430 }431 file_put_contents($system_log_dir . 'environment-variables', $variable_dump);432 }433 pts_module_manager::module_process('__post_test_run_system_logs', $system_log_dir);434 }435 }436 return $bool;437 }438 public static function init_display_mode($override_display_mode = false)439 {440 if(PTS_IS_WEB_CLIENT && !defined('PHOROMATIC_SERVER'))441 {442 self::$display = new pts_web_display_mode();443 return;444 }445 $env_mode = pts_client::is_debug_mode() ? 'BASIC' : $override_display_mode;446 switch(($env_mode != false || ($env_mode = pts_client::read_env('PTS_DISPLAY_MODE')) != false ? $env_mode : pts_config::read_user_config('PhoronixTestSuite/Options/General/DefaultDisplayMode', 'DEFAULT')))447 {448 case 'BASIC':449 self::$display = new pts_basic_display_mode();450 break;451 case 'BATCH':452 case 'CONCISE':453 self::$display = new pts_concise_display_mode();454 break;455 case 'SHORT':456 self::$display = new pts_short_display_mode();457 break;458 case 'DEFAULT':459 default:460 self::$display = new pts_concise_display_mode();461 break;462 }463 }464 public static function program_requirement_checks($only_show_required = false, $always_report = false)465 {466 $extension_checks = pts_needed_extensions();467 $printed_required_header = false;468 $printed_optional_header = false;469 foreach($extension_checks as $extension)470 {471 if($extension[1] == false || $always_report)472 {473 if($always_report)474 {475 $printed_required_header = true;476 $printed_optional_header = true;477 echo ($extension[1] == false ? 'MISSING' : 'PRESENT') . ' - ';478 }479 if($extension[0] == 1)480 {481 // Oops, this extension is required482 if($printed_required_header == false)483 {484 echo PHP_EOL . 'The following PHP extensions are REQUIRED:' . PHP_EOL . PHP_EOL;485 $printed_required_header = true;486 }487 }488 else489 {490 if(($only_show_required || PTS_IS_DAEMONIZED_SERVER_PROCESS) && $printed_required_header == false)491 {492 continue;493 }494 // This extension is missing but optional495 if($printed_optional_header == false)496 {497 echo PHP_EOL . ($printed_required_header ? null : 'NOTICE: ') . 'The following PHP extensions are OPTIONAL but recommended:' . PHP_EOL . PHP_EOL;498 $printed_optional_header = true;499 }500 }501 echo sprintf('%-9ls %-30ls' . PHP_EOL, $extension[2], $extension[3]);502 }503 }504 if($printed_required_header || $printed_optional_header)505 {506 echo PHP_EOL;507 if($printed_required_header && !$always_report)508 {509 exit;510 }511 }512 }513 private static function build_temp_cache()514 {515 $pso = pts_storage_object::recover_from_file(PTS_TEMP_STORAGE);516 if($pso == false)517 {518 $pso = new pts_storage_object();519 }520 $pso->add_object('environmental_variables_for_modules', pts_module_manager::modules_environmental_variables());521 $pso->add_object('command_alias_list', pts_documentation::client_commands_aliases());522 $pso->save_to_file(PTS_TEMP_STORAGE);523 }524 private static function core_storage_init_process()525 {526 $pso = pts_storage_object::recover_from_file(PTS_CORE_STORAGE);527 if($pso == false)528 {529 $pso = new pts_storage_object(true, true);530 }531 // OpenBenchmarking.org - GSID532 $global_gsid = $pso->read_object('global_system_id');533 $global_gsid_e = $pso->read_object('global_system_id_e');534 $global_gsid_p = $pso->read_object('global_system_id_p');535 if(empty($global_gsid) || pts_openbenchmarking::is_valid_gsid_format($global_gsid) == false)536 {537 // Global System ID for anonymous uploads, etc538 $requested_gsid = true;...

Full Screen

Full Screen

core_storage_init_process

Using AI Code Generation

copy

Full Screen

1$pts_client = new pts_client();2$pts_client->core_storage_init_process();3$pts_client = new pts_client();4$pts_client->core_storage_init_process();5$pts_client = new pts_client();6$pts_client->core_storage_init_process();7$pts_client = new pts_client();8$pts_client->core_storage_init_process();9$pts_client = new pts_client();10$pts_client->core_storage_init_process();11$pts_client = new pts_client();12$pts_client->core_storage_init_process();13$pts_client = new pts_client();14$pts_client->core_storage_init_process();15$pts_client = new pts_client();16$pts_client->core_storage_init_process();17$pts_client = new pts_client();18$pts_client->core_storage_init_process();19$pts_client = new pts_client();20$pts_client->core_storage_init_process();

Full Screen

Full Screen

core_storage_init_process

Using AI Code Generation

copy

Full Screen

1require_once 'pts_client.php';2$pts_client = new pts_client();3$pts_client->core_storage_init_process();4require_once 'pts_client.php';5$pts_client = new pts_client();6$pts_client->core_storage_init_process();7require_once 'pts_client.php';8$pts_client = new pts_client();9$pts_client->core_storage_init_process();10require_once 'pts_client.php';11$pts_client = new pts_client();12$pts_client->core_storage_init_process();13require_once 'pts_client.php';14$pts_client = new pts_client();15$pts_client->core_storage_init_process();16require_once 'pts_client.php';17$pts_client = new pts_client();18$pts_client->core_storage_init_process();19require_once 'pts_client.php';20$pts_client = new pts_client();21$pts_client->core_storage_init_process();22require_once 'pts_client.php';23$pts_client = new pts_client();24$pts_client->core_storage_init_process();25require_once 'pts_client.php';26$pts_client = new pts_client();27$pts_client->core_storage_init_process();

Full Screen

Full Screen

core_storage_init_process

Using AI Code Generation

copy

Full Screen

1$pts_client = new pts_client();2$pts_client->core_storage_init_process();3$pts_client = new pts_client();4$pts_client->core_storage_init_process();5$pts_client = new pts_client();6$pts_client->core_storage_init_process();7$pts_client = new pts_client();8$pts_client->core_storage_init_process();9$pts_client = new pts_client();10$pts_client->core_storage_init_process();11$pts_client = new pts_client();12$pts_client->core_storage_init_process();13$pts_client = new pts_client();14$pts_client->core_storage_init_process();15$pts_client = new pts_client();16$pts_client->core_storage_init_process();17$pts_client = new pts_client();18$pts_client->core_storage_init_process();19$pts_client = new pts_client();20$pts_client->core_storage_init_process();21$pts_client = new pts_client();22$pts_client->core_storage_init_process();

Full Screen

Full Screen

core_storage_init_process

Using AI Code Generation

copy

Full Screen

1$pts_client->core_storage_init_process();2$pts_client->core_storage_save_data("test","test");3$pts_client->core_storage_get_data("test");4$pts_client->core_storage_delete_data("test");5$pts_client->core_storage_delete_all_data();6$pts_client->core_storage_get_all_data();7$pts_client->core_storage_destroy_process();8$pts_client->core_storage_init_process();9$pts_client->core_storage_save_data("test","test");10$pts_client->core_storage_get_data("test");11$pts_client->core_storage_delete_data("test");12$pts_client->core_storage_delete_all_data();13$pts_client->core_storage_get_all_data();14$pts_client->core_storage_destroy_process();15$pts_client->core_storage_init_process();16$pts_client->core_storage_save_data("test","test");

Full Screen

Full Screen

core_storage_init_process

Using AI Code Generation

copy

Full Screen

1$storage = $client->core_storage_init_process($storage_name, $storage_type, $storage_config);2$file_names = $storage->core_storage_get();3$file_content = $storage->core_storage_get_file($file_name);4$delete_status = $storage->core_storage_delete_file($file_name);5$delete_status = $storage->core_storage_delete();6$set_status = $storage->core_storage_set_file($file_name, $file_content);7$set_status = $storage->core_storage_set($file_names);8$set_status = $storage->core_storage_set_file($file_name, $file_content);9$set_status = $storage->core_storage_set($file_names);10$file_content = $storage->core_storage_get_file($file_name);11$file_content = $storage->core_storage_get_file($file_name);

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Phoronix-test-suite automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Trigger core_storage_init_process code on LambdaTest Cloud Grid

Execute automation tests with core_storage_init_process on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful