How to use pts_client class

Best Phoronix-test-suite code snippet using pts_client

pts_network.php

Source:pts_network.php Github

copy

Full Screen

...109 //echo '\nPHP CURL must either be installed or you must adjust your PHP settings file to support opening FTP/HTTP streams.\n';110 //return false;111 if($return_state == true)112 {113 pts_client::$display->test_install_progress_completed();114 }115 }116 public static function curl_download($download, $download_to, $download_port_number = false)117 {118 if(!function_exists('curl_init'))119 {120 return false;121 }122 // XXX: with curl_multi_init we could do multiple downloads at once...123 $cr = curl_init();124 $fh = fopen($download_to, 'w');125 curl_setopt($cr, CURLOPT_FILE, $fh);126 curl_setopt($cr, CURLOPT_URL, $download);127 curl_setopt($cr, CURLOPT_HEADER, false);128 curl_setopt($cr, CURLOPT_FOLLOWLOCATION, true);129 curl_setopt($cr, CURLOPT_CONNECTTIMEOUT, self::$network_timeout);130 curl_setopt($cr, CURLOPT_BUFFERSIZE, 64000);131 curl_setopt($cr, CURLOPT_USERAGENT, pts_core::codename(true));132 curl_setopt($cr, CURLOPT_CAPATH, PTS_CORE_STATIC_PATH . 'certificates/');133 curl_setopt($cr, CURLOPT_SSL_VERIFYPEER, false);134 if($download_port_number)135 {136 curl_setopt($cr, CURLOPT_PORT, $port);137 }138 if(stripos($download, 'sourceforge') === false)139 {140 // Setting the referer causes problems for SourceForge downloads141 curl_setopt($cr, CURLOPT_REFERER, 'http://www.phoronix-test-suite.com/');142 }143 if(strpos($download, 'https://openbenchmarking.org/') !== false)144 {145 curl_setopt($cr, CURLOPT_SSL_VERIFYHOST, 2);146 curl_setopt($cr, CURLOPT_CAINFO, PTS_CORE_STATIC_PATH . 'certificates/openbenchmarking-server.pem');147 }148 else if(strpos($download, 'https://www.phoromatic.com/') !== false)149 {150 curl_setopt($cr, CURLOPT_SSL_VERIFYHOST, 2);151 curl_setopt($cr, CURLOPT_CAINFO, PTS_CORE_STATIC_PATH . 'certificates/phoromatic-com.pem');152 }153 if(defined('CURLOPT_PROGRESSFUNCTION'))154 {155 // CURLOPT_PROGRESSFUNCTION only seems to work with PHP 5.3+, but is not working with HipHop HHVM ~2.0.1156 curl_setopt($cr, CURLOPT_NOPROGRESS, false);157 curl_setopt($cr, CURLOPT_PROGRESSFUNCTION, array('pts_network', 'curl_status_callback'));158 }159 if(self::$network_proxy)160 {161 curl_setopt($cr, CURLOPT_PROXY, self::$network_proxy['proxy']);162 if(!empty(self::$network_proxy['user']))163 {164 curl_setopt($cr, CURLOPT_USERPWD, self::$network_proxy['user'] . ':' . self::$network_proxy['password']);165 }166 }167 curl_exec($cr);168 curl_close($cr);169 fclose($fh);170 return true;171 }172 public static function stream_download($download, $download_to, $stream_context_parameters = null, $callback_function = array('pts_network', 'stream_status_callback'))173 {174 $stream_context = pts_network::stream_context_create($stream_context_parameters);175 if(function_exists('stream_context_set_params'))176 {177 // HHVM 2.1 doesn't have stream_context_set_params()178 stream_context_set_params($stream_context, array('notification' => $callback_function));179 }180 /*181 if(strpos($download, 'https://openbenchmarking.org/') !== false)182 {183 stream_context_set_option($stream_context, 'ssl', 'local_cert', PTS_CORE_STATIC_PATH . 'certificates/openbenchmarking-server.pem');184 }185 else if(strpos($download, 'https://www.phoromatic.com/') !== false)186 {187 stream_context_set_option($stream_context, 'ssl', 'local_cert', PTS_CORE_STATIC_PATH . 'certificates/phoromatic-com.pem');188 }189 */190 $file_pointer = @fopen($download, 'r', false, $stream_context);191 if(is_resource($file_pointer) && file_put_contents($download_to, $file_pointer))192 {193 return true;194 }195 return false;196 }197 public static function stream_context_create($parameters = null, $proxy_address = false, $proxy_port = false, $proxy_user = false, $proxy_password = false, $http_timeout = -1)198 {199 if(!is_array($parameters))200 {201 $parameters = array();202 }203 $parameters['ssl']['verify_peer'] = false;204 $parameters['ssl']['verify_peer_name'] = false;205 if($proxy_address == false && $proxy_port == false && self::$network_proxy)206 {207 $proxy_address = self::$network_proxy['address'];208 $proxy_port = self::$network_proxy['port'];209 $proxy_user = self::$network_proxy['user'];210 $proxy_password = self::$network_proxy['password'];211 }212 if($proxy_address != false && $proxy_port != false && is_numeric($proxy_port) && $proxy_port > 1)213 {214 $parameters['http']['proxy'] = 'tcp://' . $proxy_address . ':' . $proxy_port;215 $parameters['http']['request_fulluri'] = true;216 }217 if(is_numeric($http_timeout) && $http_timeout > 1)218 {219 $parameters['http']['timeout'] = $http_timeout;220 }221 else222 {223 $parameters['http']['timeout'] = self::$network_timeout;224 }225 $parameters['http']['user_agent'] = pts_core::codename(true);226 if($proxy_user != false && !empty($proxy_user))227 {228 $password = pts_strings::hex_to_str($proxy_password);229 $parameters['http']['header'] = 'Proxy-Authorization: Basic ' . base64_encode($proxy_user . ':' . $password);230 }231 else232 {233 $parameters['http']['header'] = "Content-Type: application/x-www-form-urlencoded\r\n";234 }235 $stream_context = stream_context_create($parameters);236 return $stream_context;237 }238 //239 // Callback Functions240 //241 public static function stream_status_callback($notification_code, $arg1, $message, $message_code, $downloaded, $download_size)242 {243 static $filesize = 0;244 static $last_float = -1;245 switch($notification_code)246 {247 case STREAM_NOTIFY_FILE_SIZE_IS:248 $filesize = $download_size;249 break;250 case STREAM_NOTIFY_PROGRESS:251 $downloaded_float = $filesize == 0 ? 0 : $downloaded / $filesize;252 if(abs($downloaded_float - $last_float) < 0.01)253 {254 return;255 }256 pts_client::$display->test_install_progress_update($downloaded_float);257 $last_float = $downloaded_float;258 break;259 }260 }261 private static function curl_status_callback($download_size, $downloaded)262 {263 static $last_float = -1;264 $downloaded_float = $download_size == 0 ? 0 : $downloaded / $download_size;265 if(abs($downloaded_float - $last_float) < 0.01)266 {267 return;268 }269 pts_client::$display->test_install_progress_update($downloaded_float);270 $last_float = $downloaded_float;271 }272 public static function client_startup()273 {274 if(($proxy_address = pts_config::read_user_config('PhoronixTestSuite/Options/Networking/ProxyAddress', false)) && ($proxy_port = pts_config::read_user_config('PhoronixTestSuite/Options/Networking/ProxyPort', false)))275 {276 // Don't need http:// in address and some people mistakenly do it277 // e.g. https://www.phoronix.com/forums/forum/phoronix/phoronix-test-suite/905211-problem-network-support-is-needed-to-obtain-package278 $proxy_address = str_replace(array('http://', 'https://'), '', $proxy_address);279 self::$network_proxy['proxy'] = $proxy_address . ':' . $proxy_port;280 self::$network_proxy['address'] = $proxy_address;281 self::$network_proxy['port'] = $proxy_port;282 self::$network_proxy['user'] = pts_config::read_user_config('PhoronixTestSuite/Options/Networking/ProxyUser', false);283 self::$network_proxy['password'] = pts_config::read_user_config('PhoronixTestSuite/Options/Networking/ProxyPassword', false);284 }285 else if(($env_proxy = getenv('http_proxy')) != false && count($env_proxy = pts_strings::colon_explode($env_proxy)) == 2)286 {287 self::$network_proxy['proxy'] = $env_proxy[0] . ':' . $env_proxy[1];288 self::$network_proxy['address'] = $env_proxy[0];289 self::$network_proxy['port'] = $env_proxy[1];290 self::$network_proxy['user'] = false; // TODO is there any env vars usually storing proxy user/pw?291 self::$network_proxy['password'] = false;292 }293 self::$network_timeout = pts_config::read_user_config('PhoronixTestSuite/Options/Networking/Timeout', 20);294 if(ini_get('allow_url_fopen') == 'Off')295 {296 if(!defined('PHOROMATIC_SERVER'))297 {298 echo PHP_EOL . 'The allow_url_fopen option in your PHP configuration must be enabled for network support.' . PHP_EOL . PHP_EOL;299 }300 self::$disable_network_support = true;301 }302 else if(pts_config::read_bool_config('PhoronixTestSuite/Options/Networking/NoInternetCommunication', 'FALSE'))303 {304 if(!defined('PHOROMATIC_SERVER'))305 {306 echo PHP_EOL . 'Internet Communication Is Disabled Per Your User Configuration.' . PHP_EOL . PHP_EOL;307 }308 self::$disable_internet_support = true;309 }310 else if(pts_config::read_bool_config('PhoronixTestSuite/Options/Networking/NoNetworkCommunication', 'FALSE'))311 {312 if(!defined('PHOROMATIC_SERVER'))313 {314 echo PHP_EOL . 'Network Communication Is Disabled Per Your User Configuration.' . PHP_EOL . PHP_EOL;315 }316 self::$disable_network_support = true;317 }318 319 /*320 else if(!PTS_IS_WEB_CLIENT)321 {322 $server_response = pts_network::http_get_contents('http://openbenchmarking.org/PTS', false, false);323 if($server_response != 'PTS')324 {325 // Failed to connect to PTS server326 // As a last resort, see if it can resolve IP to Google.com as a test for Internet connectivity...327 // i.e. in case Phoronix server is down or some other issue, so just see if Google will resolve328 // If google.com fails to resolve, it will simply return the original string329 if(gethostbyname('google.com') == 'google.com')330 {331 echo PHP_EOL;332 if(PTS_IS_DAEMONIZED_SERVER_PROCESS)333 {334 // Wait some seconds in case network is still coming up335 foreach(array(20, 40) as $time_to_wait)336 {337 sleep($time_to_wait);338 $server_response = pts_network::http_get_contents('http://openbenchmarking.org/PTS', false, false);339 if($server_response != 'PTS' && gethostbyname('google.com') == 'google.com')340 {341 trigger_error('没有网络连接', E_USER_WARNING);342 self::$disable_internet_support = true;343 }344 else345 {346 self::$disable_internet_support = false;347 break;348 }349 }350 }351 else352 {353 trigger_error('No Internet Connectivity', E_USER_WARNING);354 self::$disable_internet_support = true;355 }356 }357 }358 }359 */360 if(pts_network::network_support_available() == false && ini_get('file_uploads') == 'Off')361 {362 echo PHP_EOL . 'The file_uploads option in your PHP configuration must be enabled for network support.' . PHP_EOL . PHP_EOL;363 }364 }365 public static function get_active_network_interface()366 {367 $dev = '';368 // try and get the device with the default route369 if ($ip = pts_client::executable_in_path('ip'))370 {371 $out = shell_exec("$ip route 2>&1");372 $start = strpos($out, ' dev ');373 if($start !== false)374 {375 $start += 5; // length of ' dev '376 if(($xx = strpos($out, ' ', $start)) !== false)377 {378 $dev = substr($out, $start, $xx - $start);379 }380 }381 }382 // we grab the last field of the `netstat -nr` output, betting on *bsd not expiring it's default route383 if(empty($dev) && $netstat = pts_client::executable_in_path('netstat')) {384 $out = shell_exec("$netstat -rn 2>&1");385 $lines = explode("\n", $out);386 foreach ($lines as $line) {387 $start = substr($line,0,7);388 if ($start == '0.0.0.0' || $start === 'default') {389 $dev = trim(substr(trim($line),strrpos($line,' ')));390 return $dev;391 }392 }393 }394 return $dev;395 }396 public static function get_local_ip()397 {398 $local_ip = false;399 $interface = self::get_active_network_interface();400 if(($ifconfig = pts_client::executable_in_path('ifconfig')))401 {402 $ifconfig = shell_exec($ifconfig . " $interface 2>&1");403 $offset = 0;404 while(($ipv4_pos = strpos($ifconfig, 'inet addr:', $offset)) !== false)405 {406 $ipv4 = substr($ifconfig, $ipv4_pos + strlen('inet addr:'));407 $ipv4 = substr($ipv4, 0, strpos($ipv4, ' '));408 $local_ip = $ipv4;409 if($local_ip != '127.0.0.1' && $local_ip != null)410 {411 break;412 }413 $offset = $ipv4_pos + 1;414 }415 if($local_ip == null)416 {417 while(($ipv4_pos = strpos($ifconfig, 'inet ', $offset)) !== false)418 {419 $ipv4 = substr($ifconfig, $ipv4_pos + strlen('inet '));420 $ipv4 = substr($ipv4, 0, strpos($ipv4, ' '));421 $local_ip = $ipv4;422 if($local_ip != '127.0.0.1' && $local_ip != null)423 {424 break;425 }426 $offset = $ipv4_pos + 1;427 }428 }429 }430 else if(phodevi::is_windows())431 {432 $ipconfig = shell_exec('ipconfig');433 $offset = 0;434 while(($ipv4_pos = strpos($ipconfig, 'IPv4 Address.', $offset)) !== false)435 {436 $ipv4 = substr($ipconfig, $ipv4_pos);437 $ipv4 = substr($ipv4, strpos($ipv4, ': ') + 2);438 $ipv4 = substr($ipv4, 0, strpos($ipv4, "\n"));439 $local_ip = trim($ipv4);440 if($local_ip != '127.0.0.1' && $local_ip != null && strpos($local_ip, '169.254') === false)441 {442 break;443 }444 $offset = $ipv4_pos + 3;445 }446 }447 else if(pts_client::executable_in_path('hostname'))448 {449 $hostname_i = explode(' ', trim(shell_exec('hostname -I 2>&1')));450 $hostname_i = array_shift($hostname_i);451 if(count(explode('.', $hostname_i)) == 4)452 {453 $local_ip = $hostname_i;454 }455 }456 if(empty($local_ip) && function_exists('net_get_interfaces'))457 {458 // The below code should work as of net_get_interfaces() as of PHP 7.3 in cross-platform manner459 $net_interfaces = net_get_interfaces();460 foreach($net_interfaces as $interface => $interface_info)461 {462 if(isset($interface_info['unicast'][1]['address']) && !empty($interface_info['unicast'][1]['address']) && $interface_info['unicast'][1]['address'] != '127.0.0.1')463 {464 $local_ip = $interface_info['unicast'][1]['address'];465 break;466 }467 }468 }469 return $local_ip;470 }471 public static function get_network_mac()472 {473 $mac = false;474 if(phodevi::is_linux())475 {476 if($interface = self::get_active_network_interface())477 {478 $addr = "/sys/class/net/$interface/address";479 if(is_file($addr))480 {481 $mac = pts_file_io::file_get_contents($addr);482 }483 }484 if(empty($mac))485 {486 foreach(pts_file_io::glob('/sys/class/net/*/operstate') as $net_device_state)487 {488 if(pts_file_io::file_get_contents($net_device_state) == 'up')489 {490 $addr = dirname($net_device_state) . '/address';491 if(is_file($addr))492 {493 $mac = pts_file_io::file_get_contents($addr);494 break;495 }496 }497 }498 }499 }500 else if(phodevi::is_windows())501 {502 $getmac = shell_exec('getmac');503 $getmac = trim(substr($getmac, strpos($getmac, "\n", strpos($getmac, '======='))));504 $getmac = substr($getmac, 0, strpos($getmac, ' '));505 if(strlen($getmac) <= 17)506 {507 $mac = str_replace('-', ':', $getmac);508 }509 }510 if(empty($mac) && ($ifconfig = pts_client::executable_in_path('ifconfig')))511 {512 $ifconfig = shell_exec($ifconfig . ' 2>&1');513 $offset = 0;514 while(($hwaddr_pos = strpos($ifconfig, 'HWaddr ', $offset)) !== false || ($hwaddr_pos = strpos($ifconfig, 'ether ', $offset)) !== false)515 {516 $hw_addr = substr($ifconfig, $hwaddr_pos);517 $hw_addr = substr($hw_addr, (strpos($hw_addr, ' ') + 1));518 $hw_addr = substr($hw_addr, 0, strpos($hw_addr, ' '));519 if(($x = strpos($hw_addr, PHP_EOL)) != false)520 {521 $hw_addr = substr($hw_addr, 0, $x);522 }523 $mac = $hw_addr;524 if($mac != null)525 {526 break;527 }528 $offset = $hwaddr_pos + 1;529 }530 }531 if(empty($mac) && ($netstat = pts_client::executable_in_path('netstat')))532 {533 // Needed on at least OpenBSD as their `ifconfig` does not expose the MAC address534 $netstat = shell_exec($netstat . ' -in 2>&1');535 foreach(explode(PHP_EOL, $netstat) as $line)536 {537 $line = explode(' ', $line);538 foreach($line as $i => $r)539 {540 if($r == null)541 unset($line[$i]);542 }543 $line = array_values($line);544 if(!isset($line[3]))545 {546 continue;547 }548 $address = explode(':', $line[3]);549 if(count($address) == 6 && $address[0] != '00' && $address[5] != '00')550 {551 foreach($address as $seg)552 {553 if(strlen($seg) != 2)554 {555 continue;556 }557 }558 $mac = $line[3];559 }560 }561 }562 return $mac;563 }564 public static function get_network_wol()565 {566 static $wol_support = null;567 if($wol_support === null)568 {569 $wol_support = array();570 if(is_dir('/sys/class/net'))571 {572 if(pts_client::executable_in_path('ethtool'))573 {574 foreach(pts_file_io::glob('/sys/class/net/*') as $net_device)575 {576 if(!is_readable($net_device . '/operstate') || trim(file_get_contents($net_device . '/operstate')) != 'up')577 {578 continue;579 }580 $net_name = basename($net_device);581 $ethtool_output = shell_exec('ethtool ' . $net_name . ' 2>&1');582 if(($x = stripos($ethtool_output, 'Supports Wake-on: ')) !== false)583 {584 $ethtool_output = substr($ethtool_output, $x + strlen('Supports Wake-on: '));585 $ethtool_output = trim(substr($ethtool_output, 0, strpos($ethtool_output, PHP_EOL)));586 $wol_support[$net_name] = $net_name . ': ' . $ethtool_output;587 }588 }589 }590 if(empty($wol_support) && pts_client::executable_in_path('nmcli'))591 {592 foreach(pts_file_io::glob('/sys/class/net/*') as $net_device)593 {594 if(!is_readable($net_device . '/operstate') || trim(file_get_contents($net_device . '/operstate')) != 'up')595 {596 continue;597 }598 $net_name = basename($net_device);599 $ethtool_output = shell_exec('nmcli c show ' . $net_name . ' 2>&1');600 if(($x = stripos($ethtool_output, '.wake-on-lan:')) !== false)601 {602 $ethtool_output = substr($ethtool_output, $x + strlen('.wake-on-lan:'));603 $ethtool_output = trim(substr($ethtool_output, 0, strpos($ethtool_output, PHP_EOL)));604 if(strpos($ethtool_output, '1') || strpos($ethtool_output, 'default'))605 {606 shell_exec('nmcli connection modify ' . $net_name . ' 802-3-ethernet.wake-on-lan magic 2>&1'); // TODO this really needed?607 $wol_support[$net_name] = $net_name . ': g';608 }609 }610 }611 }612 }613 }614 return $wol_support;615 }616 public static function send_wol_packet($ip_address, $mac_address)617 {618 $hwaddr = null;619 foreach(explode(':', $mac_address) as $o)620 {621 $hwaddr .= chr(hexdec($o));622 }623 $packet = null;624 for($i = 1; $i <= 6; $i++)625 {626 $packet .= chr(255);627 }628 for($i = 1; $i <= 16; $i++)629 {630 $packet .= $hwaddr;631 }632 $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);633 if($sock)634 {635 $options = socket_set_option($sock, 1, 6, true);636 if($options >= 0)637 {638 $sendto = socket_sendto($sock, $packet, strlen($packet), 0, $ip_address, 7);639 socket_close($sock);640 return $sendto;641 }642 }643 return false;644 }645 public static function find_zeroconf_phoromatic_servers($find_multiple = false)646 {647 $hosts = $find_multiple ? array() : null;648 if(!pts_network::network_support_available())649 {650 return $hosts;651 }652 if(PTS_IS_CLIENT && pts_client::executable_in_path('avahi-browse'))653 {654 $avahi_browse = explode(PHP_EOL, shell_exec('avahi-browse -p -r -t _http._tcp 2>&1'));655 foreach(array_reverse($avahi_browse) as $avahi_line)656 {657 if(strrpos($avahi_line, 'phoromatic-server') !== false)658 {659 $avahi_line = explode(';', $avahi_line);660 if(isset($avahi_line[8]) && ip2long($avahi_line[7]) !== false && is_numeric($avahi_line[8]))661 {662 $server_ip = $avahi_line[7];663 $server_port = $avahi_line[8];664 //echo $server_ip . ':' . $server_port;665 if($find_multiple)666 {...

