public function __construct($identifier = null)
 {
     $this->struct = array('external-dependencies' => array('name' => null, 'package_manager' => null, 'aliases' => array(), 'packages' => array()));
     if (PTS_IS_CLIENT) {
         $xml = PTS_EXDEP_PATH . 'xml/' . $identifier . '-packages.xml';
         $xml_parser = new nye_XmlReader($xml);
         $this->struct['external-dependencies']['name'] = $xml_parser->getXMLValue('PhoronixTestSuite/ExternalDependencies/Information/Name');
         $this->struct['external-dependencies']['package_manager'] = $xml_parser->getXMLValue('PhoronixTestSuite/ExternalDependencies/Information/PackageManager');
         $generic_package = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/GenericName');
         $distro_package = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/PackageName');
         $file_check = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/FileCheck');
         $arch_specific = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/ArchitectureSpecific');
         $os_version_specific = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/VersionSpecific');
         $os_version = phodevi::read_property('system', 'os-version');
         foreach (array_keys($generic_package) as $i) {
             if (empty($generic_package[$i])) {
                 continue;
             }
             $os_version_compliant = empty($os_version_specific[$i]) || in_array($os_version, pts_strings::comma_explode($os_version_specific[$i]));
             if ($os_version_compliant == false) {
                 continue;
             }
             $this->struct['external-dependencies']['packages'][$generic_package[$i]] = $this->get_package_format($distro_package[$i], $file_check[$i], $arch_specific[$i]);
         }
         $aliases = $xml_parser->getXMLValue('PhoronixTestSuite/ExternalDependencies/Information/Aliases');
         if ($aliases != null) {
             $aliases = pts_strings::trim_explode(',', $aliases);
             foreach ($aliases as $alias) {
                 if ($alias != null) {
                     $this->struct['external-dependencies']['aliases'][] = $alias;
                 }
             }
         }
     }
 }
Пример #2
0
 public static function init_files()
 {
     // Don't let the process run multiple times...
     if (pts_config::$init_process_ran) {
         return false;
     }
     pts_config::$init_process_ran = true;
     // The main PTS user client config
     pts_config::user_config_generate();
     // Generate the graph config
     $json_pre = null;
     if (is_file(PTS_USER_PATH . 'graph-config.json')) {
         $json_pre = file_get_contents(PTS_USER_PATH . 'graph-config.json');
     } else {
         if (PTS_IS_CLIENT && is_file($t = PTS_CORE_STATIC_PATH . 'graph-config-template-' . phodevi::read_property('system', 'vendor-identifier') . '.json')) {
             $json_pre = file_get_contents($t);
         } else {
             if (is_file(PTS_CORE_STATIC_PATH . 'graph-config-template.json')) {
                 $json_pre = file_get_contents(PTS_CORE_STATIC_PATH . 'graph-config-template.json');
             }
         }
     }
     $json_graph = array();
     pts_Graph::set_default_graph_values($json_graph);
     if ($json_pre != null) {
         $json_pre = json_decode($json_pre, true);
         if (is_array($json_pre)) {
             $json_graph = array_merge($json_graph, $json_pre);
         }
     }
     pts_Graph::init_graph_config($json_graph);
     file_put_contents(PTS_USER_PATH . 'graph-config.json', pts_arrays::json_encode_pretty_string($json_graph));
 }
 public function __construct($new_values = null)
 {
     if (PTS_IS_DAEMONIZED_SERVER_PROCESS || is_file('/etc/phoronix-test-suite.xml') && is_writable('/etc/phoronix-test-suite.xml')) {
         $file = '/etc/phoronix-test-suite.xml';
     } else {
         if (PTS_IS_CLIENT && is_file(pts_config::get_config_file_location())) {
             $file = pts_config::get_config_file_location();
         } else {
             if (PTS_USER_PATH . 'user-config.xml' != pts_config::get_config_file_location() && is_file(PTS_USER_PATH . 'user-config.xml')) {
                 $file = PTS_USER_PATH . 'user-config.xml';
             } else {
                 if (PTS_IS_CLIENT && is_file($t = PTS_CORE_STATIC_PATH . phodevi::read_property('system', 'vendor-identifier') . '-user-config-template.xml')) {
                     $file = $t;
                 } else {
                     if (is_file(PTS_CORE_STATIC_PATH . 'user-config-template.xml')) {
                         $file = PTS_CORE_STATIC_PATH . 'user-config-template.xml';
                     } else {
                         if (is_file(PTS_CORE_STATIC_PATH . 'user-config-defaults.xml')) {
                             $file = PTS_CORE_STATIC_PATH . 'user-config-defaults.xml';
                         } else {
                             $file = null;
                         }
                     }
                 }
             }
         }
     }
     $this->override_values = is_array($new_values) ? $new_values : false;
     parent::__construct($file);
 }
 public static function device_notes()
 {
     $notes = array();
     if (($disk_scheduler = phodevi::read_property('disk', 'scheduler')) != null) {
         array_push($notes, 'Disk Scheduler: ' . $disk_scheduler);
     }
     return $notes;
 }
 public static function cpu_string()
 {
     $model = phodevi::read_property('cpu', 'model');
     // Append the processor frequency to string
     if (($freq = phodevi::read_property('cpu', 'default-frequency')) > 0) {
         $model = str_replace($freq . 'GHz', null, $model);
         // we'll replace it if it's already in the string
         $model .= ' @ ' . $freq . 'GHz';
     }
     $core_count = phodevi::read_property('cpu', 'core-count');
     return $model . ' (' . pts_strings::plural_handler($core_count, 'Core') . ')';
 }
    public static function render_page_process($PATH)
    {
        $component_modal = array('CPU' => array(phodevi::read_property('cpu', 'model'), phodevi::read_property('cpu', 'core-count') . ' Logical Cores - ' . phodevi::read_property('cpu', 'default-frequency') . ' GHz'), 'Motherboard' => array(phodevi::read_property('motherboard', 'identifier'), phodevi::read_property('chipset', 'identifier')), 'Memory' => array(phodevi::read_property('memory', 'identifier'), null), 'Disk' => array(phodevi::read_property('disk', 'identifier'), phodevi::read_property('disk', 'scheduler')), 'Graphics' => array(phodevi::read_property('gpu', 'model'), phodevi::read_property('gpu', 'frequency') . ' - ' . phodevi::read_property('monitor', 'identifier')));
        echo '<div style="overflow: hidden; text-align: center; height: inherit; vertical-align: center; margin: auto auto;">';
        foreach ($component_modal as $component) {
            echo '<div class="pts_system_component_bar"><h1>' . $component[0] . '</h1><p>' . $component[1] . '</p></div>';
        }
        echo '</div>';
        echo '<div id="large_svg_graphs" style="margin: 10px 0; text-align: center;"></div>';
        echo '<div id="system_log_viewer"><select id="log_viewer_selector" onchange="javascript:log_viewer_change(); return true;"></select><div id="system_log_display"></div></div>';
        echo '<script text="text/javascript">
			pts_web_socket.submit_event("available-system-logs", "available_system_logs", "update_system_log_viewer");
			pts_web_socket.submit_event("user-large-svg-system-graphs", "large_svg_graphs", "update_large_svg_graph_space");
			setInterval(function(){if(pts_web_socket.is_connected()) { pts_web_socket.send("user-large-svg-system-graphs"); }},1000);
		</script>';
    }
 public static function read_sun_ddu_dmi_info($find_objects, $args = null)
 {
     // Read Sun's Device Driver Utility for OpenSolaris
     $values = array();
     if (in_array(phodevi::read_property('system', 'kernel-architecture'), array('i686', 'x86_64'))) {
         $dmi_info = '/usr/ddu/bin/i386/dmi_info';
     } else {
         $dmi_info = '/usr/ddu/bin/sparc/dmi_info';
     }
     if (is_executable($dmi_info) || is_executable($dmi_info = '/usr/ddu/bin/dmi_info')) {
         $info = shell_exec($dmi_info . ' ' . $args . ' 2>&1');
         $lines = explode("\n", $info);
         $find_objects = pts_arrays::to_array($find_objects);
         for ($i = 0; $i < count($find_objects) && count($values) == 0; $i++) {
             $objects = pts_strings::comma_explode($find_objects[$i]);
             $this_section = null;
             if (count($objects) == 2) {
                 $section = $objects[0];
                 $object = $objects[1];
             } else {
                 $section = null;
                 $object = $objects[0];
             }
             foreach ($lines as $line) {
                 $line = pts_strings::colon_explode($line);
                 $line_object = isset($line[0]) ? str_replace(' ', null, $line[0]) : null;
                 $this_value = count($line) > 1 ? $line[1] : null;
                 if (empty($this_value) && !empty($section)) {
                     $this_section = $line_object;
                 }
                 if ($line_object == $object && ($this_section == $section || pts_strings::proximity_match($section, $this_section)) && !empty($this_value) && $this_value != 'Unknown') {
                     array_push($values, $this_value);
                 }
             }
         }
     }
     return $values;
 }
