public static function run($r) { pts_client::$display->generic_heading('Test Suite Creation'); $suite_name = pts_user_io::prompt_user_input('Enter name of suite'); $suite_test_type = pts_user_io::prompt_text_menu('Select test type', pts_types::subsystem_targets()); $suite_maintainer = pts_user_io::prompt_user_input('Enter suite maintainer name'); $suite_description = pts_user_io::prompt_user_input('Enter suite description'); $possible_suites = pts_openbenchmarking::available_suites(); $possible_tests = pts_openbenchmarking::available_tests(); $suite_writer = new pts_test_suite_writer(); $suite_writer->add_suite_information($suite_name, '1.0.0', $suite_maintainer, $suite_test_type, $suite_description); foreach ($r as $test_object) { $test_object = pts_types::identifier_to_object($test_object); if ($test_object instanceof pts_test_profile) { list($args, $description) = pts_test_run_options::prompt_user_options($test_object); for ($i = 0; $i < count($args); $i++) { // Not binding the test profile version to this suite, otherwise change false to true $suite_writer->add_to_suite($test_object->get_identifier(false), $args[$i], $description[$i]); } } else { if ($test_object instanceof pts_test_suite) { $suite_writer->add_to_suite($test_object->get_identifier(), null, null); } } } $input_option = null; do { switch ($input_option) { case 'Add Test': $test_to_add = pts_user_io::prompt_text_menu('Enter test name', $possible_tests); $test_profile = new pts_test_profile($test_to_add); list($args, $description) = pts_test_run_options::prompt_user_options($test_profile); for ($i = 0; $i < count($args); $i++) { $suite_writer->add_to_suite($test_to_add, $args[$i], $description[$i]); } break; case 'Add Sub-Suite': $suite_to_add = pts_user_io::prompt_text_menu('Enter test suite', $possible_suites); $suite_writer->add_to_suite($suite_to_add, null, null); break; } echo PHP_EOL . 'Available Options:' . PHP_EOL; $input_option = pts_user_io::prompt_text_menu('Select next operation', array('Add Test', 'Add Sub-Suite', 'Save & Exit')); } while ($input_option != 'Save & Exit'); $suite_identifier = $suite_writer->clean_save_name_string($suite_name); $save_to = PTS_TEST_SUITE_PATH . 'local/' . $suite_identifier . '/suite-definition.xml'; mkdir(dirname($save_to)); if ($suite_writer->save_xml($save_to) != false) { echo PHP_EOL . PHP_EOL . 'Saved To: ' . $save_to . PHP_EOL . 'To run this suite, type: phoronix-test-suite benchmark ' . $suite_identifier . PHP_EOL . PHP_EOL; } }
protected function test_prompts_to_result_objects(&$test_profile) { $result_objects = array(); if ($this->batch_mode && $this->batch_mode['RunAllTestCombinations']) { list($test_arguments, $test_arguments_description) = pts_test_run_options::batch_user_options($test_profile); } else { if ($this->auto_mode == 2) { list($test_arguments, $test_arguments_description) = pts_test_run_options::default_user_options($test_profile); } else { list($test_arguments, $test_arguments_description) = pts_test_run_options::prompt_user_options($test_profile); } } foreach (array_keys($test_arguments) as $i) { $test_result = new pts_test_result($test_profile); $test_result->set_used_arguments($test_arguments[$i]); $test_result->set_used_arguments_description($test_arguments_description[$i]); array_push($result_objects, $test_result); } return $result_objects; }