Full Screen

Full Screen

info.php

Source:info.php Github

copy

Full Screen

...36 {37 $o = pts_types::identifier_to_object($arg);38 if($o instanceof pts_test_suite)39 {40 pts_client::$display->generic_heading($o->get_title());41 echo pts_client::cli_just_bold('Run Identifier: ') . $o->get_identifier() . PHP_EOL;42 echo pts_client::cli_just_bold('Suite Version: ') . $o->get_version() . PHP_EOL;43 echo pts_client::cli_just_bold('Maintainer: ') . $o->get_maintainer() . PHP_EOL;44 echo pts_client::cli_just_bold('Suite Type: ') . $o->get_suite_type() . PHP_EOL;45 echo pts_client::cli_just_bold('Unique Tests: ') . $o->get_unique_test_count() . PHP_EOL;46 echo pts_client::cli_just_bold('Suite Description: ') . $o->get_description() . PHP_EOL;47 echo PHP_EOL . pts_client::cli_just_bold('Contained Tests: ') . PHP_EOL;48 $test_table = array();49 foreach($o->get_contained_test_result_objects() as $result_obj)50 {51 $test_table[] = array($result_obj->test_profile->get_title(), $result_obj->get_arguments_description());52 }53 echo pts_user_io::display_text_table($test_table, ' ', 1);54 echo PHP_EOL;55 }56 else if($o instanceof pts_test_profile)57 {58 $test_title = $o->get_title();59 $test_version = $o->get_app_version();60 if(!empty($test_version))61 {62 $test_title .= ' ' . $test_version;63 }64 pts_client::$display->generic_heading($test_title);65 echo pts_client::cli_just_bold('Run Identifier: ') . $o->get_identifier() . PHP_EOL;66 echo pts_client::cli_just_bold('Profile Version: ') . $o->get_test_profile_version() . PHP_EOL;67 echo pts_client::cli_just_bold('Maintainer: ') . $o->get_maintainer() . PHP_EOL;68 echo pts_client::cli_just_bold('Test Type: ') . $o->get_test_hardware_type() . PHP_EOL;69 echo pts_client::cli_just_bold('Software Type: ') . $o->get_test_software_type() . PHP_EOL;70 echo pts_client::cli_just_bold('License Type: ') . $o->get_license() . PHP_EOL;71 echo pts_client::cli_just_bold('Test Status: ') . $o->get_status() . PHP_EOL;72 echo pts_client::cli_just_bold('Project Web-Site: ') . $o->get_project_url() . PHP_EOL;73 if($o->get_estimated_run_time() > 1)74 {75 echo pts_client::cli_just_bold('Estimated Run-Time: ') . $o->get_estimated_run_time() . ' Seconds' . PHP_EOL;76 }77 $download_size = $o->get_download_size();78 if(!empty($download_size))79 {80 echo pts_client::cli_just_bold('Download Size: ') . $download_size . ' MB' . PHP_EOL;81 }82 $environment_size = $o->get_environment_size();83 if(!empty($environment_size))84 {85 echo pts_client::cli_just_bold('Environment Size: ') . $environment_size . ' MB' . PHP_EOL;86 }87 echo PHP_EOL . pts_client::cli_just_bold('Description: ') . $o->get_description() . PHP_EOL;88 if($o->test_installation != false)89 {90 $last_run = $o->test_installation->get_last_run_date();91 $last_run = $last_run == '0000-00-00' ? 'Never' : $last_run;92 $avg_time = $o->test_installation->get_average_run_time();93 $avg_time = !empty($avg_time) ? pts_strings::format_time($avg_time, 'SECONDS') : 'N/A';94 $latest_time = $o->test_installation->get_latest_run_time();95 $latest_time = !empty($latest_time) ? pts_strings::format_time($latest_time, 'SECONDS') : 'N/A';96 echo PHP_EOL . pts_client::cli_just_bold('Test Installed: ') . 'Yes' . PHP_EOL;97 echo pts_client::cli_just_bold('Last Run: ') . $last_run . PHP_EOL;98 if($last_run != 'Never')99 {100 if($o->test_installation->get_run_count() > 1)101 {102 echo pts_client::cli_just_bold('Average Run-Time: ') . $avg_time . PHP_EOL;103 }104 echo pts_client::cli_just_bold('Latest Run-Time: ') . $latest_time . PHP_EOL;105 echo pts_client::cli_just_bold('Times Run: ') . $o->test_installation->get_run_count() . PHP_EOL;106 }107 }108 else109 {110 echo PHP_EOL . pts_client::cli_just_bold('Test Installed: ') . 'No' . PHP_EOL;111 }112 $dependencies = $o->get_external_dependencies();113 if(!empty($dependencies) && !empty($dependencies[0]))114 {115 echo PHP_EOL . pts_client::cli_just_bold('Software Dependencies:') . PHP_EOL;116 echo pts_user_io::display_text_list($o->get_dependency_names());117 }118 echo PHP_EOL;119 }120 else if($o instanceof pts_result_file)121 {122 echo pts_client::cli_just_bold('Title: ') . $o->get_title() . PHP_EOL . pts_client::cli_just_bold('Identifier: ') . $o->get_identifier() . PHP_EOL;123 echo PHP_EOL . pts_client::cli_just_bold('Test Result Identifiers:') . PHP_EOL;124 echo pts_user_io::display_text_list($o->get_system_identifiers());125 $test_titles = array();126 foreach($o->get_result_objects() as $result_object)127 {128 if($result_object->test_profile->get_display_format() == 'BAR_GRAPH')129 {130 $test_titles[] = $result_object->test_profile->get_title();131 }132 }133 if(count($test_titles) > 0)134 {135 echo PHP_EOL . pts_client::cli_just_bold('Contained Tests:') . PHP_EOL;136 echo pts_user_io::display_text_list(array_unique($test_titles));137 }138 echo PHP_EOL;139 }140 else if($o instanceof pts_virtual_test_suite)141 {142 pts_client::$display->generic_heading($o->get_title());143 echo pts_client::cli_just_bold('Virtual Suite Description: ') . $o->get_description() . PHP_EOL . PHP_EOL;144 foreach($o->get_contained_test_profiles() as $test_profile)145 {146 echo '- ' . $test_profile . PHP_EOL;147 }148 echo PHP_EOL;149 }150 }151 }152}153?>...