Пример #8
0
 public static function init()
 {
     self::$flags = 0;
     self::$os_identifier_sha1 = sha1(phodevi::read_property('system', 'vendor-identifier'));
     self::$is_live_cd = 1 << 1;
     self::$no_network_communication = 1 << 2;
     self::$no_openbenchmarking_reporting = 1 << 3;
     self::$user_agreement_skip = 1 << 4;
     self::$skip_md5_checks = 1 << 5;
     self::$remove_test_on_completion = 1 << 6;
     self::$no_phodevi_cache = 1 << 7;
     self::$no_external_dependencies = 1 << 8;
     self::$upload_to_openbenchmarking = 1 << 9;
     switch (self::$os_identifier_sha1) {
         case 'b28d6a7148b34595c5b397dfcf5b12ac7932b3dc':
             // Moscow 2011-04 client
             self::$flags = self::$is_live_cd | self::$no_network_communication | self::$no_openbenchmarking_reporting | self::$user_agreement_skip | self::$skip_md5_checks | self::$remove_test_on_completion;
             break;
     }
     if (pts_client::read_env('NO_FILE_HASH_CHECKS') != false || pts_client::read_env('NO_MD5_CHECKS') != false) {
         self::$flags |= self::$skip_md5_checks;
     }
     if (pts_config::read_bool_config('PhoronixTestSuite/Options/Testing/RemoveTestInstallOnCompletion', 'FALSE')) {
         self::$flags |= self::$remove_test_on_completion;
     }
     if (pts_config::read_bool_config('PhoronixTestSuite/Options/Testing/AlwaysUploadResultsToOpenBenchmarking', 'FALSE')) {
         self::$flags |= self::$upload_to_openbenchmarking;
     }
     if (pts_client::read_env('NO_PHODEVI_CACHE') != false) {
         self::$flags |= self::$no_phodevi_cache;
     }
     if (pts_client::read_env('NO_EXTERNAL_DEPENDENCIES') != false || pts_client::read_env('SKIP_EXTERNAL_DEPENDENCIES') == 1) {
         // NO_EXTERNAL_DEPENDENCIES was deprecated in PTS 3.6 and replaced by more versatile SKIP_EXTERNAL_DEPENDENCIES
         self::$flags |= self::$no_external_dependencies;
     }
 }
 public static function memory_string()
 {
     $mem_string = null;
     $mem_prefix = null;
     $mem_size = false;
     $mem_speed = false;
     $mem_type = false;
     $mem_manufacturer = false;
     $mem_part = false;
     if (phodevi::is_macosx()) {
         $mem_size = phodevi_osx_parser::read_osx_system_profiler('SPMemoryDataType', 'Size', true, array('Empty'));
         $mem_speed = phodevi_osx_parser::read_osx_system_profiler('SPMemoryDataType', 'Speed');
         $mem_type = phodevi_osx_parser::read_osx_system_profiler('SPMemoryDataType', 'Type');
     } else {
         if (phodevi::is_solaris()) {
             $mem_size = phodevi_solaris_parser::read_sun_ddu_dmi_info('MemoryDevice*,InstalledSize');
             $mem_speed = phodevi_solaris_parser::read_sun_ddu_dmi_info('MemoryDevice*,Speed');
             $mem_type = phodevi_solaris_parser::read_sun_ddu_dmi_info('MemoryDevice*,MemoryDeviceType');
             if (is_array($mem_speed) && count($mem_speed) > 0) {
                 $mem_speed = array_shift($mem_speed);
             }
             $mem_speed = str_replace('MHZ', 'MHz', $mem_speed);
         } else {
             if (phodevi::is_windows()) {
                 $mem_size = phodevi_windows_parser::read_cpuz('DIMM #', 'Size', true);
                 foreach ($mem_size as $key => &$individual_size) {
                     $individual_size = pts_arrays::first_element(explode(' ', $individual_size));
                     if (!is_numeric($individual_size)) {
                         unset($mem_size[$key]);
                     }
                 }
                 $mem_type = phodevi_windows_parser::read_cpuz('Memory Type', null);
                 $mem_speed = intval(phodevi_windows_parser::read_cpuz('Memory Frequency', null)) . 'MHz';
             } else {
                 if (phodevi::is_linux()) {
                     $mem_size = phodevi_linux_parser::read_dmidecode('memory', 'Memory Device', 'Size', false, array('Not Installed', 'No Module Installed', 'Undefined'));
                     $mem_speed = phodevi_linux_parser::read_dmidecode('memory', 'Memory Device', 'Speed', true, array('Unknown', 'Undefined'));
                     $mem_type = phodevi_linux_parser::read_dmidecode('memory', 'Memory Device', 'Type', true, array('Unknown', 'Other', 'Flash', 'Undefined'));
                     $mem_manufacturer = phodevi_linux_parser::read_dmidecode('memory', 'Memory Device', 'Manufacturer', true, array('Unknown', 'Undefined'));
                     $mem_part = phodevi_linux_parser::read_dmidecode('memory', 'Memory Device', 'Part Number', true, array('Unknown', 'Undefined'));
                 }
             }
         }
     }
     if (is_array($mem_type)) {
         $mem_type = array_pop($mem_type);
     }
     if ($mem_size != false && (!is_array($mem_size) || count($mem_size) != 0)) {
         for ($i = 0; $i < count($mem_size); $i++) {
             switch (substr($mem_size[$i], -1)) {
                 case 'K':
                     // looks like sometimes Solaris now reports flash chip as memory. its string ends with K
                     unset($mem_size[$i]);
                     unset($mem_speed[$i]);
                     unset($mem_type[$i]);
                     break;
                 case 'M':
                     // report megabytes as MB, just not M, as on Solaris
                     $mem_size[$i] .= 'B';
                     break;
                 case 'B':
                     if (strtolower(substr($mem_size[$i], -2, 1)) == 'k') {
                         // some hardware on Linux via dmidecode reports flash chips
                         unset($mem_size[$i]);
                         //unset($mem_speed[$i]);
                         //unset($mem_type[$i]);
                     }
                     break;
             }
         }
         foreach ($mem_size as $i => $mem_stick) {
             if (!is_numeric(substr($mem_stick, 0, 3)) && stripos($mem_stick, 'GB') == false) {
                 // If the memory size isn't at least three digits (basically 128MB+), chances are something is wrong, i.e. reporting flash chip from dmidecode, so get rid of it.
                 unset($mem_size[$i]);
             }
         }
         $mem_count = count($mem_size);
         if (!empty($mem_type)) {
             if (($cut = strpos($mem_type, ' ')) > 0) {
                 $mem_type = substr($mem_type, 0, $cut);
             }
             if (!in_array($mem_type, array('Other')) && (pts_strings::keep_in_string($mem_type, pts_strings::CHAR_NUMERIC | pts_strings::CHAR_LETTER) == $mem_type || phodevi::is_windows())) {
                 $mem_prefix = $mem_type;
             }
         } else {
             $mem_prefix = null;
         }
         if (!empty($mem_speed)) {
             if (($cut = strpos($mem_speed, ' (')) > 0) {
                 $mem_speed = substr($mem_speed, 0, $cut);
             }
             if (!empty($mem_prefix)) {
                 $mem_prefix .= '-';
             }
             $mem_prefix .= str_replace(' ', null, $mem_speed);
         }
         // TODO: Allow a combination of both functions below, so like 2 x 2GB + 3 x 1GB DDR2-800
         if ($mem_count > 1 && count(array_unique($mem_size)) > 1) {
             $mem_string = implode(' + ', $mem_size) . ' ' . $mem_prefix;
         } else {
             if ($mem_count * $mem_size[0] != phodevi::read_property('memory', 'capacity') && phodevi::read_property('memory', 'capacity') % $mem_size[0] == 0) {
                 // This makes sure the correct number of RAM modules is reported...
                 // On at least Linux with dmidecode on an AMD Opteron multi-socket setup it's only showing the data for one socket
                 if ($mem_size[0] < 1024) {
                     $mem_size[0] *= 1024;
                 }
                 $mem_count = phodevi::read_property('memory', 'capacity') / $mem_size[0];
             }
             $product_string = null;
             if (isset($mem_manufacturer[2]) && ctype_alpha($mem_manufacturer[0]) && stripos($mem_manufacturer, 'manufacturer') === false && stripos($mem_manufacturer, 'part') === false && stripos($mem_manufacturer, 'module') === false && stripos($mem_manufacturer, 'dimm') === false && isset($mem_manufacturer[2]) && ctype_alpha($mem_manufacturer)) {
                 $product_string .= ' ' . $mem_manufacturer;
             }
             if (isset($mem_part[2]) && stripos($mem_part, 'part') === false && stripos($mem_part, 'module') === false && stripos($mem_part, 'dimm') === false && substr($mem_part, 0, 2) != '0x' && !isset($mem_part[24]) && ctype_alnum($mem_part)) {
                 $product_string .= ' ' . $mem_part;
             }
             if (is_numeric($mem_size[0]) && stripos($mem_size[0], 'b') === false) {
                 if ($mem_size >= 1024) {
                     $mem_size[0] .= ' MB';
                 } else {
                     $mem_size[0] .= ' GB';
                 }
             }
             $mem_string = $mem_count . ' x ' . $mem_size[0] . ' ' . $mem_prefix . $product_string;
         }
     }
     if (empty($mem_string)) {
         $mem_string = phodevi::read_property('memory', 'capacity');
         if ($mem_string != null) {
             $mem_string .= 'MB';
         }
     }
     return trim($mem_string);
 }
    public static function run($r)
    {
        if (pts_client::create_lock(PTS_USER_PATH . 'phoromatic_server_lock') == false) {
            trigger_error('The Phoromatic Server is already running.', E_USER_ERROR);
            return false;
        }
        pts_file_io::unlink(getenv('PTS_EXT_LAUNCH_SCRIPT_DIR') . '/phoromatic-server-launcher');
        if (PHP_VERSION_ID < 50400) {
            echo 'Running an unsupported PHP version. PHP 5.4+ is required to use this feature.' . PHP_EOL . PHP_EOL;
            return false;
        }
        if (!function_exists('socket_create_listen')) {
            echo 'PHP Sockets support is needed to use the Phoromatic Server.' . PHP_EOL . PHP_EOL;
            return false;
        }
        $server_launcher = '#!/bin/sh' . PHP_EOL;
        $web_port = 0;
        $remote_access = pts_config::read_user_config('PhoronixTestSuite/Options/Server/RemoteAccessPort', 'RANDOM');
        $fp = false;
        $errno = null;
        $errstr = null;
        if ($remote_access == 'RANDOM') {
            do {
                if ($fp) {
                    fclose($fp);
                }
                $remote_access = rand(8000, 8999);
            } while (($fp = fsockopen('127.0.0.1', $remote_access, $errno, $errstr, 5)) != false);
            echo 'Port ' . $remote_access . ' chosen as random port for this instance. Change the default port via the Phoronix Test Suite user configuration file.' . PHP_EOL;
        }
        $remote_access = is_numeric($remote_access) && $remote_access > 1 ? $remote_access : false;
        $blocked_ports = array(2049, 3659, 4045, 6000, 9000);
        if ($remote_access) {
            // ALLOWING SERVER TO BE REMOTELY ACCESSIBLE
            $server_ip = '0.0.0.0';
            if (($fp = fsockopen('127.0.0.1', $remote_access, $errno, $errstr, 5)) != false) {
                fclose($fp);
                trigger_error('Port ' . $remote_access . ' is already in use by another server process. Close that process or change the Phoronix Test Suite server port via' . pts_config::get_config_file_location() . ' to proceed.', E_USER_ERROR);
                return false;
            } else {
                $web_port = $remote_access;
                $web_socket_port = pts_config::read_user_config('PhoronixTestSuite/Options/Server/WebSocketPort', '');
                while ($web_socket_port == null || !is_numeric($web_socket_port) || ($fp = fsockopen('127.0.0.1', $web_socket_port, $errno, $errstr, 5)) != false) {
                    if ($fp) {
                        fclose($fp);
                    }
                    $web_socket_port = rand(8000, 8999);
                }
            }
        } else {
            echo PHP_EOL . PHP_EOL . 'You must first configure the remote web / Phoromatic settings via:' . PHP_EOL . '    ' . pts_config::get_config_file_location() . PHP_EOL . PHP_EOL . 'The RemoteAccessPort should be a network port to use for HTTP communication while WebSocketPort should be set to another available network port. Set to RANDOM if wishing to use randomly chosen available ports.' . PHP_EOL . PHP_EOL;
            return false;
        }
        if (!extension_loaded('sqlite3')) {
            echo PHP_EOL . PHP_EOL . 'PHP SQLite3 support must first be enabled before accessing the Phoromatic server (e.g. installing the php5-sqlite or php-pdo package depending on the distribution).' . PHP_EOL . PHP_EOL;
            return false;
        }
        // Setup server logger
        define('PHOROMATIC_SERVER', true);
        // Just create the logger so now it will flush it out
        $pts_logger = new pts_logger();
        $pts_logger->clear_log();
        echo pts_core::program_title(true) . ' starting Phoromatic Server' . PHP_EOL;
        $pts_logger->log(pts_core::program_title(true) . ' starting Phoromatic Server on ' . pts_network::get_local_ip());
        echo 'Phoronix Test Suite User-Data Directory Path: ' . PTS_USER_PATH . PHP_EOL;
        echo 'Phoronix Test Suite Configuration File: ' . pts_config::get_config_file_location() . PHP_EOL;
        echo 'Phoromatic Server Log File: ' . $pts_logger->get_log_file_location() . PHP_EOL;
        $pts_logger->log('PTS_USER_PATH = ' . PTS_USER_PATH);
        $pts_logger->log('PTS_DOWNLOAD_CACHE_PATH = ' . PTS_DOWNLOAD_CACHE_PATH);
        $pts_logger->log('XML Configuration File = ' . pts_config::get_config_file_location());
        // WebSocket Server Setup
        $server_launcher .= 'export PTS_WEB_PORT=' . $web_port . PHP_EOL;
        $server_launcher .= 'export PTS_WEBSOCKET_PORT=' . $web_socket_port . PHP_EOL;
        $server_launcher .= 'export PTS_WEBSOCKET_SERVER=PHOROMATIC' . PHP_EOL;
        $server_launcher .= 'export PTS_NO_FLUSH_LOGGER=1' . PHP_EOL;
        $server_launcher .= 'export PTS_PHOROMATIC_SERVER=1' . PHP_EOL;
        $server_launcher .= 'export PTS_PHOROMATIC_LOG_LOCATION=' . $pts_logger->get_log_file_location() . PHP_EOL;
        $server_launcher .= 'cd ' . getenv('PTS_DIR') . ' && PTS_MODE="CLIENT" ' . getenv('PHP_BIN') . ' pts-core/phoronix-test-suite.php start-ws-server &' . PHP_EOL;
        $server_launcher .= 'websocket_server_pid=$!' . PHP_EOL;
        $pts_logger->log('Starting WebSocket process on port ' . $web_socket_port);
        $server_launcher .= 'cd ' . getenv('PTS_DIR') . ' && PTS_MODE="CLIENT" ' . getenv('PHP_BIN') . ' pts-core/phoronix-test-suite.php start-phoromatic-event-server &' . PHP_EOL;
        $server_launcher .= 'event_server_pid=$!' . PHP_EOL;
        // HTTP Server Setup
        if (false && pts_client::executable_in_path('nginx') && is_file('/run/php-fpm/php-fpm.pid')) {
            // NGINX
            $nginx_conf = 'error_log /tmp/error.log;
			pid /tmp/nginx.pid;
			worker_processes 1;

			events {
			  worker_connections 1024;
			}

			http {
			  client_body_temp_path /tmp/client_body;
			  fastcgi_temp_path /tmp/fastcgi_temp;
			  proxy_temp_path /tmp/proxy_temp;
			  scgi_temp_path /tmp/scgi_temp;
			  uwsgi_temp_path /tmp/uwsgi_temp;
			  tcp_nopush on;
			  tcp_nodelay on;
			  keepalive_timeout 180;
			  types_hash_max_size 2048;
			  include /etc/nginx/mime.types;
			  index index.php;

			  server {
			    listen ' . $web_port . ';
			    listen [::]:' . $web_port . ' default ipv6only=on;
			    access_log /tmp/access.log;
			    error_log /tmp/error.log;
			    root ' . PTS_CORE_PATH . 'phoromatic/public_html;
				index index.php;
			      try_files $uri $uri/ /index.php;
				location / {
				autoindex on;
				}
				location ~ \\.php$ {
				     include        /etc/nginx/fastcgi_params;
				     fastcgi_param  SCRIPT_FILENAME  $document_root/$fastcgi_script_name;
				     fastcgi_split_path_info ^(.+\\.php)(/.+)$;
				     fastcgi_pass   127.0.0.1:9000;
				     fastcgi_index  index.php;
				}
			  }
			}';
            $nginx_conf_file = tempnam(PTS_USER_PATH, 'nginx_conf_');
            file_put_contents($nginx_conf_file, $nginx_conf);
            $server_launcher .= 'nginx -c ' . $nginx_conf_file . PHP_EOL . 'rm -f ' . $nginx_conf_file . PHP_EOL;
        } else {
            if (($mongoose = pts_client::executable_in_path('mongoose')) && ($php_cgi = pts_client::executable_in_path('php-cgi'))) {
                // Mongoose Embedded Web Server
                $server_launcher .= $mongoose . ' -p ' . $web_port . ' -r ' . PTS_CORE_PATH . 'phoromatic/public_html/ -I ' . $php_cgi . ' -i index.php > /dev/null 2>> $PTS_PHOROMATIC_LOG_LOCATION &' . PHP_EOL;
                //2> /dev/null
            } else {
                if (strpos(getenv('PHP_BIN'), 'hhvm')) {
                    echo PHP_EOL . 'Unfortunately, the HHVM built-in web server has abandoned upstream. Users will need to use the PHP binary or other alternatives.' . PHP_EOL . PHP_EOL;
                    return;
                } else {
                    // PHP Web Server
                    $server_launcher .= getenv('PHP_BIN') . ' -S ' . $server_ip . ':' . $web_port . ' -t ' . PTS_CORE_PATH . 'phoromatic/public_html/ > /dev/null 2>> $PTS_PHOROMATIC_LOG_LOCATION &' . PHP_EOL;
                    //2> /dev/null
                }
            }
        }
        $server_launcher .= 'http_server_pid=$!' . PHP_EOL;
        $server_launcher .= 'sleep 1' . PHP_EOL;
        $server_launcher .= 'echo "The Phoromatic Web Interface Is Accessible At: http://localhost:' . $web_port . '"' . PHP_EOL;
        $pts_logger->log('Starting HTTP process @ http://localhost:' . $web_port);
        // Avahi for zeroconf network discovery support
        if (pts_config::read_user_config('PhoronixTestSuite/Options/Server/AdvertiseServiceZeroConf', 'TRUE')) {
            if (is_dir('/etc/avahi/services') && is_writable('/etc/avahi/services')) {
                file_put_contents('/etc/avahi/services/phoromatic-server.service', '<?xml version="1.0" standalone=\'no\'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
  <name replace-wildcards="yes">phoromatic-server-%h</name>
  <service>
    <type>_http._tcp</type>
    <port>' . $web_port . '</port>
  </service>
</service-group>');
            } else {
                if (pts_client::executable_in_path('avahi-publish')) {
                    $hostname = phodevi::read_property('system', 'hostname');
                    $hostname = $hostname == null ? rand(0, 99) : $hostname;
                    $server_launcher .= 'avahi-publish -s phoromatic-server-' . $hostname . ' _http._tcp ' . $web_port . ' "Phoronix Test Suite Phoromatic" > /dev/null 2> /dev/null &' . PHP_EOL;
                    $server_launcher .= 'avahi_publish_pid=$!' . PHP_EOL;
                }
            }
        }
        // Wait for input to shutdown process..
        if (!PTS_IS_DAEMONIZED_SERVER_PROCESS) {
            $server_launcher .= PHP_EOL . 'echo -n "Press [ENTER] to kill server..."' . PHP_EOL;
            $server_launcher .= PHP_EOL . 'read var_name';
        } else {
            $server_launcher .= PHP_EOL . 'while [ ! -f "/var/lib/phoronix-test-suite/end-phoromatic-server" ];';
            $server_launcher .= PHP_EOL . 'do';
            $server_launcher .= PHP_EOL . 'sleep 1';
            $server_launcher .= PHP_EOL . 'done';
            $server_launcher .= PHP_EOL . 'rm -f /var/lib/phoronix-test-suite/end-phoromatic-server' . PHP_EOL;
        }
        // Shutdown / Kill Servers
        $server_launcher .= PHP_EOL . 'kill $http_server_pid';
        $server_launcher .= PHP_EOL . 'kill $websocket_server_pid';
        $server_launcher .= PHP_EOL . 'kill $event_server_pid';
        if (is_writable('/etc/avahi/services') && is_file('/etc/avahi/services/phoromatic-server.service')) {
            $server_launcher .= PHP_EOL . 'rm -f /etc/avahi/services/phoromatic-server.service';
        } else {
            $server_launcher .= PHP_EOL . 'kill $avahi_publish_pid';
        }
        $server_launcher .= PHP_EOL . 'rm -f ~/.phoronix-test-suite/run-lock*';
        file_put_contents(getenv('PTS_EXT_LAUNCH_SCRIPT_DIR') . '/phoromatic-server-launcher', $server_launcher);
    }
 public static function test_profile_system_compatibility_check(&$test_profile, $report_errors = false)
 {
     $valid_test_profile = true;
     $test_type = $test_profile->get_test_hardware_type();
     $skip_tests = pts_client::read_env('SKIP_TESTS') ? pts_strings::comma_explode(pts_client::read_env('SKIP_TESTS')) : false;
     $skip_test_subsystems = pts_client::read_env('SKIP_TESTING_SUBSYSTEMS') ? pts_strings::comma_explode(strtolower(pts_client::read_env('SKIP_TESTING_SUBSYSTEMS'))) : false;
     $display_driver = phodevi::read_property('system', 'display-driver');
     $gpu = phodevi::read_name('gpu');
     if ($test_profile->is_supported(false) == false) {
         $valid_test_profile = false;
     } else {
         if ($test_type == 'Graphics' && pts_client::read_env('DISPLAY') == false && pts_client::read_env('WAYLAND_DISPLAY') == false && phodevi::is_windows() == false && phodevi::is_macosx() == false) {
             $report_errors && pts_client::$display->test_run_error('No display server was found, cannot run ' . $test_profile);
             $valid_test_profile = false;
         } else {
             if ($test_type == 'Graphics' && in_array($display_driver, array('vesa', 'nv', 'cirrus')) && stripos($gpu, 'LLVM') === false) {
                 // These display drivers end up being in known configurations without 3D hardware support so unless an LLVM-based string is reported as the GPU, don't advertise 3D tests
                 $report_errors && pts_client::$display->test_run_error('3D acceleration support not available, cannot run ' . $test_profile);
                 $valid_test_profile = false;
             } else {
                 if ($test_type == 'Disk' && stripos(phodevi::read_property('system', 'filesystem'), 'SquashFS') !== false) {
                     $report_errors && pts_client::$display->test_run_error('Running on a RAM-based live file-system, cannot run ' . $test_profile);
                     $valid_test_profile = false;
                 } else {
                     if (pts_client::read_env('NO_' . strtoupper($test_type) . '_TESTS') || $skip_tests && (in_array($test_profile, $skip_tests) || in_array($test_type, $skip_tests) || in_array($test_profile->get_identifier(false), $skip_tests) || in_array($test_profile->get_identifier_base_name(), $skip_tests))) {
                         $report_errors && pts_client::$display->test_run_error('Due to a pre-set environmental variable, skipping ' . $test_profile);
                         $valid_test_profile = false;
                     } else {
                         if ($skip_test_subsystems && in_array(strtolower($test_profile->get_test_hardware_type()), $skip_test_subsystems)) {
                             $report_errors && pts_client::$display->test_run_error('Due to a pre-set environmental variable, skipping ' . $test_profile);
                             $valid_test_profile = false;
                         } else {
                             if ($test_profile->is_root_required() && $this->batch_mode && phodevi::is_root() == false) {
                                 $report_errors && pts_client::$display->test_run_error('Cannot run ' . $test_profile . ' in batch mode as root access is required.');
                                 $valid_test_profile = false;
                             }
                         }
                     }
                 }
             }
         }
     }
     if ($valid_test_profile == false && pts_client::read_env('SKIP_ALL_TEST_SUPPORT_CHECKS')) {
         $report_errors && pts_client::$display->test_run_error('SKIP_ALL_TEST_SUPPORT_CHECKS is set for ' . $test_profile . '.');
         $valid_test_profile = true;
     }
     return $valid_test_profile;
 }
Пример #12
0
 public static function run($r)
 {
     pts_openbenchmarking::refresh_repository_lists();
     pts_client::$display->generic_heading('Interactive Benchmarking');
     echo 'System Hardware:' . PHP_EOL . phodevi::system_hardware(true) . (phodevi::read_property('motherboard', 'serial-number') != null ? PHP_EOL . 'System Serial Number: ' . phodevi::read_property('motherboard', 'serial-number') : null) . PHP_EOL . PHP_EOL . PHP_EOL;
     $reboot_on_exit = false;
     do {
         $options = array('RUN_TEST' => 'Run A Test', 'RUN_SUITE' => 'Run A Suite [A Collection Of Tests]', 'RUN_SYSTEM_TEST' => 'Run Complex System Test', 'SHOW_INFO' => 'Show System Hardware / Software Information', 'SHOW_SENSORS' => 'Show Auto-Detected System Sensors', 'SET_RUN_COUNT' => 'Set Test Run Repetition');
         if (count(pts_client::saved_test_results()) > 0) {
             $options['BACKUP_RESULTS_TO_USB'] = 'Backup Results To Media Storage';
         }
         $options['EXIT'] = $reboot_on_exit ? 'Exit & Reboot' : 'Exit';
         $response = pts_user_io::prompt_text_menu('Select Task', $options, false, true);
         switch ($response) {
             case 'RUN_TEST':
                 $supported_tests = pts_openbenchmarking::available_tests();
                 $supported_tests = pts_types::identifiers_to_test_profile_objects($supported_tests, false, true);
                 $longest_title_length = 0;
                 foreach ($supported_tests as $i => &$test_profile) {
                     if ($test_profile->get_title() == null) {
                         unset($supported_tests[$i]);
                         continue;
                     }
                     $longest_title_length = max($longest_title_length, strlen($test_profile->get_title()));
                 }
                 $t = array();
                 foreach ($supported_tests as $i => &$test_profile) {
                     if ($test_profile instanceof pts_test_profile) {
                         $t[$test_profile->get_identifier()] = sprintf('%-' . ($longest_title_length + 1) . 'ls - %-10ls', $test_profile->get_title(), $test_profile->get_test_hardware_type());
                     }
                 }
                 $supported_tests = $t;
                 asort($supported_tests);
                 $tests_to_run = pts_user_io::prompt_text_menu('Select Test', $supported_tests, true, true);
                 $tests_to_run = explode(',', $tests_to_run);
                 pts_test_installer::standard_install($tests_to_run);
                 $run_manager = new pts_test_run_manager(false, 2);
                 $run_manager->standard_run($tests_to_run);
                 if ($run_manager != false) {
                     pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $run_manager->get_file_name() . '/index.html', null, true, true);
                 }
                 break;
             case 'RUN_SUITE':
                 $possible_suites = pts_openbenchmarking::available_suites();
                 foreach (array_map('strtolower', pts_types::subsystem_targets()) as $subsystem) {
                     array_push($possible_suites, 'pts/' . $subsystem);
                 }
                 $suites_to_run = pts_user_io::prompt_text_menu('Select Suite', $possible_suites, true);
                 foreach (explode(',', $suites_to_run) as $suite_to_run) {
                     pts_test_installer::standard_install($suite_to_run);
                     $run_manager = new pts_test_run_manager(false, 2);
                     $run_manager->standard_run($suite_to_run);
                 }
                 break;
             case 'SELECT_DRIVE_MOUNT':
                 self::select_drive_mount();
                 break;
             case 'RUN_SYSTEM_TEST':
                 pts_client::$display->generic_heading('System Test');
                 $system_tests = array('apache', 'c-ray', 'ramspeed', 'postmark');
                 pts_test_installer::standard_install($system_tests);
                 $run_manager = new pts_test_run_manager(false, 2);
                 $run_manager->standard_run($system_tests);
                 if ($run_manager != false) {
                     pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $run_manager->get_file_name() . '/index.html', null, true, true);
                 }
                 break;
             case 'SHOW_INFO':
                 pts_client::$display->generic_heading('System Software / Hardware Information');
                 echo 'Hardware:' . PHP_EOL . phodevi::system_hardware(true) . PHP_EOL . PHP_EOL;
                 echo 'Software:' . PHP_EOL . phodevi::system_software(true) . PHP_EOL . PHP_EOL;
                 break;
             case 'SHOW_SENSORS':
                 pts_client::$display->generic_heading('Detected System Sensors');
                 foreach (phodevi::supported_sensors() as $sensor) {
                     echo phodevi::sensor_name($sensor) . ': ' . phodevi::read_sensor($sensor) . ' ' . phodevi::read_sensor_unit($sensor) . PHP_EOL;
                 }
                 break;
             case 'SET_RUN_COUNT':
                 $run_count = pts_user_io::prompt_user_input('Set the minimum number of times each test should repeat', false);
                 putenv('FORCE_TIMES_TO_RUN=' . trim($run_count));
                 break;
             case 'BACKUP_RESULTS_TO_USB':
                 pts_client::$display->generic_heading('Backing Up Test Results');
                 foreach (pts_file_io::glob('/media/*') as $media_dir) {
                     if (!is_writable($media_dir)) {
                         echo PHP_EOL . $media_dir . ' is not writable.' . PHP_EOL;
                         continue;
                     }
                     echo PHP_EOL . 'Writing Test Results To: ' . $media_dir . PHP_EOL;
                     pts_file_io::copy(PTS_SAVE_RESULTS_PATH, $media_dir . '/');
                     break;
                 }
                 break;
         }
         echo PHP_EOL . PHP_EOL;
     } while ($response != 'EXIT');
     if ($reboot_on_exit) {
         if (is_dir('/media/pts-auto-mount')) {
             pts_file_io::delete('/media/pts-auto-mount/pts', null, true);
             exec('umount /media/pts-auto-mount 2>&1');
         }
         exec('reboot');
     }
 }
 public static function sw_display_driver($with_version = true)
 {
     if (phodevi::is_windows()) {
         return null;
     }
     $display_driver = phodevi::read_property('system', 'dri-display-driver');
     if (empty($display_driver)) {
         if (phodevi::is_ati_graphics() && phodevi::is_linux()) {
             $display_driver = 'fglrx';
         } else {
             if (phodevi::is_nvidia_graphics() || is_file('/proc/driver/nvidia/version')) {
                 $display_driver = 'nvidia';
             } else {
                 if ((phodevi::is_mesa_graphics() || phodevi::is_bsd()) && stripos(phodevi::read_property('gpu', 'model'), 'NVIDIA') !== false) {
                     if (is_file('/sys/class/drm/version')) {
                         // If there's DRM loaded and NVIDIA, it should be Nouveau
                         $display_driver = 'nouveau';
                     } else {
                         // The dead xf86-video-nv doesn't use any DRM
                         $display_driver = 'nv';
                     }
                 } else {
                     // Fallback to hopefully detect the module, takes the first word off the GPU string and sees if it is the module
                     // This works in at least the case of the Cirrus driver
                     $display_driver = strtolower(pts_strings::first_in_string(phodevi::read_property('gpu', 'model')));
                 }
             }
         }
     }
     if (!empty($display_driver)) {
         $driver_version = phodevi_parser::read_xorg_module_version($display_driver . '_drv');
         if ($driver_version == false || $driver_version == '1.0.0') {
             switch ($display_driver) {
                 case 'amd':
                     // See if it's radeon driver
                     $driver_version = phodevi_parser::read_xorg_module_version('radeon_drv');
                     if ($driver_version != false) {
                         $display_driver = 'radeon';
                     }
                     break;
                 case 'vmwgfx':
                     // See if it's VMware driver
                     $driver_version = phodevi_parser::read_xorg_module_version('vmware_drv');
                     if ($driver_version != false) {
                         $display_driver = 'vmware';
                     }
                     break;
                 case 'radeon':
                     // RadeonHD driver also reports DRI driver as 'radeon', so try reading that instead
                     $driver_version = phodevi_parser::read_xorg_module_version('radeonhd_drv');
                     if ($driver_version != false) {
                         $display_driver = 'radeonhd';
                     }
                     break;
                 case 'nvidia':
                 case 'NVIDIA':
                 case 'nouveau':
                     // NVIDIA's binary driver usually ends up reporting 1.0.0
                     if ($nvs_value = phodevi_parser::read_nvidia_extension('NvidiaDriverVersion')) {
                         $display_driver = 'NVIDIA';
                         $driver_version = $nvs_value;
                     } else {
                         // NVIDIA's binary driver appends their driver version on the end of the OpenGL version string
                         $glxinfo = phodevi_parser::software_glxinfo_version();
                         if (($pos = strpos($glxinfo, 'NVIDIA ')) != false) {
                             $display_driver = 'NVIDIA';
                             $driver_version = substr($glxinfo, $pos + 7);
                         }
                     }
                     break;
                 default:
                     if (is_readable('/sys/class/graphics/fb0/name')) {
                         // This path works for at least finding NVIDIA Tegra 2 DDX (via tegra_fb)
                         $display_driver = file_get_contents('/sys/class/graphics/fb0/name');
                         $display_driver = str_replace(array('drm', '_fb'), null, $display_driver);
                         $driver_version = phodevi_parser::read_xorg_module_version($display_driver . '_drv');
                     }
                     break;
             }
         }
         if ($driver_version == false) {
             // If the version is empty, chances are the DDX driver string is incorrect
             $display_driver = null;
             // See if the VESA or fbdev driver is in use
             foreach (array('modesetting', 'fbdev', 'vesa') as $drv) {
                 $drv_version = phodevi_parser::read_xorg_module_version($drv . '_drv');
                 if ($drv_version) {
                     $display_driver = $drv;
                     $driver_version = $drv_version;
                     break;
                 }
             }
         }
         if (!empty($driver_version) && $with_version && $driver_version != '0.0.0') {
             $display_driver .= ' ' . $driver_version;
             // XXX: The below check is disabled since the Catalyst Version no longer seems reliably reported (circa Catalyst 13.x)
             if (false && phodevi::is_ati_graphics() && strpos($display_driver, 'fglrx') !== false) {
                 $catalyst_version = phodevi_linux_parser::read_amd_pcsdb('AMDPCSROOT/SYSTEM/LDC,Catalyst_Version');
                 if ($catalyst_version != null && $catalyst_version > 10.1 && $catalyst_version != 10.5 && $catalyst_version != 11.8) {
                     // This option was introduced around Catalyst 10.5 but seems to not be updated properly until Catalyst 10.11/10.12
                     $display_driver .= ' Catalyst ' . $catalyst_version . '';
                 }
             }
         }
     }
     return $display_driver;
 }
    public static function render_page_process($PATH)
    {
        $COMPONENT = trim(str_replace('%20', ' ', $PATH[0]));
        switch ($COMPONENT) {
            case 'CPU':
                $model = phodevi::read_property('cpu', 'model');
                $ob_type = 'Processor';
                $sensor_flag = 'all.cpu';
                $cpu_flags = phodevi_cpu::get_cpu_flags();
                $features = array(array('Frequency', phodevi::read_property('cpu', 'mhz-default-frequency') . ' MHz'), array('Core Count', phodevi_cpu::cpuinfo_core_count()), array('Thread Count', phodevi_cpu::cpuinfo_thread_count()), array('Cache Size', phodevi_cpu::cpuinfo_cache_size() . ' KB'), array('Instruction Set Extensions', phodevi_cpu::instruction_set_extensions()), array('AES Encryption', $cpu_flags & phodevi_cpu::get_cpu_feature_constant('aes') ? 'YES' : 'NO'), array('Energy Performance Bias', $cpu_flags & phodevi_cpu::get_cpu_feature_constant('epb') ? 'YES' : 'NO'), array('Virtualization', phodevi_cpu::virtualization_technology() ? phodevi_cpu::virtualization_technology() : 'NO'), array('Scaling Governor', phodevi::read_property('cpu', 'scaling-governor')));
                $software_features = array();
                break;
            case 'GPU':
                $model = phodevi::read_property('gpu', 'model');
                $ob_type = 'Graphics';
                $sensor_flag = 'all.gpu';
                $features = array(array('Frequency', implode(' / ', phodevi::read_property('gpu', 'stock-frequency')) . ' MHz'), array('vRAM Capacity', phodevi::read_property('gpu', 'memory-capacity') . ' MB'), array('Compute Cores', phodevi::read_property('gpu', 'compute-cores')), array('Screen Resolution', phodevi::read_property('gpu', 'screen-resolution-string')), array('2D Acceleration', phodevi::read_property('gpu', '2d-acceleration')));
                $software_features = array(array('Video Driver', phodevi::read_property('system', 'display-driver-string')), array('OpenGL Driver', phodevi::read_property('system', 'opengl-driver')), array('Kernel', phodevi::read_property('system', 'kernel')), array('Video Drivers', phodevi::read_property('system', 'display-driver-string')), array('Display Server', phodevi::read_property('system', 'display-server')));
                break;
            case 'Motherboard':
                $model = phodevi::read_property('motherboard', 'identifier');
                $ob_type = 'System';
                $sensor_flag = 'all.sys';
                $features = array(array('Chipset', phodevi::read_property('chipset', 'identifier')), array('Serial Number', phodevi::read_property('motherboard', 'serial-number')), array('Network', phodevi::read_property('network', 'identifier')), array('Audio', phodevi::read_property('audio', 'identifier')));
                $software_features = array();
                break;
            case 'Disk':
                $model = phodevi::read_property('disk', 'identifier');
                $ob_type = 'Disk';
                $sensor_flag = 'all.hdd';
                $mo = phodevi::read_property('disk', 'mount-options');
                $mo = isset($mo['mount-options']) ? $mo['mount-options'] : null;
                $features = array(array('I/O Scheduler', phodevi::read_property('disk', 'scheduler')), array('Mount Options', $mo), array('File-System', phodevi::read_property('system', 'filesystem')));
                $software_features = array();
                break;
            case 'Memory':
                $model = phodevi::read_property('memory', 'identifier');
                $ob_type = 'Memory';
                $sensor_flag = 'all.memory';
                $features = array();
                $software_features = array();
                break;
            case 'Software':
                $model = phodevi::read_property('system', 'operating-system');
                $ob_type = '';
                $sensor_flag = 'all.sys';
                $features = array(array('Kernel', phodevi::read_property('system', 'kernel-string')), array('Compiler', phodevi::read_property('system', 'compiler')), array('Desktop', phodevi::read_property('system', 'desktop-environment')), array('Display Server', phodevi::read_property('system', 'display-server')), array('Display Driver', phodevi::read_property('system', 'display-driver-string')), array('OpenGL Driver', phodevi::read_property('system', 'opengl-driver')), array('File-System', phodevi::read_property('system', 'filesystem')), array('System Layer', phodevi::read_property('system', 'system-layer')));
                $software_features = array(array('Kernel Parameters', phodevi::read_property('system', 'kernel-parameters')), array('Hostname', phodevi::read_property('system', 'hostname')), array('Local IP Address', $_SERVER['HTTP_HOST']));
                break;
        }
        echo '<h1>' . $model . '</h1>';
        echo '<div id="pts_side_pane" style="max-width: 30%;">';
        if (!empty($features)) {
            echo '<h2>' . $COMPONENT . ' Features</h2>';
            echo '<ul>';
            foreach ($features as $feature) {
                if (isset($feature[1])) {
                    $feature[0] .= ':';
                    if ($feature[1] == null) {
                        $feature[1] = 'N/A';
                    }
                }
                $feature[0] = '<strong>' . $feature[0] . '</strong>';
                echo '<li>' . implode(' ', $feature) . '</li>' . PHP_EOL;
            }
            echo '</ul>';
            echo '<hr />';
        }
        if (!empty($software_features)) {
            echo '<h2>' . $COMPONENT . ' Software Features</h2>';
            echo '<ul>';
            foreach ($software_features as $feature) {
                if (isset($feature[1])) {
                    $feature[0] .= ':';
                    if ($feature[1] == null) {
                        $feature[1] = 'N/A';
                    }
                }
                $feature[0] = '<strong>' . $feature[0] . '</strong>';
                echo '<li>' . implode(' ', $feature) . '</li>' . PHP_EOL;
            }
            echo '</ul>';
            echo '<hr />';
        }
        echo '<div class="pts_pane_window">Log-in to OpenBenchmarking.org to gain access to more functionality.</div>';
        echo '</div>';
        echo '<div id="svg_graphs" style="margin: 10px 0; text-align: right;"></div>';
        echo '<div id="tests_by_popularity" style="margin: 10px 0; text-align: left;"></div>';
        echo '<div id="system_log_viewer"><select id="log_viewer_selector" onchange="javascript:log_viewer_change(); return true;"></select><div id="system_log_display"></div></div>';
        echo '<script text="text/javascript">
			pts_web_socket.submit_event("user-svg-system-graphs ' . $sensor_flag . '", "svg_graphs", "update_svg_graph_space");
			pts_web_socket.submit_event("available-system-logs System ' . $COMPONENT . '", "available_system_logs", "update_system_log_viewer");
			pts_web_socket.submit_event("tests-by-popularity 6 ' . $ob_type . '", "tests_by_popularity", "tests_by_popularity_display");

			setInterval(function(){if(pts_web_socket.is_connected()) { pts_web_socket.send("user-svg-system-graphs ' . $sensor_flag . '"); }},1000);
		</script>';
    }
