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


PHP pts_client::set_test_flags方法代码示例

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


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

示例1: standard_install

 public static function standard_install($items_to_install, $test_flags = 0)
 {
     // Refresh the pts_client::$display in case we need to run in debug mode
     if (pts_client::$display == false || $test_flags != 0 && !pts_client::$display instanceof pts_websocket_display_mode) {
         pts_client::init_display_mode($test_flags);
     }
     // Create a lock
     $lock_path = pts_client::temporary_directory() . '/phoronix-test-suite.active';
     pts_client::create_lock($lock_path);
     pts_client::set_test_flags($test_flags);
     // Get the test profiles
     $unknown_tests = array();
     $test_profiles = pts_types::identifiers_to_test_profile_objects($items_to_install, true, true, $unknown_tests);
     // Any external dependencies?
     pts_external_dependencies::install_dependencies($test_profiles);
     // Install tests
     if (!is_writable(pts_client::test_install_root_path())) {
         trigger_error('The test installation directory is not writable.' . PHP_EOL . 'Location: ' . pts_client::test_install_root_path(), E_USER_ERROR);
         return false;
     }
     pts_test_installer::start_install($test_profiles, $unknown_tests);
     pts_client::release_lock($lock_path);
     return $test_profiles;
 }
开发者ID:pchiruma,项目名称:phoronix-test-suite,代码行数:24,代码来源:pts_test_installer.php

示例2: run

 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));
         }
         $test_flags = pts_c::auto_mode | pts_c::defaults_mode | pts_c::batch_mode;
         pts_client::set_test_flags($test_flags);
         if ($allow_new_tests_to_be_installed) {
             if ($allow_new_dependencies_to_be_installed == false) {
                 $test_flags |= pts_c::skip_tests_with_missing_dependencies;
             }
             pts_test_installer::standard_install($to_test, $test_flags);
         }
         $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);
         if (pts_test_run_manager::initial_checks($to_test, $test_flags) != false) {
             $test_run_manager = new pts_test_run_manager($test_flags);
             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_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);
     }
 }
开发者ID:pchiruma,项目名称:phoronix-test-suite,代码行数:93,代码来源:run_random_tests.php

示例3: run_connection


