public static function run($r) { $test_profile = new pts_test_profile($r[0]); if ($test_profile->is_test_installed() == false) { echo PHP_EOL . 'This test is not installed.' . PHP_EOL; return false; } if (pts_user_io::prompt_bool_input('Are you sure you wish to remove the test ' . $test_profile, false)) { pts_client::remove_installed_test($test_profile); echo PHP_EOL . $test_profile . ' has been removed.' . PHP_EOL; } else { echo PHP_EOL; } }
public function call_test_runs() { // Create a lock $lock_path = pts_client::temporary_directory() . '/phoronix-test-suite.active'; pts_client::create_lock($lock_path); if ($this->pre_run_message != null) { pts_client::$display->display_interrupt_message($this->pre_run_message); } // Hook into the module framework self::$test_run_process_active = true; pts_module_manager::module_process('__pre_run_process', $this); pts_file_io::unlink(PTS_USER_PATH . 'halt-testing'); pts_file_io::unlink(PTS_USER_PATH . 'skip-test'); $continue_test_flag = true; $tests_to_run_count = $this->get_test_count(); pts_client::$display->test_run_process_start($this); $total_loop_count = ($t = pts_client::read_env('TOTAL_LOOP_COUNT')) && is_numeric($t) && $t > 0 ? $t : 1; $total_loop_time = ($t = pts_client::read_env('TOTAL_LOOP_TIME')) && is_numeric($t) && $t > 9 ? $t * 60 : -1; $loop_end_time = $total_loop_time != -1 ? time() + $total_loop_time : false; $this->test_run_count = $tests_to_run_count * $total_loop_count; for ($loop = 1; $loop <= $total_loop_count && $continue_test_flag; $loop++) { for ($i = 0; $i < $tests_to_run_count && $continue_test_flag; $i++) { $this->test_run_pos = $i; $continue_test_flag = $this->process_test_run_request($i); if (pts_config::read_bool_config('PhoronixTestSuite/Options/Testing/RemoveTestInstallOnCompletion', 'FALSE')) { // Remove the installed test if it's no longer needed in this run queue $this_test_profile_identifier = $this->get_test_to_run($this->test_run_pos)->test_profile->get_identifier(); $still_in_queue = false; for ($j = $this->test_run_pos + 1; $j < $tests_to_run_count && $still_in_queue == false; $j++) { if ($this->get_test_to_run($j)->test_profile->get_identifier() == $this_test_profile_identifier) { $still_in_queue = true; } } if ($still_in_queue == false) { pts_client::remove_installed_test($this->get_test_to_run($this->test_run_pos)->test_profile); } } if ($loop_end_time) { if (time() > $loop_end_time) { $continue_test_flag = false; } else { if ($this->test_run_count == $i + 1) { // There's still time remaining so increase the run count.... $this->test_run_count += $tests_to_run_count; } } } } } pts_file_io::unlink(PTS_SAVE_RESULTS_PATH . $this->get_file_name() . '/active.xml'); foreach ($this->tests_to_run as &$run_request) { // Remove cache shares foreach (pts_file_io::glob($run_request->test_profile->get_install_dir() . 'cache-share-*.pt2so') as $cache_share_file) { unlink($cache_share_file); } } if ($this->post_run_message != null) { pts_client::$display->display_interrupt_message($this->post_run_message); } self::$test_run_process_active = -1; pts_module_manager::module_process('__post_run_process', $this); pts_client::release_lock($lock_path); // Report any tests that failed to properly run if (pts_client::is_debug_mode() || $this->get_test_count() > 3) { if (count($this->failed_tests_to_run) > 0) { echo PHP_EOL . PHP_EOL . 'The following tests failed to properly run:' . PHP_EOL . PHP_EOL; foreach ($this->failed_tests_to_run as &$run_request) { echo "\t- " . $run_request->test_profile->get_identifier() . ($run_request->get_arguments_description() != null ? ': ' . $run_request->get_arguments_description() : null) . PHP_EOL; } echo PHP_EOL; } } }