Пример #15
0
 public static function run($r)
 {
     $is_moscow = pts_flags::os_identifier_hash() == 'b28d6a7148b34595c5b397dfcf5b12ac7932b3dc';
     if ($is_moscow) {
         // Auto mount?
         $drives = pts_file_io::glob('/dev/sda*');
         sort($drives);
         if (false && count($drives) > 0 && !is_dir('/media/pts-auto-mount') && is_writable('/media/')) {
             $last_drive = array_pop($drives);
             echo PHP_EOL . 'Attempting to auto-mount drive: ' . $last_drive . PHP_EOL;
             mkdir('/media/pts-auto-mount');
             exec('mount ' . $last_drive . ' /media/pts-auto-mount');
             putenv('PTS_TEST_INSTALL_ROOT_PATH=/media/pts-auto-mount/');
         }
         // Auto save results
         $test_results_name = phodevi::read_property('motherboard', 'serial-number');
         if ($test_results_name == null) {
             $test_results_name = phodevi::read_name('motherboard');
         }
         if ($test_results_name == null) {
             $test_results_name = phodevi::read_property('system', 'vendor-identifier');
         }
         putenv('TEST_RESULTS_NAME=' . str_replace(' ', null, $test_results_name));
         putenv('TEST_RESULTS_IDENTIFIER=' . $test_results_name);
         putenv('TEST_RESULTS_DESCRIPTION=Tests using ' . phodevi::read_property('system', 'operating-system') . ' on ' . date('d F Y') . ' of ' . $test_results_name . '.');
         self::select_drive_mount();
     }
     pts_openbenchmarking::refresh_repository_lists();
     pts_client::$display->generic_heading('Interactive Benchmarking');
     echo 'System Hardware:' . PHP_EOL . phodevi::system_hardware(true) . (phodevi::read_property('motherboard', 'serial-number') != null ? PHP_EOL . 'System Serial Number: ' . phodevi::read_property('motherboard', 'serial-number') : null) . PHP_EOL . PHP_EOL . PHP_EOL;
     $reboot_on_exit = pts_flags::is_live_cd() && pts_client::user_home_directory() == '/root/';
     do {
         $options = array('RUN_TEST' => 'Run A Test', 'RUN_SUITE' => 'Run A Suite [A Collection Of Tests]', 'RUN_SYSTEM_TEST' => 'Run Complex System Test', 'SHOW_INFO' => 'Show System Hardware / Software Information', 'SHOW_SENSORS' => 'Show Auto-Detected System Sensors', 'SET_RUN_COUNT' => 'Set Test Run Repetition');
         if ($is_moscow) {
             unset($options['RUN_SUITE']);
             //	$options['SELECT_DRIVE_MOUNT'] = 'Select Disk Drive To Use For Testing';
         }
         if (count(pts_client::saved_test_results()) > 0) {
             $options['BACKUP_RESULTS_TO_USB'] = 'Backup Results To Media Storage';
         }
         $options['EXIT'] = $reboot_on_exit ? 'Exit & Reboot' : 'Exit';
         $response = pts_user_io::prompt_text_menu('Select Task', $options, false, true);
         switch ($response) {
             case 'RUN_TEST':
                 $supported_tests = pts_openbenchmarking::available_tests();
                 $supported_tests = pts_types::identifiers_to_test_profile_objects($supported_tests, false, true);
                 $longest_title_length = 0;
                 foreach ($supported_tests as $i => &$test_profile) {
                     if ($test_profile->get_title() == null || pts_test_run_manager::test_profile_system_compatibility_check($test_profile) == false) {
                         unset($supported_tests[$i]);
                         continue;
                     }
                     if ($is_moscow && pts_test_install_request::test_files_available_locally($test_profile) == false) {
                         // Don't show tests where files need to be downloaded
                         unset($supported_tests[$i]);
                         continue;
                     }
                     $longest_title_length = max($longest_title_length, strlen($test_profile->get_title()));
                 }
                 $t = array();
                 foreach ($supported_tests as $i => &$test_profile) {
                     if ($test_profile instanceof pts_test_profile) {
                         $t[$test_profile->get_identifier()] = sprintf('%-' . ($longest_title_length + 1) . 'ls - %-10ls', $test_profile->get_title(), $test_profile->get_test_hardware_type());
                     }
                 }
                 $supported_tests = $t;
                 asort($supported_tests);
                 $tests_to_run = pts_user_io::prompt_text_menu('Select Test', $supported_tests, true, true);
                 $tests_to_run = explode(',', $tests_to_run);
                 pts_test_installer::standard_install($tests_to_run);
                 $run_manager = pts_test_run_manager::standard_run($tests_to_run, pts_c::defaults_mode | pts_c::auto_mode);
                 if ($run_manager != false) {
                     pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $run_manager->get_file_name() . '/index.html', null, true, true);
                 }
                 break;
             case 'RUN_SUITE':
                 $possible_suites = pts_openbenchmarking::available_suites();
                 foreach (array_map('strtolower', pts_types::subsystem_targets()) as $subsystem) {
                     array_push($possible_suites, 'pts/' . $subsystem);
                 }
                 $suites_to_run = pts_user_io::prompt_text_menu('Select Suite', $possible_suites, true);
                 foreach (explode(',', $suites_to_run) as $suite_to_run) {
                     pts_test_installer::standard_install($suite_to_run);
                     pts_test_run_manager::standard_run($suite_to_run, pts_c::defaults_mode | pts_c::auto_mode);
                 }
                 break;
             case 'SELECT_DRIVE_MOUNT':
                 self::select_drive_mount();
                 break;
             case 'RUN_SYSTEM_TEST':
                 pts_client::$display->generic_heading('System Test');
                 $system_tests = array('apache', 'c-ray', 'ramspeed', 'postmark');
                 pts_test_installer::standard_install($system_tests);
                 $run_manager = pts_test_run_manager::standard_run($system_tests, pts_c::defaults_mode | pts_c::auto_mode);
                 if ($run_manager != false) {
                     pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $run_manager->get_file_name() . '/index.html', null, true, true);
                 }
                 break;
             case 'SHOW_INFO':
                 pts_client::$display->generic_heading('System Software / Hardware Information');
                 echo 'Hardware:' . PHP_EOL . phodevi::system_hardware(true) . PHP_EOL . PHP_EOL;
                 echo 'Software:' . PHP_EOL . phodevi::system_software(true) . PHP_EOL . PHP_EOL;
                 break;
             case 'SHOW_SENSORS':
                 pts_client::$display->generic_heading('Detected System Sensors');
                 foreach (phodevi::supported_sensors() as $sensor) {
                     echo phodevi::sensor_name($sensor) . ': ' . phodevi::read_sensor($sensor) . ' ' . phodevi::read_sensor_unit($sensor) . PHP_EOL;
                 }
                 break;
             case 'SET_RUN_COUNT':
                 $run_count = pts_user_io::prompt_user_input('Set the minimum number of times each test should repeat', false);
                 putenv('FORCE_TIMES_TO_RUN=' . trim($run_count));
                 break;
             case 'BACKUP_RESULTS_TO_USB':
                 pts_client::$display->generic_heading('Backing Up Test Results');
                 if ($is_moscow) {
                     $drives = pts_file_io::glob('/dev/sd*');
                     sort($drives);
                     if (count($drives) > 0 && is_writable('/media/')) {
                         $select_drive = pts_user_io::prompt_text_menu('Select Drive / Partition To Save Results', $drives);
                         echo PHP_EOL . 'Attempting to mount: ' . $select_drive . PHP_EOL;
                         mkdir('/media/00-results-backup');
                         exec('mount ' . $select_drive . ' /media/00-results-backup');
                     }
                 }
                 foreach (pts_file_io::glob('/media/*') as $media_dir) {
                     if (!is_writable($media_dir)) {
                         echo PHP_EOL . $media_dir . ' is not writable.' . PHP_EOL;
                         continue;
                     }
                     echo PHP_EOL . 'Writing Test Results To: ' . $media_dir . PHP_EOL;
                     pts_file_io::copy(PTS_SAVE_RESULTS_PATH, $media_dir . '/');
                     break;
                 }
                 if ($is_moscow && is_dir('/media/00-results-backup')) {
                     exec('umount /media/00-results-backup');
                     rmdir('/media/00-results-backup');
                 }
                 break;
         }
         echo PHP_EOL . PHP_EOL;
     } while ($response != 'EXIT');
     if ($reboot_on_exit) {
         if (is_dir('/media/pts-auto-mount')) {
             pts_file_io::delete('/media/pts-auto-mount/pts', null, true);
             exec('umount /media/pts-auto-mount 2>&1');
         }
         exec('reboot');
     }
 }
 private static function vendor_identifier($type)
 {
     $os_vendor = phodevi::read_property('system', 'vendor-identifier');
     switch ($type) {
         case 'package-list':
             $file_check_success = is_file(PTS_EXDEP_PATH . 'xml/' . $os_vendor . '-packages.xml');
             break;
         case 'installer':
             $file_check_success = is_file(PTS_EXDEP_PATH . 'scripts/install-' . $os_vendor . '-packages.sh');
             break;
     }
     if ($file_check_success == false) {
         // Check the aliases to figure out the upstream distribution
         $os_vendor = false;
         $exdep_generic_parser = new pts_exdep_generic_parser();
         foreach ($exdep_generic_parser->get_vendors_list() as $this_vendor) {
             $exdep_platform_parser = new pts_exdep_platform_parser($this_vendor);
             $aliases = $exdep_platform_parser->get_aliases();
             if (in_array($os_vendor, $aliases)) {
                 $os_vendor = $this_vendor;
                 break;
             }
         }
         if ($os_vendor == false) {
             // Attempt to match the current operating system by seeing what package manager matches
             foreach ($exdep_generic_parser->get_vendors_list() as $this_vendor) {
                 $exdep_platform_parser = new pts_exdep_platform_parser($this_vendor);
                 $package_manager = $exdep_platform_parser->get_package_manager();
                 if ($package_manager != null && pts_client::executable_in_path($package_manager)) {
                     $os_vendor = $this_vendor;
                     break;
                 }
             }
         }
     }
     return $os_vendor;
 }
