How to use sw_environment_variables method of phodevi_system class

Best Phoronix-test-suite code snippet using phodevi_system.sw_environment_variables

phodevi_system.php

Source:phodevi_system.php Github

copy

Full Screen

...100 case 'system-layer':101 $property = new phodevi_device_property('sw_system_layer', phodevi::std_caching);102 break;103 case 'environment-variables':104 $property = new phodevi_device_property('sw_environment_variables', phodevi::std_caching);105 break;106 }107 return $property;108 }109 public static function sw_username()110 {111 // Gets the system user's name112 if(function_exists('posix_getpwuid') && function_exists('posix_getuid'))113 {114 $userinfo = posix_getpwuid(posix_getuid());115 $username = $userinfo['name'];116 }117 else118 {119 $username = trim(getenv('USERNAME'));120 }121 return $username;122 }123 public static function sw_system_layer()124 {125 $layer = null;126 if(phodevi::is_windows() && pts_client::executable_in_path('winecfg.exe') && ($wine = phodevi::read_property('system', 'wine-version')))127 {128 $layer = $wine;129 }130 else131 {132 // Report virtualization133 $layer = phodevi::read_property('system', 'virtualized-mode');134 }135 return $layer;136 }137 public static function sw_hostname()138 {139 $hostname = 'Unknown';140 if(($bin = pts_client::executable_in_path('hostname')))141 {142 $hostname = trim(shell_exec($bin . ' 2>&1'));143 }144 else if(phodevi::is_windows())145 {146 $hostname = getenv('USERDOMAIN');147 }148 return $hostname;149 }150 public static function sw_vendor_identifier()151 {152 // Returns the vendor identifier used with the External Dependencies and other distro-specific features153 $vendor = phodevi::is_linux() ? phodevi_linux_parser::read_lsb_distributor_id() : false;154 if(!$vendor)155 {156 $vendor = phodevi::read_property('system', 'operating-system');157 if(($spos = strpos($vendor, ' ')) > 1)158 {159 $vendor = substr($vendor, 0, $spos);160 }161 }162 return str_replace(array(' ', '/'), '', strtolower($vendor));163 }164 public static function sw_filesystem()165 {166 // Determine file-system type167 $fs = null;168 if(phodevi::is_macosx())169 {170 $fs = phodevi_osx_parser::read_osx_system_profiler('SPSerialATADataType', 'FileSystem');171 if($fs == null && pts_client::executable_in_path('mount'))172 {173 $mount = shell_exec('mount 2>&1');174 if(stripos($mount, ' on / (hfs, local, journaled)') !== false)175 {176 $fs = 'Journaled HFS+';177 }178 else if(stripos($mount, ' on / (hfs') !== false)179 {180 $fs = 'HFS+';181 }182 }183 }184 else if(phodevi::is_bsd())185 {186 if(pts_client::executable_in_path('mount'))187 {188 $mount = shell_exec('mount 2>&1');189 if(($start = strpos($mount, 'on / (')) != false)190 {191 // FreeBSD, DragonflyBSD mount formatting192 /*193 -bash-4.0$ mount194 ROOT on / (hammer, local)195 /dev/da0s1a on /boot (ufs, local)196 /pfs/@@-1:00001 on /var (null, local)197 /pfs/@@-1:00002 on /tmp (null, local)198 /pfs/@@-1:00003 on /usr (null, local)199 /pfs/@@-1:00004 on /home (null, local)200 /pfs/@@-1:00005 on /usr/obj (null, local)201 /pfs/@@-1:00006 on /var/crash (null, local)202 /pfs/@@-1:00007 on /var/tmp (null, local)203 procfs on /proc (procfs, local)204 */205 // TODO: improve this in case there are other partitions, etc206 $fs = substr($mount, $start + 6);207 $fs = substr($fs, 0, strpos($fs, ','));208 }209 else if(($start = strpos($mount, 'on / type')) != false)210 {211 // OpenBSD 5.0 formatting is slightly different from above FreeBSD example212 // TODO: improve this in case there are other partitions, etc213 $fs = substr($mount, $start + 10);214 $fs = substr($fs, 0, strpos($fs, ' '));215 }216 }217 }218 else if(phodevi::is_hurd())219 {220 // Very rudimentary Hurd filesystem detection support but works for at least a clean Debian GNU/Hurd EXT2 install221 if(pts_client::executable_in_path('mount'))222 {223 $mount = shell_exec('mount 2>&1');224 if(($start = strpos($mount, 'on / type')) != false)225 {226 $fs = substr($mount, $start + 10);227 $fs = substr($fs, 0, strpos($fs, ' '));228 if(substr($fs, -2) == 'fs')229 {230 $fs = substr($fs, 0, -2);231 }232 }233 }234 }235 else if(phodevi::is_linux() || phodevi::is_solaris())236 {237 $fs = trim(shell_exec('stat ' . pts_client::test_install_root_path() . ' -L -f -c %T 2> /dev/null'));238 switch($fs)239 {240 case 'ext2/ext3':241 if(isset(phodevi::$vfs->mounts))242 {243 $fstab = phodevi::$vfs->mounts;244 $fstab = str_replace('/boot ', 'IGNORE', $fstab);245 $using_ext2 = strpos($fstab, ' ext2') !== false;246 $using_ext3 = strpos($fstab, ' ext3') !== false;247 $using_ext4 = strpos($fstab, ' ext4') !== false;248 if(!$using_ext2 && !$using_ext3 && $using_ext4)249 {250 $fs = 'ext4';251 }252 else if(!$using_ext2 && !$using_ext4 && $using_ext3)253 {254 $fs = 'ext3';255 }256 else if(!$using_ext3 && !$using_ext4 && $using_ext2)257 {258 $fs = 'ext2';259 }260 else if(is_dir('/proc/fs/ext4/'))261 {262 $fs = 'ext4';263 }264 else if(is_dir('/proc/fs/ext3/'))265 {266 $fs = 'ext3';267 }268 }269 break;270 case 'Case-sensitive Journaled HFS+':271 $fs = 'HFS+';272 break;273 case 'MS-DOS FAT32':274 $fs = 'FAT32';275 break;276 case 'UFSD_NTFS_COMPR':277 $fs = 'NTFS';278 break;279 case 'ecryptfs':280 if(isset(phodevi::$vfs->mounts))281 {282 // An easy attempt to determine what file-system is underneath ecryptfs if being compared283 // For now just attempt to figure out the root file-system.284 if(($s = strrpos(phodevi::$vfs->mounts, ' / ')) !== false)285 {286 $s = substr(phodevi::$vfs->mounts, ($s + 3));287 $s = substr($s, 0, strpos($s, ' '));288 if($s != null && !isset($s[18]) && $s != 'rootfs'&& pts_strings::string_only_contains($s, pts_strings::CHAR_LETTER | pts_strings::CHAR_NUMERIC))289 {290 $fs = $s . ' (ecryptfs)';291 }292 }293 }294 break;295 default:296 if(substr($fs, 0, 9) == 'UNKNOWN (')297 {298 $magic_block = substr($fs, 9, -1);299 $known_magic_blocks = array(300 '0x9123683e' => 'Btrfs',301 '0x2fc12fc1' => 'zfs', // KQ Infotech ZFS302 '0x482b' => 'HFS+',303 '0x65735546' => 'FUSE',304 '0x565a4653' => 'ReiserFS',305 '0x52345362' => 'Reiser4',306 '0x3434' => 'NILFS2',307 '0x5346414f' => 'OpenAFS',308 '0x47504653' => 'GPFS',309 '0x5941ff53' => 'YAFFS',310 '0xff534d42' => 'CIFS',311 '0x24051905' => 'UBIFS',312 '0x1021994' => 'TMPFS',313 '0x73717368' => 'SquashFS',314 '0xc97e8168' => 'LogFS',315 '0x5346544E' => 'NTFS',316 '0xf15f' => 'eCryptfs',317 '0x61756673' => 'AuFS',318 '0xbd00bd0' => 'Lustre',319 '0xaad7aaea' => 'PanFS', // Panasas FS320 '0xf2f52010' => 'F2FS',321 '0xc36400' => 'CephFS',322 '0xca451a4e' => 'BcacheFS'323 );324 foreach($known_magic_blocks as $hex => $name)325 {326 if($magic_block == $hex)327 {328 $fs = $name;329 break;330 }331 }332 }333 break;334 }335 if(strpos($fs, 'UNKNOWN') !== false && isset(phodevi::$vfs->mounts))336 {337 $mounts = phodevi::$vfs->mounts;338 $fs_r = array();339 $fs_checks = array(340 'squashfs' => 'SquashFS',341 'aufs' => 'AuFS',342 'unionfs' => 'UnionFS'343 );344 foreach($fs_checks as $fs_module => $fs_name)345 {346 if(strpos($mounts, $fs_module) != false)347 {348 array_push($fs_r, $fs_name);349 }350 }351 if(count($fs_r) > 0)352 {353 $fs = implode(' + ', $fs_r);354 }355 }356 }357 else if(phodevi::is_windows())358 {359 return null;360 }361 if(empty($fs))362 {363 $fs = 'Unknown';364 }365 return $fs;366 }367 public static function sw_virtualized_mode()368 {369 // Reports if system is running virtualized370 $virtualized = null;371 $mobo = phodevi::read_name('motherboard');372 $gpu = phodevi::read_name('gpu');373 $cpu = phodevi::read_property('cpu', 'model');374 if(strpos($cpu, 'QEMU') !== false || (is_readable('/sys/class/dmi/id/bios_vendor') && pts_file_io::file_get_contents('/sys/class/dmi/id/bios_vendor') == 'QEMU'))375 {376 $virtualized = 'QEMU';377 if(strpos($cpu, 'QEMU Virtual') !== false)378 {379 $qemu_version = substr($cpu, (strrpos($cpu, ' ') + 1));380 if(pts_strings::is_version($qemu_version))381 {382 $virtualized .= ' ' . $qemu_version;383 }384 }385 }386 else if(stripos($gpu, 'VMware') !== false || (is_readable('/sys/class/dmi/id/product_name') && stripos(pts_file_io::file_get_contents('/sys/class/dmi/id/product_name'), 'VMware') !== false))387 {388 $virtualized = 'VMware';389 }390 else if(stripos($gpu, 'VirtualBox') !== false || stripos(phodevi::read_name('motherboard'), 'VirtualBox') !== false)391 {392 $virtualized = 'VirtualBox';393 if($vbox_manage = pts_client::executable_in_path('VBoxManage'))394 {395 $vbox_manage = trim(shell_exec($vbox_manage . ' --version 2> /dev/null'));396 if(is_numeric(substr($vbox_manage, 0, 1)))397 {398 $virtualized .= ' ' . $vbox_manage;399 }400 }401 else if($modinfo = pts_client::executable_in_path('modinfo'))402 {403 $modinfo = trim(shell_exec('modinfo -F version vboxguest 2> /dev/null'));404 if($modinfo != null && pts_strings::is_version(str_ireplace(array('_', 'RC', 'beta'), null, $modinfo)))405 {406 $virtualized .= ' ' . $modinfo;407 }408 }409 }410 else if(is_file('/sys/class/dmi/id/sys_vendor') && pts_file_io::file_get_contents('/sys/class/dmi/id/sys_vendor') == 'Xen')411 {412 $virtualized = pts_file_io::file_get_contents('/sys/class/dmi/id/product_name');413 if(strpos($virtualized, 'Xen') === false)414 {415 $virtualized = 'Xen ' . $virtualized;416 }417 // version string418 $virtualized .= ' ' . pts_file_io::file_get_contents('/sys/class/dmi/id/product_version');419 // $virtualized should be then e.g. 'Xen HVM domU 4.1.1'420 }421 else if(stripos($gpu, 'Microsoft Hyper-V') !== false)422 {423 $virtualized = 'Microsoft Hyper-V Server';424 }425 else if(stripos($mobo, 'Parallels Software') !== false)426 {427 $virtualized = 'Parallels Virtualization';428 }429 else if(is_file('/sys/hypervisor/type'))430 {431 $type = pts_file_io::file_get_contents('/sys/hypervisor/type');432 $version = array();433 foreach(array('major', 'minor', 'extra') as $v)434 {435 if(is_file('/sys/hypervisor/version/' . $v))436 {437 $v = pts_file_io::file_get_contents('/sys/hypervisor/version/' . $v);438 }439 else440 {441 continue;442 }443 if($v != null)444 {445 if(!empty($version) && substr($v, 0, 1) != '.')446 {447 $v = '.' . $v;448 }449 array_push($version, $v);450 }451 }452 $virtualized = ucwords($type) . ' ' . implode('', $version) . ' Hypervisor';453 }454 if($systemd_virt = pts_client::executable_in_path('systemd-detect-virt'))455 {456 $systemd_virt = trim(shell_exec($systemd_virt . ' 2> /dev/null'));457 if($systemd_virt != null && $systemd_virt != 'none')458 {459 switch($systemd_virt)460 {461 case 'kvm':462 $systemd_virt = 'KVM';463 break;464 case 'oracle':465 $systemd_virt = 'Oracle';466 break;467 }468 if($virtualized != null && stripos($virtualized, $systemd_virt) === false && stripos($systemd_virt, $virtualized) === false)469 {470 $virtualized = $systemd_virt . ' ' . $virtualized;471 }472 else if($virtualized == null)473 {474 $virtualized = $systemd_virt;475 }476 }477 }478 return $virtualized;479 }480 public static function sw_environment_variables()481 {482 $check_variables = array('LIBGL', '__GL', 'DRI_');483 $to_report = array();484 if(stripos(phodevi::read_property('system', 'opengl-driver'), 'Mesa'))485 {486 array_push($check_variables, 'MESA', 'GALLIUM');487 }488 if(isset($_SERVER))489 {490 foreach($_SERVER as $name => &$value)491 {492 foreach($check_variables as $var)493 {494 if(stripos($name, $var) !== false && $name != '__GL_SYNC_TO_VBLANK')...

Full Screen

Full Screen

sw_environment_variables

Using AI Code Generation

copy

Full Screen

1$sw = new phodevi_system();2$sw->init();3$sw->load_module('sw_environment_variables');4$sw->load_module('sw_os');5$sw->load_module('sw_cpu');6$sw->load_module('sw_gpu');7$sw->load_module('sw_motherboard');8$sw->load_module('sw_ram');9$sw->load_module('sw_disk');10$sw->load_module('sw_network');11$sw->load_module('sw_monitor');12$sw->load_module('sw_sound');13$sw->load_module('sw_input');14$sw->load_module('sw_graphics');15$sw->load_module('sw_printer');16$sw->load_module('sw_usb');17$sw->load_module('sw_firewire');18$sw->load_module('sw_bluetooth');19$sw->load_module('sw_battery');20$sw->load_module('sw_power');21$sw->load_module('sw_hardware');22$sw->load_module('sw_software');23$sw->load_module('sw_users');24$sw->load_module('sw_groups');25$sw->load_module('sw_services');26$sw->load_module('sw_network');27$sw->load_module('sw_network_interfaces');28$sw->load_module('sw_network_connections');29$sw->load_module('sw_network_shares');30$sw->load_module('sw_network_stats');31$sw->load_module('sw_network_gateway');32$sw->load_module('sw_network_dns');33$sw->load_module('sw_network_route');34$sw->load_module('sw_network_firewall');35$sw->load_module('sw_network_firewall_rules');36$sw->load_module('sw_network_firewall_rules_v6');37$sw->load_module('sw_network_firewall_zones');38$sw->load_module('sw_network_firewall_zones_v6');39$sw->load_module('sw_network_firewall_ports');

Full Screen

Full Screen

sw_environment_variables

Using AI Code Generation

copy

Full Screen

1$sw = new phodevi_system();2$sw->sw_environment_variables();3echo $sw->sw_environment_variables('DISPLAY');4$sw = new phodevi_system();5$sw->sw_environment_variables();6echo $sw->sw_environment_variables('XAUTHORITY');7$sw = new phodevi_system();8$sw->sw_environment_variables();9echo $sw->sw_environment_variables('XDG_SESSION_COOKIE');10$sw = new phodevi_system();11$sw->sw_environment_variables();12echo $sw->sw_environment_variables('XDG_SESSION_ID');13$sw = new phodevi_system();14$sw->sw_environment_variables();15echo $sw->sw_environment_variables('XDG_VTNR');16$sw = new phodevi_system();17$sw->sw_environment_variables();18echo $sw->sw_environment_variables('XDG_SESSION_CLASS');19$sw = new phodevi_system();20$sw->sw_environment_variables();21echo $sw->sw_environment_variables('XDG_SESSION_TYPE');22$sw = new phodevi_system();23$sw->sw_environment_variables();24echo $sw->sw_environment_variables('XDG_SEAT');25$sw = new phodevi_system();26$sw->sw_environment_variables();27echo $sw->sw_environment_variables('XDG_RUNTIME_DIR');

Full Screen

Full Screen

sw_environment_variables

Using AI Code Generation

copy

Full Screen

1require_once 'phodevi/system.php';2$os = phodevi_system::sw_environment_variables('OS');3echo $os;4require_once 'phodevi/system.php';5$os = phodevi_system::sw_environment_variables('OS');6echo $os;7require_once 'phodevi/system.php';8$os = phodevi_system::sw_environment_variables('OS');9echo $os;10require_once 'phodevi/system.php';11$os = phodevi_system::sw_environment_variables('OS');12echo $os;13require_once 'phodevi/system.php';14$os = phodevi_system::sw_environment_variables('OS');15echo $os;16require_once 'phodevi/system.php';17$os = phodevi_system::sw_environment_variables('OS');18echo $os;19require_once 'phodevi/system.php';20$os = phodevi_system::sw_environment_variables('OS');21echo $os;22require_once 'phodevi/system.php';23$os = phodevi_system::sw_environment_variables('OS');24echo $os;

Full Screen

Full Screen

sw_environment_variables

Using AI Code Generation

copy

Full Screen

1require_once('phodevi_system.php');2$sys = new phodevi_system();3$sys->init();4$sys->init_sw_environment_variables();5$sys->init_environment_variables();6require_once('phodevi.php');7$sys = new phodevi();8$sys->init();9$sys->init_sw_environment_variables();10$sys->init_environment_variables();11require_once('phodevi.php');12$sys = new phodevi();13$sys->init();14$sys->init_sw_environment_variables();15$sys->init_environment_variables();16require_once('phodevi.php');17$sys = new phodevi();18$sys->init();19$sys->init_sw_environment_variables();20$sys->init_environment_variables();21require_once('phodevi.php');22$sys = new phodevi();23$sys->init();24$sys->init_sw_environment_variables();25$sys->init_environment_variables();26require_once('phodevi.php');27$sys = new phodevi();28$sys->init();29$sys->init_sw_environment_variables();30$sys->init_environment_variables();31require_once('phodevi.php');32$sys = new phodevi();33$sys->init();34$sys->init_sw_environment_variables();35$sys->init_environment_variables();36require_once('phodevi.php');37$sys = new phodevi();38$sys->init();39$sys->init_sw_environment_variables();40$sys->init_environment_variables();41require_once('phodevi.php');42$sys = new phodevi();43$sys->init();44$sys->init_sw_environment_variables();45$sys->init_environment_variables();

Full Screen

Full Screen

sw_environment_variables

Using AI Code Generation

copy

Full Screen

1include_once("phodevi.php");2$sysinfo = phodevi::read_property('system', 'sw_environment_variables');3echo $sysinfo;4include_once("phodevi.php");5$sysinfo = phodevi::read_property('system', 'sw_environment_variables');6echo $sysinfo;7include_once("phodevi.php");8$sysinfo = phodevi::read_property('system', 'sw_environment_variables');9echo $sysinfo;10include_once("phodevi.php");11$sysinfo = phodevi::read_property('system', 'sw_environment_variables');12echo $sysinfo;13include_once("phodevi.php");14$sysinfo = phodevi::read_property('system', 'sw_environment_variables');15echo $sysinfo;16include_once("phodevi.php");17$sysinfo = phodevi::read_property('system', 'sw_environment_variables');18echo $sysinfo;19include_once("phodevi.php");

Full Screen

Full Screen

sw_environment_variables

Using AI Code Generation

copy

Full Screen

1require_once 'phodevi/system.php';2$env = new phodevi_system();3$env->sw_environment_variables();4$path = $env->get_environment_variable('PATH');5echo $path;6require_once 'phodevi/system.php';7$env = new phodevi_system();8$env->sw_environment_variables();9$path = $env->get_environment_variable('PATH');10echo $path;11require_once 'phodevi/system.php';12$env = new phodevi_system();13$env->sw_environment_variables();14$path = $env->get_environment_variable('PATH');15echo $path;16require_once 'phodevi/system.php';17$env = new phodevi_system();18$env->sw_environment_variables();19$path = $env->get_environment_variable('PATH');20echo $path;21require_once 'phodevi/system.php';22$env = new phodevi_system();23$env->sw_environment_variables();24$path = $env->get_environment_variable('PATH');25echo $path;26require_once 'phodevi/system.php';27$env = new phodevi_system();28$env->sw_environment_variables();29$path = $env->get_environment_variable('PATH');30echo $path;31require_once 'phodevi/system.php';32$env = new phodevi_system();33$env->sw_environment_variables();34$path = $env->get_environment_variable('PATH');35echo $path;

Full Screen

Full Screen

sw_environment_variables

Using AI Code Generation

copy

Full Screen

1require_once('phodevi_system.php');2$phodevi = new phodevi_system();3$env = $phodevi->sw_environment_variables();4echo "Environment Variables:";5";6foreach($env as $name => $value)7{8echo $name." = ".$value;9";10}

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

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