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


PHP pts_client::is_debug_mode方法代码示例

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


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

示例1: test_install_output

 public function test_install_output(&$to_output)
 {
     if (!isset($to_output[10240]) || pts_client::is_debug_mode()) {
         // Not worth printing files over 10kb to screen
         echo $to_output;
     }
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:7,代码来源:pts_basic_display_mode.php

示例2: code_error_handler

 public static function code_error_handler($error_code, $error_string, $error_file, $error_line)
 {
     /*if(!(error_reporting() & $error_code))
     		{
     			return;
     		}*/
     switch ($error_code) {
         case E_USER_ERROR:
             $error_type = 'PROBLEM';
             if (pts_client::is_debug_mode() == false) {
                 $error_file = null;
                 $error_line = 0;
             }
             break;
         case E_USER_NOTICE:
             if (pts_client::is_debug_mode() == false) {
                 return;
             }
             $error_type = 'NOTICE';
             break;
         case E_USER_WARNING:
             $error_type = 'NOTICE';
             // Yes, report warnings as a notice
             if (pts_client::is_debug_mode() == false) {
                 $error_file = null;
                 $error_line = 0;
             }
             break;
         case E_ERROR:
         case E_PARSE:
             $error_type = 'ERROR';
             break;
         case E_WARNING:
         case E_NOTICE:
             $error_type = 'NOTICE';
             if (($s = strpos($error_string, 'Undefined ')) !== false && ($x = strpos($error_string, ': ', $s)) !== false) {
                 $error_string = 'Undefined: ' . substr($error_string, $x + 2);
             } else {
                 $ignore_errors = array('Name or service not known', 'HTTP request failed', 'fopen', 'fsockopen', 'file_get_contents', 'failed to connect', 'unable to connect', 'directory not empty');
                 foreach ($ignore_errors as $error_check) {
                     if (stripos($error_string, $error_check) !== false) {
                         return;
                     }
                 }
             }
             break;
         default:
             $error_type = $error_code;
             break;
     }
     if (pts_client::$pts_logger != false) {
         pts_client::$pts_logger->report_error($error_type, $error_string, $error_file, $error_line);
     }
     if (pts_client::$display != false) {
         pts_client::$display->triggered_system_error($error_type, $error_string, $error_file, $error_line);
     } else {
         echo PHP_EOL . $error_string;
         if ($error_file != null && $error_line != null) {
             echo ' in ' . $error_file . ':' . $error_line;
         }
         echo PHP_EOL;
     }
     if ($error_type == 'ERROR') {
         exit(1);
     }
 }
开发者ID:Grdflo,项目名称:phoronix-test-suite,代码行数:66,代码来源:pts_client.php

示例3: save_results_prompt

 public function save_results_prompt()
 {
     if (!$this->auto_mode) {
         pts_client::$display->generic_heading('System 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;
     }
     if (($this->prompt_save_results || $this->force_save_results) && count($this->tests_to_run) > 0) {
         if ($this->force_save_results || pts_client::read_env('TEST_RESULTS_NAME')) {
             $save_results = true;
         } else {
             if ($this->batch_mode) {
                 $save_results = $this->batch_mode['SaveResults'];
             } else {
                 if (pts_client::is_debug_mode()) {
                     $save_results = false;
                 } else {
                     $save_results = pts_user_io::prompt_bool_input('Would you like to save these test results', true);
                 }
             }
         }
         if ($save_results) {
             // Prompt Save File Name
             $this->prompt_save_name();
             // Prompt Identifier
             $this->prompt_results_identifier();
             if (!isset($this->run_description[16]) || strpos($this->run_description, 'via the Phoronix Test Suite') !== false) {
                 // Write the auto-description if nothing is set or attempt to auto-detect if it was a previous auto-description saved
                 $this->run_description = self::auto_generate_description();
             }
             // Prompt Description
             if (!$this->batch_mode || $this->batch_mode['PromptForTestDescription']) {
                 if ($this->run_description == null) {
                     $this->run_description = 'N/A';
                 }
                 if (pts_client::read_env('TEST_RESULTS_DESCRIPTION')) {
                     if (strlen(pts_client::read_env('TEST_RESULTS_DESCRIPTION')) > 1) {
                         $this->run_description = pts_client::read_env('TEST_RESULTS_DESCRIPTION');
                         echo 'Test Description: ' . $this->run_description . PHP_EOL;
                     }
                 } else {
                     if (!$this->auto_mode) {
                         //echo PHP_EOL . 'Current Title: ' . $this->file_name_title . PHP_EOL;
                         pts_client::$display->generic_heading('If you wish, enter a new description below to better describe this result set / system configuration under test.' . PHP_EOL . 'Press ENTER to proceed without changes.');
                         echo 'Current Description: ' . $this->run_description . PHP_EOL . PHP_EOL . 'New Description: ';
                         $new_test_description = pts_user_io::read_user_input();
                         if (!empty($new_test_description)) {
                             $this->run_description = $new_test_description;
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:Jeni4,项目名称:phoronix-test-suite,代码行数:55,代码来源:pts_test_run_manager.php

示例4: run_test

 public static function run_test(&$test_run_manager, &$test_run_request)
 {
     $test_identifier = $test_run_request->test_profile->get_identifier();
     $extra_arguments = $test_run_request->get_arguments();
     $arguments_description = $test_run_request->get_arguments_description();
     $full_output = pts_config::read_bool_config('PhoronixTestSuite/Options/General/FullOutput', 'FALSE');
     // Do the actual test running process
     $test_directory = $test_run_request->test_profile->get_install_dir();
     if (!is_dir($test_directory)) {
         return false;
     }
     $lock_file = $test_directory . 'run_lock';
     if (pts_client::create_lock($lock_file) == false && $test_run_manager->is_multi_test_stress_run() == false) {
         self::test_run_error($test_run_manager, $test_run_request, 'The ' . $test_identifier . ' test is already running.');
         return false;
     }
     $active_result_buffer = new pts_test_result_buffer_active();
     $test_run_request->active =& $active_result_buffer;
     $execute_binary = $test_run_request->test_profile->get_test_executable();
     $times_to_run = $test_run_request->test_profile->get_times_to_run();
     $ignore_runs = $test_run_request->test_profile->get_runs_to_ignore();
     $test_type = $test_run_request->test_profile->get_test_hardware_type();
     $allow_cache_share = $test_run_request->test_profile->allow_cache_share();
     $min_length = $test_run_request->test_profile->get_min_length();
     $max_length = $test_run_request->test_profile->get_max_length();
     if ($test_run_request->test_profile->get_environment_testing_size() > 1 && ceil(disk_free_space($test_directory) / 1048576) < $test_run_request->test_profile->get_environment_testing_size()) {
         // Ensure enough space is available on disk during testing process
         self::test_run_error($test_run_manager, $test_run_request, 'There is not enough space (at ' . $test_directory . ') for this test to run.');
         pts_client::release_lock($lock_file);
         return false;
     }
     $to_execute = $test_run_request->test_profile->get_test_executable_dir();
     $pts_test_arguments = trim($test_run_request->test_profile->get_default_arguments() . ' ' . str_replace($test_run_request->test_profile->get_default_arguments(), '', $extra_arguments) . ' ' . $test_run_request->test_profile->get_default_post_arguments());
     $extra_runtime_variables = pts_tests::extra_environmental_variables($test_run_request->test_profile);
     // Start
     $cache_share_pt2so = $test_directory . 'cache-share-' . PTS_INIT_TIME . '.pt2so';
     $cache_share_present = $allow_cache_share && is_file($cache_share_pt2so);
     $test_run_request->set_used_arguments_description($arguments_description);
     pts_module_manager::module_process('__pre_test_run', $test_run_request);
     $time_test_start = time();
     pts_client::$display->test_run_start($test_run_manager, $test_run_request);
     if (!$cache_share_present) {
         $pre_output = pts_tests::call_test_script($test_run_request->test_profile, 'pre', 'Running Pre-Test Script', $pts_test_arguments, $extra_runtime_variables, true);
         if ($pre_output != null && (pts_client::is_debug_mode() || $full_output)) {
             pts_client::$display->test_run_instance_output($pre_output);
         }
         if (is_file($test_directory . 'pre-test-exit-status')) {
             // If the pre script writes its exit status to ~/pre-test-exit-status, if it's non-zero the test run failed
             $exit_status = pts_file_io::file_get_contents($test_directory . 'pre-test-exit-status');
             unlink($test_directory . 'pre-test-exit-status');
             if ($exit_status != 0) {
                 self::test_run_instance_error($test_run_manager, $test_run_request, 'The pre run script exited with a non-zero exit status.' . PHP_EOL);
                 self::test_run_error($test_run_manager, $test_run_request, 'This test execution has been abandoned.');
                 return false;
             }
         }
     }
     pts_client::$display->display_interrupt_message($test_run_request->test_profile->get_pre_run_message());
     $runtime_identifier = time();
     $execute_binary_prepend = '';
     if ($test_run_request->exec_binary_prepend != null) {
         $execute_binary_prepend = $test_run_request->exec_binary_prepend;
     }
     if (!$cache_share_present && $test_run_request->test_profile->is_root_required()) {
         if (phodevi::is_root() == false) {
             pts_client::$display->test_run_error('This test must be run as the root / administrator account.');
         }
         $execute_binary_prepend .= ' ' . PTS_CORE_STATIC_PATH . 'root-access.sh ';
     }
     if ($allow_cache_share && !is_file($cache_share_pt2so)) {
         $cache_share = new pts_storage_object(false, false);
     }
     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) {
//.........这里部分代码省略.........
开发者ID:pacificIT,项目名称:phoronix-test-suite,代码行数:101,代码来源:pts_test_execution.php

示例5: test_run_instance_output

 public function test_run_instance_output(&$to_output)
 {
     if (pts_client::is_debug_mode()) {
         echo $to_output;
     }
     return;
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:7,代码来源:pts_concise_display_mode.php


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