Пример #17
0
    public static function render_page_process($PATH)
    {
        echo '<div style="background: #CCC; padding: 10px; margin: 10px 20px;">Thanks for trying out the Phoronix Test Suite GUI. With Phoronix Test Suite 5.0 the GUI is still considered in an <strong>experimental / tech preview state</strong>. The GUI should be more end-user friendly and reach feature parity with the command-line interface in forthcoming releases. Your feedback is appreciated on the GUI while the command-line interface continues to be our primary focus along with remotely-managed enterprise features like <a href="http://www.phoromatic.com/">Phoromatic</a> and <a href="http://openbenchmarking.org/">OpenBenchmarking.org</a>. <a href="/early">Read more details on the GUI</a>.</div>';
        echo '<h1>' . pts_core::program_title(false) . '</h1>';
        echo '<div id="pts_side_pane">';
        $hw_component_modal = array('CPU' => phodevi::read_property('cpu', 'model'), 'Motherboard' => phodevi::read_property('motherboard', 'identifier'), 'Memory' => phodevi::read_property('memory', 'identifier'), 'Disk' => phodevi::read_property('disk', 'identifier'), 'GPU' => phodevi::read_property('gpu', 'model'));
        echo '<ul>';
        foreach ($hw_component_modal as $type => $component) {
            echo '<a href="/?component/' . $type . '"><li>' . $component . '</li></a>';
        }
        echo '</ul>';
        echo '<hr />';
        $sw_component_modal = array(1 => phodevi::read_property('system', 'operating-system'), 2 => phodevi::read_property('system', 'kernel-string'), 3 => phodevi::read_property('system', 'display-driver-string'), 4 => phodevi::read_property('system', 'opengl-driver'), 5 => phodevi::read_property('system', 'compiler'));
        echo '<ul>';
        foreach ($sw_component_modal as $type => $component) {
            echo '<a href="/?component/Software"><li>' . $component . '</li></a>';
        }
        echo '</ul>';
        echo '<div class="pts_pane_window"><strong>OpenBenchmarking.org</strong><br />Log-in to gain access to additional features.</div>';
        echo '<ul>';
        echo '<a href="/?settings"><li>Software Settings</li></a>';
        echo '<a href="/?about"><li>About The Phoronix Test Suite</li></a>';
        echo '</ul>';
        echo '</div>';
        echo '<div id="pts_search_bar">';
        echo 'SEARCH: <input type="text" size="30" id="pts_search" name="search" onkeydown="if(event.keyCode == 13) { if(document.getElementById(\'pts_search\').value.length < 3) { alert(\'Please enter a longer search query.\'); return false; } else { window.location.href = \'/?search/\' + document.getElementById(\'pts_search\').value; } return false; }" />';
        echo '</div>';
        // Graphs
        echo '<div id="svg_graphs" style="margin: 10px 0; text-align: right;"></div>';
        echo '<div style="overflow: hidden;">';
        echo '<div class="pts_list_box">';
        $results = pts_tests::test_results_by_date();
        $result_count = count($results);
        $results = array_slice($results, 0, 10, true);
        echo '<ol>';
        echo '<li><u>Recent Benchmark Results</u></li>';
        foreach ($results as $result) {
            $result_file = new pts_result_file($result);
            echo '<a href="?result/' . $result . '"><li>' . $result_file->get_title() . '</li></a>';
        }
        echo '<a href="?results"><li><strong>' . $result_count . ' Results Saved</strong></li></a>';
        echo '</ol>';
        echo '</div>';
        echo '<div class="pts_list_box">';
        $tests = pts_openbenchmarking_client::recently_updated_tests(10);
        echo '<ol>';
        echo '<li><u>Recently Updated Tests</u></li>';
        foreach ($tests as $test) {
            $test_profile = new pts_test_profile($test);
            echo '<a href="?test/' . $test . '"><li>' . $test_profile->get_title() . '</li></a>';
        }
        echo '<a href="?tests"><li><strong>' . pts_openbenchmarking_client::tests_available() . ' Tests Available</strong></li></a>';
        echo '</ol>';
        echo '</div>';
        echo '<div class="pts_list_box">';
        $tests = pts_openbenchmarking_client::popular_tests(10);
        echo '<ol>';
        echo '<li><u>Most Popular Tests</u></li>';
        foreach ($tests as $test) {
            $test_profile = new pts_test_profile($test);
            echo '<a href="?test/' . $test . '"><li>' . $test_profile->get_title() . '</li></a>';
        }
        echo '<a href="?tests"><li><strong>' . pts_openbenchmarking_client::tests_available() . ' Tests Available</strong></li></a>';
        echo '</ol>';
        echo '</div>';
        echo '</div>';
        echo '<script text="text/javascript">

			pts_web_socket.add_onopen_event("user-svg-system-graphs");
			setInterval(function(){if(pts_web_socket.is_connected()) { pts_web_socket.send("user-svg-system-graphs"); }},1000);
			pts_web_socket.add_onmessage_event("svg_graphs", "update_svg_graph_space");
		</script>';
    }
 public static function __startup()
 {
     $halt_screensaver = pts_module::read_variable('HALT_SCREENSAVER');
     if (!empty($halt_screensaver) && !pts_strings::string_bool($halt_screensaver) || phodevi::read_property('system', 'display-server') == null) {
         return pts_module::MODULE_UNLOAD;
     }
     if (phodevi::is_macosx()) {
         // Right now there doesn't appear to be a better way to disable OS X screensaver automatically...
         return pts_module::MODULE_UNLOAD;
     }
     // GNOME Screensaver?
     if (($gt = pts_client::executable_in_path('gconftool')) != false || ($gt = pts_client::executable_in_path('gconftool-2')) != false) {
         self::$gnome_gconftool = $gt;
     }
     if (self::$gnome_gconftool != false) {
         $is_gnome_screensaver_enabled = trim(shell_exec(self::$gnome_gconftool . ' -g /apps/gnome-screensaver/idle_activation_enabled 2>&1'));
         if ($is_gnome_screensaver_enabled == 'true') {
             // Stop the GNOME Screensaver
             shell_exec(self::$gnome_gconftool . ' --type bool --set /apps/gnome-screensaver/idle_activation_enabled false 2>&1');
             self::$gnome2_screensaver_halted = true;
         }
         $sleep_display_ac = trim(shell_exec(self::$gnome_gconftool . ' -g /apps/gnome-power-manager/timeout/sleep_display_ac 2>&1'));
         if ($sleep_display_ac != 0) {
             // Don't sleep the display when on AC power
             shell_exec(self::$gnome_gconftool . ' --type int --set /apps/gnome-power-manager/timeout/sleep_display_ac 0 2>&1');
             self::$sleep_display_ac = $sleep_display_ac;
         }
     }
     if (pts_client::executable_in_path('qdbus')) {
         // KDE Screensaver?
         $is_kde_screensaver_enabled = trim(shell_exec('qdbus org.freedesktop.ScreenSaver /ScreenSaver org.freedesktop.ScreenSaver.GetActive 2>&1'));
         if ($is_kde_screensaver_enabled == 'true') {
             // Stop the KDE Screensaver
             shell_exec('qdbus org.freedesktop.ScreenSaver  /ScreenSaver SimulateUserActivity 2>&1');
             self::$kde_screensaver_halted = true;
         }
     }
     if (self::$gnome2_screensaver_halted == false && pts_client::executable_in_path('gsettings')) {
         // GNOME 3.x Screensaver?
         $is_gnome3_screensaver_enabled = trim(shell_exec('gsettings get org.gnome.desktop.session idle-delay 2>&1'));
         if (stripos($is_gnome3_screensaver_enabled, 'no such key') === false && pts_strings::last_in_string($is_gnome3_screensaver_enabled) > 0) {
             // Stop the GNOME 3.x Screensaver
             shell_exec('gsettings set org.gnome.desktop.session idle-delay 0 2>&1');
             self::$gnome3_screensaver_halted = pts_strings::last_in_string($is_gnome3_screensaver_enabled);
         }
         // GNOME 3.x Lock-Screen
         $is_gnome3_lockscreen_enabled = trim(shell_exec('gsettings get org.gnome.desktop.lockdown disable-lock-screen 2>&1'));
         if (stripos($is_gnome3_lockscreen_enabled, 'no such key') === false && pts_strings::last_in_string($is_gnome3_lockscreen_enabled) == 'false') {
             // Stop the GNOME 3.x Lock Screen
             shell_exec('gsettings set org.gnome.desktop.lockdown disable-lock-screen true 2>&1');
             self::$gnome3_lockscreen_disabled = true;
         }
         // This GNOME3 GSettings method is deprecated on distributions like GNOME 3.8 with Fedora 19
         $is_gnome3_screensaver_enabled_old = trim(shell_exec('gsettings get org.gnome.desktop.screensaver idle-activation-enabled 2>&1'));
         if ($is_gnome3_screensaver_enabled_old == 'true') {
             // Stop the GNOME 3.x Screensaver
             shell_exec('gsettings set org.gnome.desktop.screensaver idle-activation-enabled false 2>&1');
             self::$gnome3_screensaver_halted_old = true;
         }
         // GNOME 3.x Sleep Dispaly?
         $is_gnome3_sleep = trim(shell_exec('gsettings get org.gnome.settings-daemon.plugins.power sleep-display-ac 2>&1'));
         if ($is_gnome3_sleep > 0) {
             // Stop the GNOME 3.x Display Sleep
             shell_exec('gsettings set org.gnome.settings-daemon.plugins.power sleep-display-ac 0 2>&1');
             self::$sleep_display_ac = $is_gnome3_sleep;
         }
     }
     if (pts_client::executable_in_path('xfconf-query')) {
         $is_xfce_screensaver_enabled = stripos(shell_exec('xfconf-query -c xfce4-session -p /startup/screensaver/enabled 2>&1'), 'false') !== false;
         if ($is_xfce_screensaver_enabled) {
             shell_exec('xfconf-query -c xfce4-session -n -t bool -p /startup/screensaver/enabled -s false 2>&1');
             self::$xfce_screensaver_halted = true;
         }
     }
     if (getenv('DISPLAY') != false && (self::$xset = pts_client::executable_in_path('xset'))) {
         shell_exec('xset s off 2>&1');
     } else {
         if (getenv('DISPLAY') == false && pts_client::executable_in_path('setterm')) {
             shell_exec('setterm -powersave off -blank 0 2>&1');
         }
     }
     if (self::$gnome2_screensaver_halted || self::$gnome3_screensaver_halted || self::$gnome3_screensaver_halted_old || self::$kde_screensaver_halted || self::$xfce_screensaver_halted) {
         self::$screensaver_halted = true;
     }
     if (($xdg = pts_client::executable_in_path('xdg-screensaver')) == false) {
         self::$xdg_screensaver_available = $xdg;
     }
     if ($xscreensaver = pts_client::executable_in_path('xscreensaver-command')) {
         shell_exec($xscreensaver . ' -exit 2>&1');
     }
 }
