How to use init_display_mode method of pts_client class

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

pts_client.php

Source:pts_client.php Github

copy

Full Screen

...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':...

Full Screen

Full Screen

init_display_mode

Using AI Code Generation

copy

Full Screen

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

Full Screen

Full Screen

init_display_mode

Using AI Code Generation

copy

Full Screen

1require_once 'pts_client.php';2$pts_client = new pts_client();3$pts_client->init_display_mode("HTML");4function display_output($output)5{6global $pts_client;7$pts_client->display_output($output);8}9display_output("Hello World!");10Next Topic PHP - pts_client::init_display_mode() Method

Full Screen

Full Screen

init_display_mode

Using AI Code Generation

copy

Full Screen

1include_once("init.php");2$init = new init_display_mode();3$init->init_display_mode();4{5 public function init_display_mode()6 {7 $this->init_display_mode();8 }9 public function init_display_mode()10 {11 $client = new pts_client();12 $client->init_display_mode();13 }14}15Your name to display (optional):16Your name to display (optional):17include_once("init.php");18$init = new init_display_mode();19$init->init_display_mode();20{21 public function init_display_mode()22 {23 $client = new pts_client();24 $client->init_display_mode();25 }26}27Your name to display (optional):

Full Screen

Full Screen

init_display_mode

Using AI Code Generation

copy

Full Screen

1require_once 'pts_client.php';2$pts_client = new pts_client();3$pts_client->init_display_mode();4$pts_client->run('testname');5$pts_client->display_result();6{7 function init()8 {9 $this->testname = '';10 $this->result = '';11 }12 function init_display_mode()13 {14 echo "testname: ".$this->testname;15 }16 function run($testname)17 {18 $this->testname = $testname;19 $this->result = shell_exec($this->testname);20 }21 function display_result()22 {23 echo $this->result;24 }25}26require_once 'pts_client.php';27$pts_client = new pts_client();28$pts_client->init_display_mode();29$pts_client->run('testname');30$pts_client->display_result();31require_once 'pts_client.php';32$pts_client = new pts_client();33$pts_client->init_display_mode();

Full Screen

Full Screen

init_display_mode

Using AI Code Generation

copy

Full Screen

1require "pts_client.php";2$pts_client = new pts_client();3$pts_client->init_display_mode("normal");4$pts_client->display("hello world");5$pts_client->display("hello world6");7$pts_client->display("hello world",false);8$pts_client->display("hello world9");10$pts_client->display("hello world11");12$pts_client->display("hello world",false);13$pts_client->display("hello world14");15$pts_client->display("hello world16");17$pts_client->display("hello world18");19$pts_client->display("hello world",false);20$pts_client->display("hello world21");22$pts_client->display("hello world",false);23$pts_client->display("hello world24");25$pts_client->display("hello world26");27$pts_client->display("hello world",false);28$pts_client->display("hello world29");30$pts_client->display("hello world",false);31$pts_client->display("hello world32");33$pts_client->display("hello world34");35$pts_client->display("hello world",false);36$pts_client->display("hello world37");38$pts_client->display("hello world",false);39$pts_client->display("hello world40");41$pts_client->display("hello world",false);

Full Screen

Full Screen

init_display_mode

Using AI Code Generation

copy

Full Screen

1require_once 'pts_client.php';2$pts_client = new pts_client();3$pts_client->init_display_mode("browser");4$pts_client->display_output("Hello World");5require_once 'pts_client.php';6$pts_client = new pts_client();7$pts_client->init_display_mode("terminal");8$pts_client->display_output("Hello World");9require_once 'pts_client.php';10$pts_client = new pts_client();11$pts_client->init_display_mode("terminal");12$pts_client->display_output("Hello World");13require_once 'pts_client.php';14$pts_client = new pts_client();15$pts_client->display_output("Hello World");16require_once 'pts_client.php';17$pts_client = new pts_client();18$pts_client->display_output("Hello World");19require_once 'pts_client.php';20$pts_client = new pts_client();

Full Screen

Full Screen

init_display_mode

Using AI Code Generation

copy

Full Screen

1$pts_client->init_display_mode("TEXT");2$pts_client->set_display_mode("TEXT");3$pts_client->init_display_mode("TEXT");4$pts_client->set_display_mode("TEXT");5$pts_client->init_display_mode("TEXT");6$pts_client->set_display_mode("TEXT");7$pts_client->init_display_mode("TEXT");8$pts_client->set_display_mode("TEXT");9$pts_client->init_display_mode("TEXT");10$pts_client->set_display_mode("TEXT");11$pts_client->init_display_mode("TEXT");12$pts_client->set_display_mode("TEXT");13$pts_client->init_display_mode("TEXT");14$pts_client->set_display_mode("TEXT");

Full Screen

Full Screen

init_display_mode

Using AI Code Generation

copy

Full Screen

1require_once 'pts_client.php';2$pts_client = new pts_client();3$pts_client->init_display_mode();4require_once 'pts_client.php';5$pts_client = new pts_client();6$display_mode = $pts_client->get_display_mode();7echo $display_mode;8require_once 'pts_client.php';9$pts_client = new pts_client();10$display_mode = $pts_client->get_display_mode();11echo $display_mode;12require_once 'pts_client.php';13$pts_client = new pts_client();14$display_mode = $pts_client->get_display_mode();15echo $display_mode;

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 init_display_mode code on LambdaTest Cloud Grid

Execute automation tests with init_display_mode 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