当前位置: 首页>>代码示例>>PHP>>正文


PHP pts_client::read_env方法代码示例

本文整理汇总了PHP中pts_client::read_env方法的典型用法代码示例。如果您正苦于以下问题:PHP pts_client::read_env方法的具体用法?PHP pts_client::read_env怎么用?PHP pts_client::read_env使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pts_client的用法示例。


在下文中一共展示了pts_client::read_env方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: user_home_directory

 public static function user_home_directory()
 {
     // Gets the system user's home directory
     static $userhome = null;
     if ($userhome == null) {
         if (function_exists('posix_getpwuid') && function_exists('posix_getuid')) {
             $userinfo = posix_getpwuid(posix_getuid());
             $userhome = $userinfo['dir'];
         } else {
             if ($home = pts_client::read_env('HOME')) {
                 $userhome = $home;
             } else {
                 if ($home = pts_client::read_env('HOMEPATH')) {
                     $userhome = pts_client::read_env('HOMEDRIVE') . $home;
                 } else {
                     if (PTS_IS_DAEMONIZED_SERVER_PROCESS) {
                         $userhome = PTS_USER_PATH;
                     } else {
                         if (!is_writable('/')) {
                             echo PHP_EOL . 'ERROR: Cannot find home directory.' . PHP_EOL;
                         }
                         $userhome = null;
                     }
                 }
             }
         }
         $userhome = pts_strings::add_trailing_slash($userhome);
     }
     return $userhome;
 }
开发者ID:pacificIT,项目名称:phoronix-test-suite,代码行数:30,代码来源:pts-core.php

示例2: set_amd_pcsdb

 public static function set_amd_pcsdb($attribute, $value)
 {
     // Sets a value for AMD's PCSDB, Persistent Configuration Store Database
     if (phodevi::is_ati_graphics() && phodevi::is_linux() && !empty($value)) {
         $DISPLAY = substr(pts_client::read_env("DISPLAY"), 1, 1);
         $info = shell_exec("DISPLAY=:" . $DISPLAY . " aticonfig --set-pcs-val=" . $attribute . "," . $value . "  2>&1");
     }
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:8,代码来源:graphics_override.php

示例3: run

 public static function run($r)
 {
     $test_profiles = pts_types::identifiers_to_test_profile_objects($r, true, true);
     if (count($test_profiles) > 0) {
         echo PHP_EOL . 'Downloading Test Files For: ' . implode(' ', $test_profiles);
         pts_test_installer::only_download_test_files($test_profiles, pts_client::read_env('DOWNLOAD_CACHE_LOCATION'));
     } else {
         echo PHP_EOL . 'Nothing found to download.' . PHP_EOL;
     }
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:10,代码来源:download_test_files.php

示例4: run

 public static function run($r)
 {
     $module = strtolower($r[0]);
     $pre_message = null;
     if (!class_exists($module)) {
         pts_module_manager::load_module($module);
     }
     $module_name = pts_module_manager::module_call($module, 'module_name');
     $module_description = pts_module_manager::module_call($module, 'module_description');
     $module_setup = pts_module_manager::module_call($module, 'module_setup');
     pts_client::$display->generic_heading($module_name . ' Module Configuration');
     echo $module_description . PHP_EOL;
     if (count($module_setup) == 0) {
         echo PHP_EOL . 'There are no options available for configuring with the ' . $module . ' module.' . PHP_EOL;
     } else {
         if (($module_presets = pts_client::read_env('PTS_MODULE_SETUP')) != false) {
             $module_presets = pts_client::parse_value_string_double_identifier($module_presets);
         }
         $set_options = array();
         foreach ($module_setup as $module_option) {
             if ($module_option instanceof pts_module_option) {
                 $option_identifier = $module_option->get_identifier();
                 if (isset($module_presets[$module][$option_identifier]) && $module_option->is_supported_value($module_presets[$module][$option_identifier])) {
                     echo PHP_EOL . $module_option->get_formatted_question();
                     echo $module_presets[$module][$option_identifier] . PHP_EOL;
                     $input = $module_presets[$module][$option_identifier];
                 } else {
                     do {
                         echo PHP_EOL . $module_option->get_formatted_question();
                         $input = pts_user_io::read_user_input();
                     } while (!$module_option->is_supported_value($input));
                 }
                 if (empty($input)) {
                     $input = $module_option->get_default_value();
                 }
                 $set_options[$option_identifier] = $input;
             }
         }
         $set_options = pts_module_manager::module_call($module, 'module_setup_validate', $set_options);
         if (!empty($set_options)) {
             pts_module::module_config_save($module, $set_options);
         }
     }
     echo PHP_EOL;
 }
开发者ID:ptzafrir,项目名称:phoronix-test-suite,代码行数:45,代码来源:module_setup.php

示例5: run

 public static function run($to_run)
 {
     pts_test_run_manager::set_batch_mode(array('UploadResults' => false, 'SaveResults' => false, 'PromptForTestDescription' => false, 'RunAllTestCombinations' => false, 'PromptSaveName' => false, 'PromptForTestIdentifier' => false, 'OpenBrowser' => false));
     $tests_to_run_concurrently = 2;
     if (($j = getenv('PTS_CONCURRENT_TEST_RUNS')) && is_numeric($j) && $j > 1) {
         $tests_to_run_concurrently = $j;
         echo 'PTS_CONCURRENT_TEST_RUNS set; running ' . $tests_to_run_concurrently . ' tests concurrently.' . PHP_EOL;
     }
     $test_flags = pts_c::batch_mode;
     if (pts_test_run_manager::initial_checks($to_run, $test_flags, 'SHORT') == false) {
         return false;
     }
     /*
     if(count($to_run) < $tests_to_run_concurrently)
     {
     	echo PHP_EOL . 'More tests must be specified in order to run ' . $tests_to_run_concurrently . ' tests concurrently.';
     	return false;
     }
     */
     $test_run_manager = new pts_test_run_manager($test_flags);
     // Load the tests to run
     if ($test_run_manager->load_tests_to_run($to_run) == false) {
         return false;
     }
     // Run the actual tests
     $total_loop_time = pts_client::read_env('TOTAL_LOOP_TIME');
     if ($total_loop_time == 'infinite') {
         $total_loop_time = 'infinite';
         echo 'TOTAL_LOOP_TIME set; running tests in an infinite loop until otherwise triggered' . PHP_EOL;
     } else {
         if ($total_loop_time && is_numeric($total_loop_time) && $total_loop_time > 9) {
             $total_loop_time = $total_loop_time * 60;
             echo 'TOTAL_LOOP_TIME set; running tests for ' . $total_loop_time / 60 . ' minutes' . PHP_EOL;
         } else {
             $total_loop_time = false;
         }
     }
     //$test_run_manager->pre_execution_process();
     $test_run_manager->multi_test_stress_run_execute($tests_to_run_concurrently, $total_loop_time);
 }
开发者ID:pchiruma,项目名称:phoronix-test-suite,代码行数:40,代码来源:stress_run.php

示例6: init

 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;
     }
 }