Пример #19
0
 public static function gpu_model()
 {
     // Report graphics processor string
     $info = phodevi_parser::read_glx_renderer();
     $video_ram = phodevi::read_property('gpu', 'memory-capacity');
     if (phodevi::is_ati_graphics() && phodevi::is_linux()) {
         $crossfire_status = phodevi_linux_parser::read_amd_pcsdb('SYSTEM/Crossfire/chain/*,Enable');
         $crossfire_status = pts_arrays::to_array($crossfire_status);
         $crossfire_card_count = 0;
         for ($i = 0; $i < count($crossfire_status); $i++) {
             if ($crossfire_status[$i] == '0x00000001') {
                 $crossfire_card_count += 2;
                 // For now assume each chain is 2 cards, but proper way would be NumSlaves + 1
             }
         }
         $adapters = phodevi_linux_parser::read_amd_graphics_adapters();
         if (count($adapters) > 0) {
             $video_ram = $video_ram > 64 ? ' ' . $video_ram . 'MB' : null;
             // assume more than 64MB of vRAM
             if ($crossfire_card_count > 1 && $crossfire_card_count <= count($adapters)) {
                 $unique_adapters = array_unique($adapters);
                 if (count($unique_adapters) == 1) {
                     if (strpos($adapters[0], 'X2') > 0 && $crossfire_card_count > 1) {
                         $crossfire_card_count -= 1;
                     }
                     $info = $crossfire_card_count . ' x ' . $adapters[0] . $video_ram . ' CrossFire';
                 } else {
                     $info = implode(', ', $unique_adapters) . ' CrossFire';
                 }
             } else {
                 $info = $adapters[0] . $video_ram;
             }
         }
     } else {
         if (phodevi::is_macosx()) {
             $system_profiler_info = implode(' + ', phodevi_osx_parser::read_osx_system_profiler('SPDisplaysDataType', 'ChipsetModel', true));
             if (!empty($system_profiler_info)) {
                 $info = $system_profiler_info;
             }
         } else {
             if (phodevi::is_nvidia_graphics()) {
                 if ($info == null) {
                     if (pts_client::executable_in_path('nvidia-settings')) {
                         $nv_gpus = shell_exec('nvidia-settings -q gpus 2>&1');
                         // TODO: search for more than one GPU
                         $nv_gpus = substr($nv_gpus, strpos($nv_gpus, '[0]'));
                         $nv_gpus = substr($nv_gpus, strpos($nv_gpus, '(') + 1);
                         $nv_gpus = substr($nv_gpus, 0, strpos($nv_gpus, ')'));
                         if (stripos($nv_gpus, 'GeForce') !== false || stripos($nv_gpus, 'Quadro') !== false) {
                             $info = $nv_gpus;
                         }
                     }
                 }
                 $sli_mode = phodevi_parser::read_nvidia_extension('SLIMode');
                 if (!empty($sli_mode) && $sli_mode != 'Off') {
                     $info .= ' SLI';
                 }
             } else {
                 if (phodevi::is_solaris()) {
                     if (($cut = strpos($info, 'DRI ')) !== false) {
                         $info = substr($info, $cut + 4);
                     }
                     if (($cut = strpos($info, ' Chipset')) !== false) {
                         $info = substr($info, 0, $cut);
                     }
                     if ($info == false && isset(phodevi::$vfs->xorg_log)) {
                         $xorg_log = phodevi::$vfs->xorg_log;
                         if (($x = strpos($xorg_log, '(0): Chipset: ')) !== false) {
                             $xorg_log = substr($xorg_log, $x + 14);
                             $xorg_log = str_replace(array('(R)', '"'), null, substr($xorg_log, 0, strpos($xorg_log, PHP_EOL)));
                             if (($c = strpos($xorg_log, '[')) || ($c = strpos($xorg_log, '('))) {
                                 $xorg_log = substr($xorg_log, 0, $c);
                             }
                             if (phodevi::is_product_string($xorg_log)) {
                                 $info = $xorg_log;
                             }
                         }
                     }
                 } else {
                     if (phodevi::is_bsd()) {
                         $drm_info = phodevi_bsd_parser::read_sysctl('dev.drm.0.%desc');
                         if (!$drm_info) {
                             $drm_info = phodevi_bsd_parser::read_sysctl('dev.nvidia.0.%desc');
                         }
                         if (!$drm_info) {
                             $agp_info = phodevi_bsd_parser::read_sysctl('dev.agp.0.%desc');
                             if ($agp_info != false) {
                                 $info = $agp_info;
                             }
                         } else {
                             $info = $drm_info;
                         }
                         if ($info == null && isset(phodevi::$vfs->xorg_log)) {
                             $xorg_log = phodevi::$vfs->xorg_log;
                             if (($e = strpos($xorg_log, ' at 01@00:00:0')) !== false) {
                                 $xorg_log = substr($xorg_log, 0, $e);
                                 $info = substr($xorg_log, strrpos($xorg_log, 'Found ') + 6);
                             }
                         }
                     } else {
                         if (phodevi::is_windows()) {
                             $info = phodevi_windows_parser::read_cpuz('Display Adapters', 'Name');
                         }
                     }
                 }
             }
         }
     }
     if (empty($info) || strpos($info, 'Mesa ') !== false || strpos($info, 'Gallium ') !== false) {
         if (phodevi::is_windows() == false) {
             $info_pci = phodevi_linux_parser::read_pci('VGA compatible controller', false);
             if (!empty($info_pci)) {
                 $info = $info_pci;
                 if (strpos($info, 'Intel 2nd Generation Core Family') !== false || strpos($info, 'Gen Core') !== false) {
                     // Try to come up with a better non-generic string
                     $was_reset = false;
                     if (isset(phodevi::$vfs->xorg_log)) {
                         /*
                         $ cat /var/log/Xorg.0.log | grep -i Chipset
                         [     8.421] (II) intel: Driver for Intel Integrated Graphics Chipsets: i810,
                         [     8.421] (II) VESA: driver for VESA chipsets: vesa
                         [     8.423] (II) intel(0): Integrated Graphics Chipset: Intel(R) Sandybridge Mobile (GT2+)
                         [     8.423] (--) intel(0): Chipset: "Sandybridge Mobile (GT2+)"
                         */
                         $xorg_log = phodevi::$vfs->xorg_log;
                         if (($x = strpos($xorg_log, 'Integrated Graphics Chipset: ')) !== false) {
                             $xorg_log = substr($xorg_log, $x + 29);
                             $xorg_log = str_replace(array('(R)', '"'), null, substr($xorg_log, 0, strpos($xorg_log, PHP_EOL)));
                             if (stripos($xorg_log, 'Intel') === false) {
                                 $xorg_log = 'Intel ' . $xorg_log;
                             }
                             // if string is too long, likely not product
                             if (!isset($xorg_log[45])) {
                                 $info = $xorg_log;
                                 $was_reset = true;
                             }
                         } else {
                             if (($x = strpos($xorg_log, '(0): Chipset: ')) !== false) {
                                 $xorg_log = substr($xorg_log, $x + 14);
                                 $xorg_log = str_replace(array('(R)', '"'), null, substr($xorg_log, 0, strpos($xorg_log, PHP_EOL)));
                                 if (stripos($xorg_log, 'Intel') === false) {
                                     $xorg_log = 'Intel ' . $xorg_log;
                                 }
                                 // if string is too long, likely not product
                                 if (!isset($xorg_log[45])) {
                                     $info = $xorg_log;
                                     $was_reset = true;
                                 }
                             }
                         }
                     }
                     if ($was_reset == false && isset(phodevi::$vfs->i915_capabilities)) {
                         $i915_caps = phodevi::$vfs->i915_capabilities;
                         if (($x = strpos($i915_caps, 'gen: ')) !== false) {
                             $gen = substr($i915_caps, $x + 5);
                             $gen = substr($gen, 0, strpos($gen, PHP_EOL));
                             if (is_numeric($gen)) {
                                 $info = 'Intel Gen' . $gen;
                                 if (strpos($i915_caps, 'is_mobile: yes') !== false) {
                                     $info .= ' Mobile';
                                 }
                             }
                         }
                     }
                 }
             }
         }
         if (($start_pos = strpos($info, ' DRI ')) > 0) {
             $info = substr($info, $start_pos + 5);
         }
         if (empty($info) && isset(phodevi::$vfs->xorg_log)) {
             $log_parse = phodevi::$vfs->xorg_log;
             $log_parse = substr($log_parse, strpos($log_parse, 'Chipset') + 8);
             $log_parse = substr($log_parse, 0, strpos($log_parse, 'found'));
             if (strpos($log_parse, '(--)') === false && strlen(str_ireplace(array('ATI', 'NVIDIA', 'VIA', 'Intel'), '', $log_parse)) != strlen($log_parse)) {
                 $info = $log_parse;
             }
         }
         if (empty($info) && is_readable('/sys/class/graphics/fb0/name')) {
             switch (pts_file_io::file_get_contents('/sys/class/graphics/fb0/name')) {
                 case 'omapdrm':
                     $info = 'Texas Instruments OMAP';
                     // The OMAP DRM driver currently is for OMAP2/3/4 hardware
                     break;
                 case 'exynos':
                     $info = 'Samsung EXYNOS';
                     // The Exynos DRM driver
                     break;
                 case 'tegra_fb':
                     $info = 'NVIDIA TEGRA';
                     // The Exynos DRM driver
                     break;
                 default:
                     if (is_file('/dev/mali')) {
                         $info = 'ARM Mali';
                         // One of the ARM Mali models
                     }
                     break;
             }
         }
         if (substr($info, -1) == ')' && ($open_p = strrpos($info, '(')) != false) {
             $end_check = strpos($info, ' ', $open_p);
             $to_check = substr($info, $open_p + 1, $end_check - $open_p - 1);
             // Don't report card revision from PCI info
             if ($to_check == 'rev') {
                 $info = substr($info, 0, $open_p - 1);
             }
         }
     }
     if (($bracket_open = strpos($info, '[')) !== false) {
         // Report only the information inside the brackets if it's more relevant...
         // Mainly with Linux systems where the PCI information is reported like 'nVidia GF104 [GeForce GTX 460]'
         if (($bracket_close = strpos($info, ']', $bracket_open + 1)) !== false) {
             $inside_bracket = substr($info, $bracket_open + 1, $bracket_close - $bracket_open - 1);
             if (stripos($inside_bracket, 'Quadro') !== false || stripos($inside_bracket, 'GeForce') !== false) {
                 $info = $inside_bracket . ' ' . substr($info, $bracket_close + 1);
             } else {
                 if (stripos($inside_bracket, 'Radeon') !== false || stripos($inside_bracket, 'Fire') !== false || stripos($inside_bracket, 'Fusion') !== false) {
                     $info = $inside_bracket . ' ' . substr($info, $bracket_close + 1);
                 }
             }
         }
     }
     if (stripos($info, 'NVIDIA') === false && (stripos($info, 'Quadro') !== false || stripos($info, 'GeForce') !== false)) {
         $info = 'NVIDIA' . ' ' . $info;
     } else {
         if (stripos($info, 'ATI') === false && stripos($info, 'AMD') === false && (stripos($info, 'Radeon') !== false || stripos($info, 'Fire') !== false || stripos($info, 'Fusion') !== false)) {
             // Fire would be for FireGL or FirePro hardware
             $info = 'AMD ' . $info;
         }
     }
     if (phodevi::is_linux() && ($vendor = phodevi_linux_parser::read_pci_subsystem_value('VGA compatible controller')) != null && stripos($info, $vendor) === false && (stripos($info, 'AMD') !== false || stripos($info, 'NVIDIA') !== false)) {
         $info = $vendor . ' ' . $info;
     }
     if ($video_ram > 64 && strpos($info, $video_ram) == false) {
         $info .= ' ' . $video_ram . 'MB';
     }
     $clean_phrases = array('OpenGL Engine');
     $info = str_replace($clean_phrases, null, $info);
     return $info;
 }