//.........这里部分代码省略.........
                             if (count($var) == 2) {
                                 putenv($var[0] . '=' . $var[1]);
                             }
                         }
                     }
                     switch (isset($json['phoromatic']['task']) ? $json['phoromatic']['task'] : null) {
                         case 'install':
                             phoromatic::update_system_status('Installing Tests');
                             pts_suite_nye_XmlReader::set_temporary_suite('pre-seed', $json['phoromatic']['test_suite']);
                             pts_test_installer::standard_install('pre-seed');
                             break;
                         case 'benchmark':
                             // Make sure all latest tests are available
                             pts_openbenchmarking::refresh_repository_lists(null, true);
                             $benchmark_timer = time();
                             self::$is_running_as_phoromatic_node = true;
                             $test_flags = pts_c::auto_mode | pts_c::batch_mode;
                             $suite_identifier = sha1(time() . rand(2, 1000));
                             pts_suite_nye_XmlReader::set_temporary_suite($suite_identifier, $json['phoromatic']['test_suite']);
                             self::$p_save_identifier = $json['phoromatic']['trigger_id'];
                             $phoromatic_results_identifier = self::$p_save_identifier;
                             $phoromatic_save_identifier = $json['phoromatic']['save_identifier'];
                             self::$p_schedule_id = isset($json['phoromatic']['schedule_id']) ? $json['phoromatic']['schedule_id'] : false;
                             self::$p_trigger_id = self::$p_save_identifier;
                             $benchmark_ticket_id = isset($json['phoromatic']['benchmark_ticket_id']) ? $json['phoromatic']['benchmark_ticket_id'] : null;
                             phoromatic::update_system_status('Running Benchmarks For: ' . $phoromatic_save_identifier);
                             if (pts_strings::string_bool($json['phoromatic']['settings']['RunInstallCommand'])) {
                                 if (isset($json['phoromatic']['pre_install_set_context'])) {
                                     phoromatic::set_user_context($json['phoromatic']['pre_install_set_context'], self::$p_trigger_id, self::$p_schedule_id, 'PRE_INSTALL');
                                 }
                                 if (pts_strings::string_bool($json['phoromatic']['settings']['ForceInstallTests'])) {
                                     $test_flags |= pts_c::force_install;
                                 }
                                 pts_client::set_test_flags($test_flags);
                                 pts_test_installer::standard_install($suite_identifier);
                                 if (isset($json['phoromatic']['post_install_set_context'])) {
                                     phoromatic::set_user_context($json['phoromatic']['post_install_set_context'], self::$p_trigger_id, self::$p_schedule_id, 'POST_INSTALL');
                                 }
                             }
                             $env_vars = isset($json['phoromatic']['environment_variables']) ? pts_strings::parse_value_string_vars($json['phoromatic']['environment_variables']) : array();
                             // Do the actual running
                             phodevi::clear_cache();
                             if (pts_test_run_manager::initial_checks($suite_identifier, 0, 'SHORT')) {
                                 self::$test_run_manager = new pts_test_run_manager($test_flags);
                                 pts_test_run_manager::set_batch_mode(array('UploadResults' => isset($json['phoromatic']['settings']['UploadResultsToOpenBenchmarking']) && pts_strings::string_bool($json['phoromatic']['settings']['UploadResultsToOpenBenchmarking']), 'SaveResults' => true, 'RunAllTestCombinations' => false, 'OpenBrowser' => false));
                                 // Load the tests to run
                                 if (self::$test_run_manager->load_tests_to_run($suite_identifier)) {
                                     phoromatic::update_system_status('Tests In Run Queue: ' . implode(', ', self::$test_run_manager->get_tests_to_run_identifiers()));
                                     if (isset($json['phoromatic']['pre_run_set_context'])) {
                                         phoromatic::set_user_context($json['phoromatic']['pre_run_set_context'], self::$p_trigger_id, self::$p_schedule_id, 'PRE_RUN');
                                     }
                                     if (isset($json['phoromatic']['settings']['UploadResultsToOpenBenchmarking']) && pts_strings::string_bool($json['phoromatic']['settings']['UploadResultsToOpenBenchmarking'])) {
                                         self::$test_run_manager->auto_upload_to_openbenchmarking();
                                         pts_openbenchmarking_client::override_client_setting('UploadSystemLogsByDefault', pts_strings::string_bool($json['phoromatic']['settings']['UploadSystemLogs']));
                                     }
                                     // Save results?
                                     // Run the actual tests
                                     if (isset($env_vars['PTS_CONCURRENT_TEST_RUNS']) && $env_vars['PTS_CONCURRENT_TEST_RUNS'] > 1) {
                                         $total_loop_time = isset($env_vars['TOTAL_LOOP_TIME']) ? $env_vars['TOTAL_LOOP_TIME'] : false;
                                         pts_client::$pts_logger->log('STRESS / MULTI-TEST EXECUTION STARTED @ ' . date('Y-m-d H:i:s'));
                                         pts_client::$pts_logger->log('CONCURRENT RUNS = ' . $env_vars['PTS_CONCURRENT_TEST_RUNS'] . ' TOTAL LOOP TIME = ' . $total_loop_time);
                                         $r = self::$test_run_manager->multi_test_stress_run_execute($env_vars['PTS_CONCURRENT_TEST_RUNS'], $total_loop_time);
                                         if ($r == false) {
                                             return;
                                         }
                                         pts_client::$pts_logger->log('STRESS / MULTI-TEST EXECUTION ENDED @ ' . date('Y-m-d H:i:s'));
开发者ID:abartol,项目名称:phoronix-test-suite,代码行数:67,代码来源:phoromatic.php

示例4: user_system_process

 public static function user_system_process()
 {
     $last_communication_minute = date('i');
     $communication_attempts = 0;
     static $current_hw = null;
     static $current_sw = null;
     if (define('PHOROMATIC_START', true)) {
         echo PHP_EOL . 'Registering Status With Phoromatic Server @ ' . date('H:i:s') . PHP_EOL;
         $times_tried = 0;
         do {
             if ($times_tried > 0) {
                 echo PHP_EOL . 'Connection to server failed. Trying again in 60 seconds...' . PHP_EOL;
                 sleep(60);
             }
             $update_sd = phoromatic::update_system_details();
             $times_tried++;
         } while (!$update_sd && $times_tried < 5);
         if (!$update_sd) {
             echo 'Server connection still failed. Exiting...' . PHP_EOL;
             return false;
         }
         $current_hw = phodevi::system_hardware(true);
         $current_sw = phodevi::system_software(true);
         echo PHP_EOL . 'Idling 30 seconds for system to settle...' . PHP_EOL;
         sleep(30);
     }
     do {
         $exit_loop = false;
         echo PHP_EOL . 'Checking Status From Phoromatic Server @ ' . date('H:i:s');
         if ($last_communication_minute == date('i') && $communication_attempts > 2) {
             // Something is wrong, Phoromatic shouldn't be communicating with server more than three times a minute
             $response = M_PHOROMATIC_RESPONSE_IDLE;
         } else {
             $server_response = phoromatic::upload_to_remote_server(array('r' => 'status_check'));
             $xml_parser = new nye_XmlReader($server_response);
             $response = $xml_parser->getXMLValue(M_PHOROMATIC_GEN_RESPONSE);
             if (date('i') != $last_communication_minute) {
                 $last_communication_minute = date('i');
                 $communication_attempts = 0;
             }
             $communication_attempts++;
         }
         echo ' [' . $response . ']' . PHP_EOL;
         switch ($response) {
             case M_PHOROMATIC_RESPONSE_RUN_TEST:
                 $test_flags = pts_c::auto_mode | pts_c::recovery_mode;
                 do {
                     $suite_identifier = 'phoromatic-' . rand(1000, 9999);
                 } while (is_file(PTS_TEST_SUITE_PATH . 'local/' . $suite_identifier . '/suite-definition.xml'));
                 file_put_contents(PTS_TEST_SUITE_PATH . 'local/' . $suite_identifier . '/suite-definition.xml', $server_response);
                 $phoromatic_schedule_id = $xml_parser->getXMLValue(M_PHOROMATIC_ID);
                 $phoromatic_results_identifier = $xml_parser->getXMLValue(M_PHOROMATIC_SYS_NAME);
                 $phoromatic_trigger = $xml_parser->getXMLValue(M_PHOROMATIC_TRIGGER);
                 if (pts_strings::string_bool($xml_parser->getXMLValue(M_PHOROMATIC_RUN_INSTALL_COMMAND, M_PHOROMATIC_RESPONSE_TRUE))) {
                     phoromatic::set_user_context($xml_parser->getXMLValue(M_PHOROMATIC_SET_CONTEXT_PRE_INSTALL), $phoromatic_trigger, $phoromatic_schedule_id, 'INSTALL');
                     pts_client::set_test_flags($test_flags);
                     pts_test_installer::standard_install($suite_identifier);
                 }
                 phoromatic::set_user_context($xml_parser->getXMLValue(M_PHOROMATIC_SET_CONTEXT_PRE_RUN), $phoromatic_trigger, $phoromatic_schedule_id, 'INSTALL');
                 // Do the actual running
                 if (pts_test_run_manager::initial_checks($suite_identifier)) {
                     $test_run_manager = new pts_test_run_manager($test_flags);
                     // Load the tests to run
                     if ($test_run_manager->load_tests_to_run($suite_identifier)) {
                         if (pts_strings::string_bool($xml_parser->getXMLValue(M_PHOROMATIC_UPLOAD_TO_GLOBAL, 'FALSE'))) {
                             $test_run_manager->auto_upload_to_openbenchmarking();
                         }
                         // Save results?
                         $test_run_manager->auto_save_results(date('Y-m-d H:i:s'), $phoromatic_results_identifier, 'A Phoromatic run.');
                         // Run the actual tests
                         $test_run_manager->pre_execution_process();
                         $test_run_manager->call_test_runs();
                         $test_run_manager->post_execution_process();
                         // Upload to Phoromatic
                         pts_file_io::unlink(PTS_TEST_SUITE_PATH . 'local/' . $suite_identifier . '/suite-definition.xml');
                         // Upload test results
                         if (is_file(PTS_SAVE_RESULTS_PATH . $save_identifier . '/composite.xml')) {
                             phoromatic::update_system_status('Uploading Test Results');
                             $times_tried = 0;
                             do {
                                 if ($times_tried > 0) {
                                     echo PHP_EOL . 'Connection to server failed. Trying again in 60 seconds...' . PHP_EOL;
                                     sleep(60);
                                 }
                                 $uploaded_test_results = phoromatic::upload_test_results($save_identifier, $phoromatic_schedule_id, $phoromatic_results_identifier, $phoromatic_trigger);
                                 $times_tried++;
                             } while ($uploaded_test_results == false && $times_tried < 5);
                             if ($uploaded_test_results == false) {
                                 echo 'Server connection failed. Exiting...' . PHP_EOL;
                                 return false;
                             }
                             if (pts_strings::string_bool($xml_parser->getXMLValue(M_PHOROMATIC_ARCHIVE_RESULTS_LOCALLY, M_PHOROMATIC_RESPONSE_TRUE)) == false) {
                                 pts_client::remove_saved_result_file($save_identifier);
                             }
                         }
                     }
                 }
                 break;
             case M_PHOROMATIC_RESPONSE_EXIT:
                 echo PHP_EOL . 'Phoromatic received a remote command to exit.' . PHP_EOL;
//.........这里部分代码省略.........
开发者ID:pchiruma,项目名称:phoronix-test-suite,代码行数:101,代码来源:ekofisk.php

示例5: initial_checks

 public static function initial_checks(&$to_run, $test_flags = 0, $override_display_mode = false)
 {
     // Refresh the pts_client::$display in case we need to run in debug mode
     $test_flags |= pts_c::is_run_process;
     if (pts_client::$display == false || $test_flags != 0 && !pts_client::$display instanceof pts_websocket_display_mode) {
         pts_client::init_display_mode($test_flags, $override_display_mode);
     }
     pts_client::set_test_flags($test_flags);
     $to_run = pts_types::identifiers_to_objects($to_run);
     if (pts_c::$test_flags & pts_c::batch_mode) {
         if (self::$batch_mode_options === false) {
             self::set_batch_mode();
         }
         if (self::$batch_mode_options['Configured'] == false && pts_c::$test_flags ^ pts_c::auto_mode) {
             trigger_error('The batch mode must first be configured.' . PHP_EOL . 'To configure, run phoronix-test-suite batch-setup', E_USER_ERROR);
             return false;
         }
     }
     if (!is_writable(pts_client::test_install_root_path())) {
         trigger_error('The test installation directory is not writable.' . PHP_EOL . 'Location: ' . pts_client::test_install_root_path(), E_USER_ERROR);
         return false;
     }
     // Cleanup tests to run
     if (pts_test_run_manager::cleanup_tests_to_run($to_run) == false) {
         return false;
     } else {
         if (count($to_run) == 0) {
             trigger_error('You must enter at least one test, suite, or result identifier to run.', E_USER_ERROR);
             return false;
         }
     }
     return true;
 }
开发者ID:pchiruma,项目名称:phoronix-test-suite,代码行数:33,代码来源:pts_test_run_manager.php

示例6: run_benchmark

 public function run_benchmark($user, $args)
 {
     $json_queue = json_decode(base64_decode($args), true);
     $json['pts']['msg']['name'] = 'run_benchmark_queue';
     if (!isset($json_queue['tests']) || count($json_queue['tests']) == 0) {
         $json['pts']['msg']['error'] = 'No tests in the queue.';
     } else {
         if (!isset($json_queue['title']) || $json_queue['title'] == null) {
             $json['pts']['msg']['error'] = 'No test title/name provided.';
         } else {
             if (!isset($json_queue['identifier']) || $json_queue['identifier'] == null) {
                 $json['pts']['msg']['error'] = 'No test identifier provided.';
             } else {
                 $json['pts']['msg']['go'] = 'Benchmarking.';
             }
         }
     }
     $this->send_json_data($user->socket, $json);
     if (isset($json['pts']['msg']['error']) && $json['pts']['msg']['error'] != null) {
         exit(1);
     }
     pts_client::$display = new pts_websocket_display_mode();
     pts_client::$display->set_web_socket($this, $user->id);
     $virtual_test_queue = array();
     $virtual_test_queue[0] = new pts_virtual_test_queue();
     foreach ($json_queue['tests'] as $test) {
         $virtual_test_queue[0]->add_to_queue($test['test_profile_id'], $test['test_options_title'], $test['test_options_value']);
     }
     $test_flags = pts_c::auto_mode;
     // | pts_c::debug_mode
     pts_client::set_test_flags($test_flags);
     pts_test_installer::standard_install($virtual_test_queue);
     if (pts_test_run_manager::initial_checks($virtual_test_queue, $test_flags) == false) {
         $j['pts']['msg']['name'] = 'benchmark_state';
         $j['pts']['msg']['current_state'] = 'failed';
         $j['pts']['msg']['error'] = 'Failed to install test.';
         $this->send_json_data($user->socket, $j);
         exit(1);
     }
     $test_run_manager = new pts_test_run_manager($test_flags);
     if ($test_run_manager->load_tests_to_run($virtual_test_queue)) {
         // SETUP
         $test_run_manager->auto_upload_to_openbenchmarking();
         pts_openbenchmarking_client::override_client_setting('UploadSystemLogsByDefault', true);
         $test_run_manager->auto_save_results($json_queue['title'], $json_queue['identifier'], $json_queue['description'], true);
         // BENCHMARK
         $test_run_manager->pre_execution_process();
         $test_run_manager->call_test_runs();
         $test_run_manager->post_execution_process();
         $j['pts']['msg']['name'] = 'benchmark_state';
         $j['pts']['msg']['current_state'] = 'complete';
         $j['pts']['msg']['result_title'] = $test_run_manager->get_title();
         $j['pts']['msg']['result_file_name'] = $test_run_manager->get_file_name();
         $j['pts']['msg']['result_identifier'] = $test_run_manager->get_results_identifier();
         $j['pts']['msg']['result_url'] = $test_run_manager->get_results_url();
         $this->send_json_data($user->socket, $j);
     }
     exit(0);
 }
开发者ID:pchiruma,项目名称:phoronix-test-suite,代码行数:59,代码来源:pts_web_socket_server_gui.php


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