开发者ID:pchiruma,项目名称:phoronix-test-suite,代码行数:36,代码来源:pts_flags.php

示例7: run_test


//.........这里部分代码省略.........
     }
     if ($test_run_manager->get_results_identifier() != null && $test_run_manager->get_file_name() != null && pts_config::read_bool_config('PhoronixTestSuite/Options/Testing/SaveTestLogs', 'FALSE')) {
         $backup_test_log_dir = PTS_SAVE_RESULTS_PATH . $test_run_manager->get_file_name() . '/test-logs/active/' . $test_run_manager->get_results_identifier() . '/';
         pts_file_io::delete($backup_test_log_dir);
         pts_file_io::mkdir($backup_test_log_dir, 0777, true);
     } else {
         $backup_test_log_dir = false;
     }
     for ($i = 0, $abort_testing = false, $time_test_start_actual = time(), $defined_times_to_run = $times_to_run; $i < $times_to_run && $i < 256 && !$abort_testing; $i++) {
         pts_client::$display->test_run_instance_header($test_run_request);
         $test_log_file = $test_directory . basename($test_identifier) . '-' . $runtime_identifier . '-' . ($i + 1) . '.log';
         $is_expected_last_run = $i == $times_to_run - 1;
         $test_extra_runtime_variables = array_merge($extra_runtime_variables, array('LOG_FILE' => $test_log_file, 'DISPLAY' => getenv('DISPLAY'), 'PATH' => getenv('PATH')));
         $restored_from_cache = false;
         if ($cache_share_present) {
             $cache_share = pts_storage_object::recover_from_file($cache_share_pt2so);
             if ($cache_share) {
                 $test_result = $cache_share->read_object('test_results_output_' . $i);
                 $test_extra_runtime_variables['LOG_FILE'] = $cache_share->read_object('log_file_location_' . $i);
                 if ($test_extra_runtime_variables['LOG_FILE'] != null) {
                     file_put_contents($test_extra_runtime_variables['LOG_FILE'], $cache_share->read_object('log_file_' . $i));
                     $test_run_time = 0;
                     // This wouldn't be used for a cache share since it would always be the same, but declare the value so the variable is at least initialized
                     $restored_from_cache = true;
                 }
             }
             unset($cache_share);
         }
         if ($restored_from_cache == false) {
             $test_run_command = 'cd ' . $to_execute . ' && ' . $execute_binary_prepend . './' . $execute_binary . ' ' . $pts_test_arguments . ' 2>&1';
             pts_client::test_profile_debug_message('Test Run Command: ' . $test_run_command);
             $is_monitoring = pts_test_result_parser::system_monitor_task_check($test_run_request->test_profile);
             $test_run_time_start = time();
             if (phodevi::is_windows() || pts_client::read_env('USE_PHOROSCRIPT_INTERPRETER') != false) {
                 $phoroscript = new pts_phoroscript_interpreter($to_execute . '/' . $execute_binary, $test_extra_runtime_variables, $to_execute);
                 $phoroscript->execute_script($pts_test_arguments);
                 $test_result = null;
             } else {
                 //$test_result = pts_client::shell_exec($test_run_command, $test_extra_runtime_variables);
                 $descriptorspec = array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
                 $test_process = proc_open('exec ' . $execute_binary_prepend . './' . $execute_binary . ' ' . $pts_test_arguments . ' 2>&1', $descriptorspec, $pipes, $to_execute, array_merge($_ENV, pts_client::environmental_variables(), $test_extra_runtime_variables));
                 if (is_resource($test_process)) {
                     //echo proc_get_status($test_process)['pid'];
                     pts_module_manager::module_process('__test_running', $test_process);
                     $test_result = stream_get_contents($pipes[1]);
                     fclose($pipes[1]);
                     fclose($pipes[2]);
                     $return_value = proc_close($test_process);
                 }
             }
             $test_run_time = time() - $test_run_time_start;
             $monitor_result = $is_monitoring ? pts_test_result_parser::system_monitor_task_post_test($test_run_request->test_profile) : 0;
         }
         if (!isset($test_result[10240]) || pts_client::is_debug_mode() || $full_output) {
             pts_client::$display->test_run_instance_output($test_result);
         }
         if (is_file($test_log_file) && trim($test_result) == null && (filesize($test_log_file) < 10240 || pts_client::is_debug_mode() || $full_output)) {
             $test_log_file_contents = file_get_contents($test_log_file);
             pts_client::$display->test_run_instance_output($test_log_file_contents);
             unset($test_log_file_contents);
         }
         $test_run_request->test_result_standard_output = $test_result;
         $exit_status_pass = true;
         if (is_file($test_directory . 'test-exit-status')) {
             // If the test script writes its exit status to ~/test-exit-status, if it's non-zero the test run failed
             $exit_status = pts_file_io::file_get_contents($test_directory . 'test-exit-status');
开发者ID:pacificIT,项目名称:phoronix-test-suite,代码行数:67,代码来源:pts_test_execution.php

示例8: display_web_page

 public static function display_web_page($URL, $alt_text = null, $default_open = true, $auto_open = false)
 {
     if (pts_client::read_env('DISPLAY') == false && pts_client::read_env('WAYLAND_DISPLAY') == false && phodevi::is_windows() == false && phodevi::is_macosx() == false || defined('PHOROMATIC_PROCESS')) {
         return;
     }
     if ($auto_open == false) {
         $view_results = pts_user_io::prompt_bool_input($alt_text == null ? 'Do you want to view the results in your web browser' : $alt_text, $default_open);
     } else {
         $view_results = true;
     }
     if ($view_results) {
         static $browser = null;
         if ($browser == null) {
             $config_browser = pts_config::read_user_config('PhoronixTestSuite/Options/General/DefaultBrowser', null);
             if ($config_browser != null && (is_executable($config_browser) || ($config_browser = pts_client::executable_in_path($config_browser)))) {
                 $browser = $config_browser;
             } else {
                 if (phodevi::is_windows()) {
                     $windows_browsers = array('C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe', 'C:\\Program Files\\Internet Explorer\\iexplore.exe');
                     foreach ($windows_browsers as $browser_test) {
                         if (is_executable($browser_test)) {
                             $browser = $browser_test;
                             break;
                         }
                     }
                     if (substr($URL, 0, 1) == '\\') {
                         $URL = 'file:///C:' . str_replace('/', '\\', $URL);
                     }
                 } else {
                     $possible_browsers = array('firefox', 'mozilla', 'x-www-browser', 'open', 'xdg-open', 'iceweasel', 'konqueror', 'epiphany', 'google-chrome');
                     foreach ($possible_browsers as &$b) {
                         if ($b = pts_client::executable_in_path($b)) {
                             $browser = $b;
                             break;
                         }
                     }
                 }
             }
         }
         if ($browser != null) {
             shell_exec($browser . ' "' . $URL . '" 2> /dev/null &');
         } else {
             echo PHP_EOL . 'No Web Browser Found.' . PHP_EOL;
         }
     }
 }
开发者ID:Grdflo,项目名称:phoronix-test-suite,代码行数:46,代码来源:pts_client.php

示例9: install_dependencies

 public static function install_dependencies(&$test_profiles)
 {
     // PTS External Dependencies install on distribution
     if (phodevi::is_windows() || phodevi::is_macosx() || pts_flags::no_external_dependencies()) {
         // Windows doesn't use any external dependencies
         return true;
     }
     // Find all the tests that need to be checked
     $tests_to_check = array();
     foreach ($test_profiles as $test_profile) {
         if (!in_array($test_profile, $tests_to_check) && $test_profile->is_supported()) {
             array_push($tests_to_check, $test_profile);
         }
     }
     // Find all of the POSSIBLE test dependencies
     $required_test_dependencies = array();
     foreach ($tests_to_check as &$test_profile) {
         foreach ($test_profile->get_dependencies() as $test_dependency) {
             if (empty($test_dependency)) {
                 continue;
             }
             if (isset($required_test_dependencies[$test_dependency]) == false) {
                 $required_test_dependencies[$test_dependency] = array();
             }
             array_push($required_test_dependencies[$test_dependency], $test_profile);
         }
     }
     if (pts_c::$test_flags & pts_c::skip_tests_with_missing_dependencies) {
         // Remove tests that have external dependencies that aren't satisfied and then return
         $generic_packages_needed = array();
         $required_test_dependencies_copy = $required_test_dependencies;
         $dependencies_to_install = self::check_dependencies_missing_from_system($required_test_dependencies_copy, $generic_packages_needed);
         self::remove_tests_with_missing_dependencies($test_profiles, $generic_packages_needed, $required_test_dependencies);
         return true;
     }
     if (!empty($required_test_dependencies)) {
         // The 'common-dependencies' package is any general non-explicitly-required but nice-to-have packages like mesa-utils for providing glxinfo about the system
         // So if we're going to be installing external dependencies anyways, might as well try to see the common-dependencies are satisfied
         $required_test_dependencies['common-dependencies'] = array();
     }
     // Does the user wish to skip any particular dependencies?
     if (pts_client::read_env('SKIP_EXTERNAL_DEPENDENCIES')) {
         $dependencies_to_skip = explode(',', pts_client::read_env('SKIP_EXTERNAL_DEPENDENCIES'));
         foreach ($dependencies_to_skip as $dependency_name) {
             if (isset($required_test_dependencies[$dependency_name])) {
                 unset($required_test_dependencies[$dependency_name]);
             }
         }
     }
     // Make a copy for use to check at end of process to see if all dependencies were actually found
     $required_test_dependencies_copy = $required_test_dependencies;
     // Find the dependencies that are actually missing from the system
     $dependencies_to_install = self::check_dependencies_missing_from_system($required_test_dependencies);
     // If it's automated and can't install without root, return true if there are no dependencies to do otherwise false
     if (pts_c::$test_flags & pts_c::auto_mode && phodevi::is_root() == false) {
         return count($dependencies_to_install) == 0;
     }
     // Do the actual dependency install process
     if (count($dependencies_to_install) > 0) {
         self::install_packages_on_system($dependencies_to_install);
     }
     // There were some dependencies not supported on this OS or are missing from the distro's XML file
     if (count($required_test_dependencies) > 0 && count($dependencies_to_install) == 0) {
         $exdep_generic_parser = new pts_exdep_generic_parser();
         $to_report = array();
         foreach (array_keys($required_test_dependencies) as $dependency) {
             $dependency_data = $exdep_generic_parser->get_package_data($dependency);
             if ($dependency_data['possible_packages'] != null) {
                 array_push($to_report, $dependency_data['title'] . PHP_EOL . 'Possible Package Names: ' . $dependency_data['possible_packages']);
             }
         }
         if (count($to_report) > 0) {
             echo PHP_EOL . 'Some additional dependencies are required, but they could not be installed automatically for your operating system.' . PHP_EOL . 'Below are the software packages that must be installed.' . PHP_EOL . PHP_EOL;
             foreach ($to_report as $report) {
                 pts_client::$display->generic_heading($report);
             }
             if (pts_c::$test_flags ^ pts_c::batch_mode && pts_c::$test_flags ^ pts_c::auto_mode) {
                 echo 'The above dependencies should be installed before proceeding. Press any key when you\'re ready to continue.';
                 pts_user_io::read_user_input();
                 echo PHP_EOL;
             }
         }
     }
     // Find the dependencies that are still missing from the system
     if (pts_c::$test_flags ^ pts_c::batch_mode && pts_c::$test_flags ^ pts_c::auto_mode && !defined('PHOROMATIC_PROCESS')) {
         $generic_packages_needed = array();
         $required_test_dependencies = $required_test_dependencies_copy;
         $dependencies_to_install = self::check_dependencies_missing_from_system($required_test_dependencies_copy, $generic_packages_needed);
         if (count($generic_packages_needed) > 0) {
             echo PHP_EOL . 'There are dependencies still missing from the system:' . PHP_EOL;
             echo pts_user_io::display_text_list(self::generic_names_to_titles($generic_packages_needed));
             $actions = array('IGNORE' => 'Ignore missing dependencies and proceed with installation.', 'SKIP_TESTS_WITH_MISSING_DEPS' => 'Skip installing the tests with missing dependencies.', 'REATTEMPT_DEP_INSTALL' => 'Re-attempt to install the missing dependencies.', 'QUIT' => 'Quit the current Phoronix Test Suite process.');
             $selected_action = pts_user_io::prompt_text_menu('Missing dependencies action', $actions, false, true);
             switch ($selected_action) {
                 case 'IGNORE':
                     break;
                 case 'SKIP_TESTS_WITH_MISSING_DEPS':
                     // Unset the tests that have dependencies still missing
                     self::remove_tests_with_missing_dependencies($test_profiles, $generic_packages_needed, $required_test_dependencies);
                     break;
//.........这里部分代码省略.........
开发者ID:pchiruma,项目名称:phoronix-test-suite,代码行数:101,代码来源:pts_external_dependencies.php

示例10: render_graph_process


//.........这里部分代码省略.........
             break;
         default:
             if (isset($extra_attributes['graph_render_type'])) {
                 $requested_graph_type = $extra_attributes['graph_render_type'];
             } else {
                 if (defined('GRAPH_RENDER_TYPE')) {
                     $requested_graph_type = GRAPH_RENDER_TYPE;
                 } else {
                     $requested_graph_type = null;
                 }
             }
             switch ($requested_graph_type) {
                 case 'CANDLESTICK':
                     $graph = new pts_CandleStickGraph($result_object, $result_file);
                     break;
                 case 'LINE_GRAPH':
                     $graph = new pts_LineGraph($result_object, $result_file);
                     break;
                 case 'FILLED_LINE_GRAPH':
                     $graph = new pts_FilledLineGraph($result_object, $result_file);
                     break;
                 default:
                     if ($bar_orientation == 'VERTICAL') {
                         $graph = new pts_VerticalBarGraph($result_object, $result_file);
                     } else {
                         $graph = new pts_HorizontalBarGraph($result_object, $result_file);
                     }
                     break;
             }
             break;
     }
     if (isset($extra_attributes['regression_marker_threshold'])) {
         $graph->markResultRegressions($extra_attributes['regression_marker_threshold']);
     }
     if (isset($extra_attributes['set_alternate_view'])) {
         $graph->setAlternateView($extra_attributes['set_alternate_view']);
     }
     if (isset($extra_attributes['sort_result_buffer_values'])) {
         $result_object->test_result_buffer->buffer_values_sort();
         if ($result_object->test_profile->get_result_proportion() == 'HIB') {
             $result_object->test_result_buffer->buffer_values_reverse();
         }
     }
     if (isset($extra_attributes['highlight_graph_values'])) {
         $graph->highlight_values($extra_attributes['highlight_graph_values']);
     }
     if (isset($extra_attributes['force_simple_keys'])) {
         $graph->override_i_value('force_simple_keys', true);
     } else {
         if (PTS_IS_CLIENT && pts_client::read_env('GRAPH_HIGHLIGHT') != false) {
             $graph->highlight_values(pts_strings::comma_explode(pts_client::read_env('GRAPH_HIGHLIGHT')));
         }
     }
     switch ($display_format) {
         case 'LINE_GRAPH':
             if (isset($extra_attributes['no_overview_text']) && $graph instanceof pts_LineGraph) {
                 $graph->plot_overview_text = false;
             }
         case 'FILLED_LINE_GRAPH':
         case 'BAR_ANALYZE_GRAPH':
         case 'SCATTER_PLOT':
             //$graph->hideGraphIdentifiers();
             foreach ($result_object->test_result_buffer->get_buffer_items() as $buffer_item) {
                 $graph->loadGraphValues(pts_strings::comma_explode($buffer_item->get_result_value()), $buffer_item->get_result_identifier());
                 $graph->loadGraphRawValues(pts_strings::comma_explode($buffer_item->get_result_raw()));
             }
             $scale_special = $result_object->test_profile->get_result_scale_offset();
             if (!empty($scale_special) && count($ss = pts_strings::comma_explode($scale_special)) > 0) {
                 $graph->loadGraphIdentifiers($ss);
             }
             break;
         case 'HORIZONTAL_BOX_PLOT':
             // TODO: should be able to load pts_test_result_buffer_item objects more cleanly into pts_Graph
             $identifiers = array();
             $values = array();
             foreach ($result_object->test_result_buffer->get_buffer_items() as $buffer_item) {
                 array_push($identifiers, $buffer_item->get_result_identifier());
                 array_push($values, pts_strings::comma_explode($buffer_item->get_result_value()));
             }
             $graph->loadGraphIdentifiers($identifiers);
             $graph->loadGraphValues($values);
             break;
         default:
             // TODO: should be able to load pts_test_result_buffer_item objects more cleanly into pts_Graph
             $identifiers = array();
             $values = array();
             $raw_values = array();
             foreach ($result_object->test_result_buffer->get_buffer_items() as $buffer_item) {
                 array_push($identifiers, $buffer_item->get_result_identifier());
                 array_push($values, $buffer_item->get_result_value());
                 array_push($raw_values, $buffer_item->get_result_raw());
             }
             $graph->loadGraphIdentifiers($identifiers);
             $graph->loadGraphValues($values);
             $graph->loadGraphRawValues($raw_values);
             break;
     }
     self::report_test_notes_to_graph($graph, $result_object);
     return $graph;
 }
开发者ID:pchiruma,项目名称:phoronix-test-suite,代码行数:101,代码来源:pts_render.php

示例11: sw_wine_version

 public static function sw_wine_version()
 {
     $wine_version = null;
     if (pts_client::executable_in_path('wine') != false) {
         $wine_version = trim(shell_exec('wine --version 2>&1'));
     } else {
         if (pts_client::executable_in_path('winecfg.exe') != false && pts_client::read_env('WINE_VERSION')) {
             $wine_version = trim(pts_client::read_env('WINE_VERSION'));
             if (stripos($wine_version, 'wine') === false) {
                 $wine_version = 'wine-' . $wine_version;
             }
         }
     }
     return $wine_version;
 }
开发者ID:pchiruma,项目名称:phoronix-test-suite,代码行数:15,代码来源:phodevi_system.php

示例12: prompt_user_options

 public static function prompt_user_options(&$test_profile, $preset_selections = null)
 {
     $user_args = array();
     $text_args = array();
     if (($cli_presets_env = pts_client::read_env('PRESET_OPTIONS')) != false) {
         // To specify test options externally from an environment variable
         // i.e. PRESET_OPTIONS='stream.run-type=Add' ./phoronix-test-suite benchmark stream
         // The string format is <test-name>.<test-option-name-from-XML-file>=<test-option-value>
         // The test-name can either be the short/base name (e.g. stream) or the full identifier (pts/stream) without version postfix
         // Multiple preset options can be delimited with the PRESET_OPTIONS environment variable via a semicolon ;
         $preset_selections = pts_client::parse_value_string_double_identifier($cli_presets_env);
     }
     $identifier_short = $test_profile->get_identifier_base_name();
     $identifier_full = $test_profile->get_identifier(false);
     if (count($test_profile->get_test_option_objects()) > 0) {
         pts_client::$display->test_run_configure($test_profile);
     }
     foreach ($test_profile->get_test_option_objects() as $i => $o) {
         $option_identifier = $o->get_identifier();
         if ($o->option_count() == 0) {
             // User inputs their option as there is nothing to select
             if (isset($preset_selections[$identifier_short][$option_identifier])) {
                 $value = $preset_selections[$identifier_short][$option_identifier];
                 echo PHP_EOL . '    Using Pre-Set Run Option: ' . $value . PHP_EOL;
             } else {
                 if (isset($preset_selections[$identifier_full][$option_identifier])) {
                     $value = $preset_selections[$identifier_full][$option_identifier];
                     echo PHP_EOL . '    Using Pre-Set Run Option: ' . $value . PHP_EOL;
                 } else {
                     echo PHP_EOL . $o->get_name() . PHP_EOL;
                     $value = pts_user_io::prompt_user_input('Enter Value');
                 }
             }
             array_push($text_args, array($o->format_option_display_from_input($value)));
             array_push($user_args, array($o->format_option_value_from_input($value)));
         } else {
             // Have the user select the desired option
             if (isset($preset_selections[$identifier_short][$option_identifier])) {
                 $bench_choice = $preset_selections[$identifier_short][$option_identifier];
                 echo PHP_EOL . '    Using Pre-Set Run Option: ' . $bench_choice . PHP_EOL;
             } else {
                 if (isset($preset_selections[$identifier_full][$option_identifier])) {
                     $bench_choice = $preset_selections[$identifier_full][$option_identifier];
                     echo PHP_EOL . '    Using Pre-Set Run Option: ' . $bench_choice . PHP_EOL;
                 } else {
                     $option_names = $o->get_all_option_names_with_messages();
                     if (count($option_names) > 1) {
                         //echo PHP_EOL . $o->get_name() . ':' . PHP_EOL;
                         array_push($option_names, 'Test All Options');
                     }
                     $bench_choice = pts_user_io::prompt_text_menu($o->get_name(), $option_names, true, true, pts_client::$display->get_tab() . pts_client::$display->get_tab());
                     echo PHP_EOL;
                 }
             }
             $bench_choice = $o->parse_selection_choice_input($bench_choice);
             // Format the selected option(s)
             $option_args = array();
             $option_args_description = array();
             foreach ($bench_choice as $c) {
                 array_push($option_args, $o->format_option_value_from_select($c));
                 array_push($option_args_description, $o->format_option_display_from_select($c));
             }
             array_push($text_args, $option_args_description);
             array_push($user_args, $option_args);
         }
     }
     $test_args = array();
     $test_args_description = array();
     self::compute_all_combinations($test_args, null, $user_args, 0);
     self::compute_all_combinations($test_args_description, null, $text_args, 0, ' - ');
     return array($test_args, $test_args_description);
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:72,代码来源:pts_test_run_options.php

示例13: run_matisk


//.........这里部分代码省略.........
            if($ini['workload']['result_identifier'] == null)
            {
            	echo PHP_EOL . 'The result_identifier field cannot be left empty when saving the test results.' . PHP_EOL;
            	return false;
            }
            */
        }
        if (!empty($ini['environmental_variables']) && is_array($ini['environmental_variables'])) {
            foreach ($ini['environmental_variables'] as $key => $value) {
                putenv(trim($key) . '=' . trim($value));
            }
        }
        if (empty($ini['set_context']['context'])) {
            $ini['set_context']['context'] = array($ini['workload']['result_identifier']);
        }
        if (pts_strings::string_bool($ini['set_context']['log_context_outputs'])) {
            pts_file_io::mkdir(pts_module::save_dir() . $ini['workload']['save_name']);
        }
        $spent_context_file = pts_module::save_dir() . $ini['workload']['save_name'] . '.spent-contexts';
        if (!is_file($spent_context_file)) {
            touch($spent_context_file);
        } else {
            // If recovering from an existing run, don't rerun contexts that were already executed
            $spent_contexts = pts_file_io::file_get_contents($spent_context_file);
            $spent_contexts = explode(PHP_EOL, $spent_contexts);
            foreach ($spent_contexts as $sc) {
                if (($key = array_search($sc, $ini['set_context']['context'])) !== false) {
                    unset($ini['set_context']['context'][$key]);
                }
            }
        }
        if ($ini['set_context']['reboot_support'] && phodevi::is_linux()) {
            // In case a set-context involves a reboot, auto-recover
            $xdg_config_home = is_dir('/etc/xdg/autostart') && is_writable('/etc/xdg/autostart') ? '/etc/xdg/autostart' : pts_client::read_env('XDG_CONFIG_HOME');
            if ($xdg_config_home == false) {
                $xdg_config_home = pts_client::user_home_directory() . '.config';
            }
            if ($xdg_config_home != false && is_dir($xdg_config_home)) {
                $autostart_dir = $xdg_config_home . '/autostart/';
                pts_file_io::mkdir($xdg_config_home . '/autostart/');
            }
            file_put_contents($xdg_config_home . '/autostart/phoronix-test-suite-matisk.desktop', '
[Desktop Entry]
Name=Phoronix Test Suite Matisk Recovery
GenericName=Phoronix Test Suite
Comment=Matisk Auto-Recovery Support
Exec=gnome-terminal -e \'phoronix-test-suite matisk ' . $args[0] . '\'
Icon=phoronix-test-suite
Type=Application
Encoding=UTF-8
Categories=System;Monitor;');
        }
        if ($ini['installation']['block_phodevi_caching']) {
            // Block Phodevi caching if changing out system components and there is a chance one of the strings of changed contexts might be cached (e.g. OpenGL user-space driver)
            phodevi::$allow_phodevi_caching = false;
        }
        if (phodevi::system_uptime() < 60) {
            echo PHP_EOL . 'Sleeping 45 seconds while waiting for the system to settle...' . PHP_EOL;
            sleep(45);
        }
        self::$ini = $ini;
        $total_context_count = count(self::$ini['set_context']['context']);
        while (($context = array_shift(self::$ini['set_context']['context'])) !== null) {
            echo PHP_EOL . ($total_context_count - count(self::$ini['set_context']['context'])) . ' of ' . $total_context_count . ' in test execution queue [' . $context . ']' . PHP_EOL . PHP_EOL;
            self::$context = $context;
            if (pts_strings::string_bool(self::$ini['installation']['install_check']) || $ini['set_context']['pre_install'] != null) {
开发者ID:numerant,项目名称:phoronix-test-suite,代码行数:67,代码来源:matisk.php

示例14: check_file_hash

 public function check_file_hash($file)
 {
     if (!is_file($file)) {
         return false;
     } else {
         if (pts_client::read_env('NO_FILE_HASH_CHECKS') != false || pts_flags::skip_md5_checks()) {
             return true;
         } else {
             if ($this->sha256) {
                 return hash_file('sha256', $file) == $this->sha256;
             } else {
                 if ($this->md5) {
                     return md5_file($file) == $this->md5;
                 } else {
                     if (filesize($file) > 0) {
                         return true;
                     } else {
                         return false;
                     }
                 }
             }
         }
     }
 }
开发者ID:pchiruma,项目名称:phoronix-test-suite,代码行数:24,代码来源:pts_test_file_download.php

示例15: detect_modules_to_load

 public static function detect_modules_to_load()
 {
     // Auto detect modules to load
     $env_vars = pts_storage_object::read_from_file(PTS_TEMP_STORAGE, 'environmental_variables_for_modules');
     if ($env_vars == false) {
         $env_vars = pts_module_manager::modules_environmental_variables();
     }
     foreach ($env_vars as $env_var => $modules) {
         if (($e = pts_client::read_env($env_var)) != false && !empty($e)) {
             foreach ($modules as $module) {
                 if (!pts_module_manager::is_module_attached($module)) {
                     pts_module_manager::attach_module($module);
                 }
             }
         }
     }
 }
开发者ID:rkingsbury,项目名称:phoronix-test-suite,代码行数:17,代码来源:pts_module_manager.php


注:本文中的pts_client::read_env方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。