Full Screen

Full Screen

pts_client

Using AI Code Generation

copy

Full Screen

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

Full Screen

Full Screen

pts_client

Using AI Code Generation

copy

Full Screen

1include "pts_client.php";2$pts = new pts_client();3$pts->run_test("pts/2.0.0", "test1", "test2", "test3");4include "pts_client.php";5$pts = new pts_client();6$pts->run_test("pts/1.0.0", "test1", "test2", "test3");

Full Screen

Full Screen

pts_client

Using AI Code Generation

copy

Full Screen

1require_once('pts_client.php');2$test = new pts_client();3$test->execute("test_name", "test_arguments");4require_once('pts_client.php');5$test = new pts_client();6$test->execute("test_name", "test_arguments");7require_once('pts_client.php');8$test = new pts_client();9$test->execute("test_name", "test_arguments");10require_once('pts_client.php');11$test = new pts_client();12$test->execute("test_name", "test_arguments");13require_once('pts_client.php');14$test = new pts_client();15$test->execute("test_name", "test_arguments");16require_once('pts_client.php');17$test = new pts_client();18$test->execute("test_name", "test_arguments");19require_once('pts_client.php');20$test = new pts_client();21$test->execute("test_name", "test_arguments");22require_once('pts_client.php');23$test = new pts_client();24$test->execute("test_name", "test_arguments");25require_once('pts_client.php');26$test = new pts_client();27$test->execute("test_name", "test_arguments");28require_once('pts_client.php');29$test = new pts_client();30$test->execute("test_name", "test_arguments");31require_once('pts_client.php');32$test = new pts_client();33$test->execute("test_name", "test_arguments");