Пример #20
0
 public static function is_root()
 {
     return phodevi::read_property('system', 'username') == 'root';
 }
 public static function monitor_modes()
 {
     // Determine resolutions for each monitor
     $resolutions = array();
     if (phodevi::read_property('monitor', 'count') == 1) {
         array_push($resolutions, phodevi::read_property('gpu', 'screen-resolution-string'));
     } else {
         foreach (phodevi_parser::read_xdpy_monitor_info() as $monitor_line) {
             $this_resolution = substr($monitor_line, strpos($monitor_line, ':') + 2);
             $this_resolution = substr($this_resolution, 0, strpos($this_resolution, ' '));
             array_push($resolutions, $this_resolution);
         }
     }
     return implode(',', $resolutions);
 }
 public function is_supported($report_warnings = true)
 {
     $test_supported = true;
     if (PTS_IS_CLIENT && pts_client::read_env('SKIP_TEST_SUPPORT_CHECKS')) {
         // set SKIP_TEST_SUPPORT_CHECKS=1 environment variable for debugging purposes to run tests on unsupported platforms
         return true;
     } else {
         if ($this->is_test_architecture_supported() == false) {
             PTS_IS_CLIENT && $report_warnings && pts_client::$display->test_run_error($this->get_identifier() . ' is not supported on this architecture: ' . phodevi::read_property('system', 'kernel-architecture'));
             $test_supported = false;
         } else {
             if ($this->is_test_platform_supported() == false) {
                 PTS_IS_CLIENT && $report_warnings && pts_client::$display->test_run_error($this->get_identifier() . ' is not supported by this operating system: ' . phodevi::operating_system());
                 $test_supported = false;
             } else {
                 if ($this->is_core_version_supported() == false) {
                     PTS_IS_CLIENT && $report_warnings && pts_client::$display->test_run_error($this->get_identifier() . ' is not supported by this version of the Phoronix Test Suite: ' . PTS_VERSION);
                     $test_supported = false;
                 } else {
                     if (PTS_IS_CLIENT && ($custom_support_check = $this->custom_test_support_check()) !== true) {
                         // A custom-self-generated error occurred, see code comments in custom_test_support_check()
                         PTS_IS_CLIENT && $report_warnings && is_callable(array(pts_client::$display, 'test_run_error')) && pts_client::$display->test_run_error($this->get_identifier() . ': ' . $custom_support_check);
                         $test_supported = false;
                     } else {
                         if (PTS_IS_CLIENT) {
                             foreach ($this->extended_test_profiles() as $extension) {
                                 if ($extension->is_supported($report_warnings) == false) {
                                     $test_supported = false;
                                     break;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $test_supported;
 }
 public static function run($r)
 {
     pts_client::$display->generic_heading('Random Test Execution');
     $allow_new_tests_to_be_installed = pts_user_io::prompt_bool_input('Allow new tests to be installed', true);
     $allow_new_dependencies_to_be_installed = $allow_new_tests_to_be_installed ? pts_user_io::prompt_bool_input('Allow new test external dependencies to be installed', false) : false;
     $limit_test_subsystem = pts_user_io::prompt_bool_input('Limit tests to a given subsystem', false);
     $limit_test_subsystem = $limit_test_subsystem ? pts_user_io::prompt_text_menu('Select subsystem(s) to test', pts_types::subsystem_targets(), true) : false;
     $upload_to_openbenchmarking = pts_user_io::prompt_bool_input('Auto-upload test results to OpenBenchmarking.org', true);
     while (1) {
         $to_test = array();
         if ($limit_test_subsystem) {
             foreach (explode(',', $limit_test_subsystem) as $test_type) {
                 $tests = pts_openbenchmarking_client::popular_tests(-1, $test_type);
                 $to_test = array_merge($to_test, $tests);
             }
             if (empty($to_test)) {
                 pts_client::$display->generic_sub_heading('No tests could be found to run.');
                 return false;
             }
             shuffle($to_test);
             $to_test = array_slice($to_test, 0, rand(1, 12));
         } else {
             if (rand(1, 6) == 2) {
                 $ob_ids = pts_openbenchmarking_client::popular_openbenchmarking_results();
                 $ob_type = rand(0, 1) == 1 ? 'recent_popular_results' : 'recent_results';
                 if (isset($ob_ids[$ob_type]) && !empty($ob_ids[$ob_type])) {
                     shuffle($ob_ids[$ob_type]);
                     $to_test = array(array_pop($ob_ids[$ob_type]));
                 }
             }
         }
         if (empty($to_test)) {
             // Randomly pick some installed tests
             $installed_tests = pts_tests::installed_tests();
             if ($installed_tests > 3) {
                 shuffle($installed_tests);
                 $to_test = array_slice($installed_tests, 0, rand(1, 8));
             }
             if (!isset($to_test[2]) && $allow_new_tests_to_be_installed) {
                 $available_tests = pts_openbenchmarking::available_tests();
                 shuffle($available_tests);
                 $to_test = array_merge($to_test, array_slice($available_tests, 0, rand(1, 10)));
             }
         }
         if (empty($to_test)) {
             pts_client::$display->generic_sub_heading('No tests could be found to run.');
             return false;
         }
         echo PHP_EOL;
         pts_client::$display->generic_sub_heading('Tests To Run: ' . implode(', ', $to_test));
         // QUERY FROM OB
         $random_titles = array(phodevi::read_property('cpu', 'model') . ' Benchmarks', phodevi::read_property('system', 'operating-system') . ' Benchmarks', phodevi::read_property('system', 'operating-system') . ' Performance', phodevi::read_property('cpu', 'model') . ' Performance', phodevi::read_property('cpu', 'model') . ' + ' . phodevi::read_property('gpu', 'model') . ' + ' . phodevi::read_property('motherboard', 'identifier'), phodevi::read_property('motherboard', 'identifier') . ' On ' . phodevi::read_property('system', 'operating-system'), phodevi::read_property('cpu', 'model') . ' On ' . phodevi::read_property('system', 'operating-system'), phodevi::read_property('system', 'kernel') . ' + ' . phodevi::read_property('system', 'operating-system') . ' Tests');
         shuffle($random_titles);
         $title = array_pop($random_titles);
         if ($limit_test_subsystem) {
             $subsystems_to_test = explode(',', $limit_test_subsystem);
             $subsystems_to_avoid = array_diff(pts_types::subsystem_targets(), $subsystems_to_test);
             pts_client::pts_set_environment_variable('SKIP_TESTING_SUBSYSTEMS', implode(',', $subsystems_to_avoid));
         }
         if ($allow_new_tests_to_be_installed) {
             pts_test_installer::standard_install($to_test, false, true, $allow_new_dependencies_to_be_installed);
         }
         $batch_mode_settings = array('UploadResults' => false, 'SaveResults' => true, 'PromptForTestDescription' => false, 'RunAllTestCombinations' => false, 'PromptSaveName' => false, 'PromptForTestIdentifier' => false, 'OpenBrowser' => false);
         if ($upload_to_openbenchmarking) {
             $batch_mode_settings['UploadResults'] = true;
             pts_openbenchmarking_client::override_client_setting('UploadSystemLogsByDefault', true);
         }
         pts_test_run_manager::set_batch_mode($batch_mode_settings);
         $test_run_manager = new pts_test_run_manager($batch_mode_settings, 2);
         if ($test_run_manager->initial_checks($to_test) != false) {
             if ($test_run_manager->load_tests_to_run($to_test)) {
                 // SETUP
                 $test_run_manager->auto_save_results($title, null, 'Various open-source benchmarks by the ' . pts_core::program_title(true) . '.', true);
                 $test_run_manager->auto_generate_results_identifier();
                 echo PHP_EOL;
                 pts_client::$display->generic_sub_heading('Result File: ' . $test_run_manager->get_file_name());
                 pts_client::$display->generic_sub_heading('Result Identifier: ' . $test_run_manager->get_results_identifier());
                 // BENCHMARK
                 $test_run_manager->pre_execution_process();
                 $test_run_manager->call_test_runs();
                 $test_run_manager->post_execution_process();
                 pts_client::remove_saved_result_file($test_run_manager->get_file_name());
             }
         }
         echo PHP_EOL;
         sleep(30);
     }
 }
Пример #24
0
 protected static function upload_to_remote_server($to_post, $server_address = null, $server_http_port = null, $account_id = null)
 {
     static $last_communication_minute = null;
     static $communication_attempts = 0;
     if ($last_communication_minute == date('i') && $communication_attempts > 8) {
         // Something is wrong, Phoromatic shouldn't be communicating with server more than four times a minute
         return false;
     } else {
         if (date('i') != $last_communication_minute) {
             $last_communication_minute = date('i');
             $communication_attempts = 0;
         }
         $communication_attempts++;
     }
     if ($server_address == null && self::$server_address != null) {
         $server_address = self::$server_address;
     }
     if ($server_http_port == null && self::$server_http_port != null) {
         $server_http_port = self::$server_http_port;
     }
     if ($account_id == null && self::$account_id != null) {
         $account_id = self::$account_id;
     }
     $to_post['aid'] = $account_id;
     $to_post['pts'] = PTS_VERSION;
     $to_post['pts_core'] = PTS_CORE_VERSION;
     $to_post['gsid'] = defined('PTS_GSID') ? PTS_GSID : null;
     $to_post['lip'] = pts_network::get_local_ip();
     $to_post['h'] = phodevi::system_hardware(true);
     $to_post['nm'] = pts_network::get_network_mac();
     $to_post['nw'] = implode(', ', pts_network::get_network_wol());
     $to_post['s'] = phodevi::system_software(true);
     $to_post['n'] = phodevi::read_property('system', 'hostname');
     $to_post['msi'] = PTS_MACHINE_SELF_ID;
     return pts_network::http_upload_via_post('http://' . $server_address . ':' . $server_http_port . '/phoromatic.php', $to_post);
 }
 public static function update_gsid()
 {
     if (!pts_network::internet_support_available()) {
         return false;
     }
     $payload = array('client_version' => PTS_VERSION, 'client_os' => phodevi::read_property('system', 'vendor-identifier'));
     pts_openbenchmarking::make_openbenchmarking_request('update_gsid', $payload);
 }
 public static function generate_test_notes(&$test_result_objects)
 {
     // TODO XXX: Integrate with system table notes
     static $check_processes = null;
     $test_types = array();
     $test_tags = array();
     foreach ($test_result_objects as $test_result) {
         pts_arrays::unique_push($test_types, $test_result->test_profile->get_test_hardware_type());
         foreach ($test_result->test_profile->get_internal_tags() as $tag) {
             pts_arrays::unique_push($test_tags, $tag);
         }
     }
     if (in_array('Java', $test_tags)) {
         self::add_note(phodevi::read_property('system', 'java-version'));
     }
     if (in_array('Python', $test_tags)) {
         self::add_note(phodevi::read_property('system', 'python-version'));
     }
     if (in_array('Wine', $test_tags)) {
         self::add_note(phodevi::read_property('system', 'wine-version'));
     }
     if (in_array('OpenCL', $test_tags)) {
         $cores = phodevi::read_property('gpu', 'compute-cores');
         if ($cores > 0) {
             self::add_note('GPU Compute Cores: ' . $cores);
         }
     }
     /*
     if(phodevi::is_bsd() == false)
     {
     	if(empty($check_processes))
     	{
     		$check_processes = array(
     			'Compiz' => array('compiz', 'compiz.real'),
     			'Firefox' => array('firefox', 'mozilla-firefox', 'mozilla-firefox-bin'),
     			'Thunderbird' => array('thunderbird', 'mozilla-thunderbird', 'thunderbird-bin'),
     			'BOINC' => array('boinc', 'boinc_client')
     			);
     	}
     
     	self::add_note(self::process_running_string($check_processes));
     }
     */
     // Check if Security Enhanced Linux was enforcing, permissive, or disabled
     if (is_readable('/etc/sysconfig/selinux')) {
         if (stripos(file_get_contents('/etc/sysconfig/selinux'), 'selinux=disabled') === false) {
             self::add_note('SELinux: Enabled');
         }
     } else {
         if (isset(phodevi::$vfs->cmdline)) {
             if (stripos(phodevi::$vfs->cmdline, 'selinux=1') != false) {
                 self::add_note('SELinux: Enabled');
             }
         }
     }
     /*
     // Encrypted file-system?
     if(phodevi::is_linux() && is_readable('/sys/fs/ecryptfs/version'))
     {
     	self::add_note('eCryptfs was active.');
     }
     */
     self::add_note(phodevi::read_property('motherboard', 'power-mode'));
     if (in_array('Graphics', $test_types) || in_array('System', $test_types)) {
         $aa_level = phodevi::read_property('gpu', 'aa-level');
         $af_level = phodevi::read_property('gpu', 'af-level');
         if (!empty($aa_level)) {
             self::add_note('Antialiasing: ' . $aa_level);
         }
         if (!empty($af_level)) {
             self::add_note('Anisotropic Filtering: ' . $af_level);
         }
     }
     $notes_string = trim(implode('. ', self::$notes));
     if ($notes_string != null) {
         $notes_string .= '.';
     }
     self::$notes = array();
     return $notes_string;
 }
Пример #27
0
 public static function current_user()
 {
     // Current system user
     return ($pts_user = pts_openbenchmarking_client::user_name()) != null ? $pts_user : phodevi::read_property('system', 'username');
 }
 public static function auto_process_test_option($test_identifier, $option_identifier, &$option_names, &$option_values, &$option_messages)
 {
     // Some test items have options that are dynamically built
     switch ($option_identifier) {
         case 'auto-resolution':
             // Base options off available screen resolutions
             if (count($option_names) == 1 && count($option_values) == 1) {
                 if (PTS_IS_CLIENT && phodevi::read_property('gpu', 'screen-resolution') && phodevi::read_property('gpu', 'screen-resolution') != array(-1, -1) && !defined('PHOROMATIC_SERVER')) {
                     $available_video_modes = phodevi::read_property('gpu', 'available-modes');
                 } else {
                     $available_video_modes = array();
                 }
                 if (empty($available_video_modes)) {
                     // Use hard-coded defaults
                     $available_video_modes = array(array(800, 600), array(1024, 768), array(1280, 768), array(1280, 960), array(1280, 1024), array(1366, 768), array(1400, 1050), array(1600, 900), array(1680, 1050), array(1600, 1200), array(1920, 1080), array(2560, 1600), array(3840, 2160));
                 }
                 $format_name = $option_names[0];
                 $format_value = $option_values[0];
                 $option_names = array();
                 $option_values = array();
                 foreach ($available_video_modes as $video_mode) {
                     $this_name = str_replace('$VIDEO_WIDTH', $video_mode[0], $format_name);
                     $this_name = str_replace('$VIDEO_HEIGHT', $video_mode[1], $this_name);
                     $this_value = str_replace('$VIDEO_WIDTH', $video_mode[0], $format_value);
                     $this_value = str_replace('$VIDEO_HEIGHT', $video_mode[1], $this_value);
                     array_push($option_names, $this_name);
                     array_push($option_values, $this_value);
                 }
             }
             break;
         case 'auto-disk-partitions':
         case 'auto-disk-mount-points':
             // Base options off available disk partitions
             if (PTS_IS_CLIENT == false) {
                 echo 'ERROR: This option is not supported in this configuration.';
                 return;
             }
             /*if(phodevi::is_linux())
             		{
             			$all_devices = array_merge(pts_file_io::glob('/dev/hd*'), pts_file_io::glob('/dev/sd*'));
             		}
             		else if(phodevi::is_bsd())
             		{
             			$all_devices = array_merge(pts_file_io::glob('/dev/ad*'), pts_file_io::glob('/dev/ada*'));
             		}
             		else
             		{
             			$all_devices = array();
             		}*/
             $all_devices = array_merge(pts_file_io::glob('/dev/hd*'), pts_file_io::glob('/dev/sd*'), pts_file_io::glob('/dev/md*'), pts_file_io::glob('/dev/nvme*'));
             foreach ($all_devices as &$device) {
                 if (!is_numeric(substr($device, -1))) {
                     unset($device);
                 }
             }
             $all_devices = array_merge($all_devices, pts_file_io::glob('/dev/mapper/*'));
             $option_values = array();
             foreach ($all_devices as $partition) {
                 array_push($option_values, $partition);
             }
             if ($option_identifier == 'auto-disk-mount-points') {
                 $partitions_d = $option_values;
                 $option_values = array();
                 $option_names = array();
                 $mounts = is_file('/proc/mounts') ? file_get_contents('/proc/mounts') : null;
                 array_push($option_values, '');
                 array_push($option_names, 'Default Test Directory');
                 foreach ($partitions_d as $partition_d) {
                     $mount_point = substr($a = substr($mounts, strpos($mounts, $partition_d) + strlen($partition_d) + 1), 0, strpos($a, ' '));
                     if (is_dir($mount_point) && is_writable($mount_point) && !in_array($mount_point, array('/boot', '/boot/efi'))) {
                         array_push($option_values, $mount_point);
                         array_push($option_names, $mount_point);
                         // ' [' . $partition_d . ']'
                     }
                 }
             } else {
                 $option_names = $option_values;
             }
             break;
         case 'auto-disks':
             // Base options off attached disks
             if (PTS_IS_CLIENT == false) {
                 echo 'ERROR: This option is not supported in this configuration.';
                 return;
             }
             $all_devices = array_merge(pts_file_io::glob('/dev/hd*'), pts_file_io::glob('/dev/sd*'), pts_file_io::glob('/dev/md*'), pts_file_io::glob('/dev/nvme*'));
             foreach ($all_devices as $i => &$device) {
                 if (is_numeric(substr($device, -1))) {
                     unset($all_devices[$i]);
                 }
             }
             $option_values = array();
             foreach ($all_devices as $disk) {
                 array_push($option_values, $disk);
             }
             $option_names = $option_values;
             break;
         case 'auto-removable-media':
             if (PTS_IS_CLIENT == false) {
                 echo 'ERROR: This option is not supported in this configuration.';
                 return;
             }
             foreach (array_merge(pts_file_io::glob('/media/*/'), pts_file_io::glob('/Volumes/*/')) as $media_check) {
                 if (is_dir($media_check) && is_writable($media_check)) {
                     array_push($option_names, $media_check);
                     array_push($option_values, $media_check);
                 }
             }
             break;
         case 'auto-file-select':
             if (PTS_IS_CLIENT == false) {
                 echo 'ERROR: This option is not supported in this configuration.';
                 return;
             }
             $names = $option_names;
             $values = $option_values;
             $option_names = array();
             $option_values = array();
             for ($i = 0; $i < count($names) && $i < count($values); $i++) {
                 if (is_file($values[$i])) {
                     array_push($option_names, $names[$i]);
                     array_push($option_values, $values[$i]);
                 }
             }
             break;
         case 'auto-directory-select':
             if (PTS_IS_CLIENT == false) {
                 echo 'ERROR: This option is not supported in this configuration.';
                 return;
             }
             $names = $option_names;
             $values = $option_values;
             $option_names = array();
             $option_values = array();
             for ($i = 0; $i < count($names) && $i < count($values); $i++) {
                 if (is_dir($values[$i]) && is_writable($removable_media[$i])) {
                     array_push($option_names, $names[$i]);
                     array_push($option_values, $values[$i]);
                 }
             }
             break;
     }
 }