Full Screen

Full Screen

pts_client

Using AI Code Generation

copy

Full Screen

1include_once('pts-core/pts-core.php');2$pts_client = new pts_client();3$pts_client->set_results_path('/var/lib/phoronix-test-suite/test-results');4$pts_client->set_test_profile_path('/usr/share/phoronix-test-suite/test-profiles');5$pts_client->set_test_log_path('/var/lib/phoronix-test-suite/test-logs');6$pts_client->set_test_suite_path('/usr/share/phoronix-test-suite/test-suites');7$pts_client->set_test_suite_path('/usr/share/phoronix-test-suite/test-suites');8$pts_client->set_system_log_path('/var/lib/phoronix-test-suite/system-logs');9$pts_client->set_system_log_path('/var/lib/phoronix-test-suite/system-logs');10$pts_client->set_system_log_path('/var/lib/phoronix-test-suite/system-logs');11$pts_client->set_system_log_path('/var/lib/phoronix-test-suite/system-logs');12$pts_client->set_system_log_path('/var/lib/phoronix-test-suite/system-logs');13$pts_client->set_system_log_path('/var/lib/phoronix-test-suite/system-logs');14$pts_client->set_system_log_path('/var/lib/phoronix-test-suite/system-logs');15$pts_client->set_system_log_path('/var/lib/phoronix-test-suite/system-logs');16$pts_client->set_system_log_path('/var/lib/phoronix-test-suite/system-logs');

Full Screen

Full Screen

pts_client

Using AI Code Generation

copy

Full Screen

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

Full Screen

Full Screen

pts_client

Using AI Code Generation

copy

Full Screen

1require_once('pts_client.php');2$pts = new pts_client();3$pts->start_test('test_name', 'test_version', 'test_profile');4$pts->end_test();5$pts->result->test_profile->add_result($result_value, $result_unit);6$pts->result->test_profile->add_result($result_value, $result_unit);7require_once('pts_client.php');8$pts = new pts_client();9$pts->start_test('test_name', 'test_version', 'test_profile');10$pts->result->test_profile->add_result($result_value, $result_unit);11$pts->end_test();

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.

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

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