diff options
author | Michael Larabel <michael@phx-laptop.(none)> | 2008-11-30 18:54:38 -0500 |
---|---|---|
committer | Michael Larabel <michael@phx-laptop.(none)> | 2008-11-30 18:54:38 -0500 |
commit | 068c038200c3fedc39b3a1fa28724eff115a79ec (patch) | |
tree | 0be0554f4d886d35bb5ad174a7099ee2efe6d7fc /pts-core/functions/pts-functions-run.php | |
parent | eb5c8a8d5d71e88dd88c80193b21ab3fae34c32b (diff) | |
download | phoronix-test-suite-upstream-068c038200c3fedc39b3a1fa28724eff115a79ec.tar.gz phoronix-test-suite-upstream-068c038200c3fedc39b3a1fa28724eff115a79ec.tar.xz phoronix-test-suite-upstream-068c038200c3fedc39b3a1fa28724eff115a79ec.zip |
pts-core: Clean up / functionize more benchmark run code
Diffstat (limited to 'pts-core/functions/pts-functions-run.php')
-rw-r--r-- | pts-core/functions/pts-functions-run.php | 149 |
1 files changed, 146 insertions, 3 deletions
diff --git a/pts-core/functions/pts-functions-run.php b/pts-core/functions/pts-functions-run.php index f3ac612..2ae7359 100644 --- a/pts-core/functions/pts-functions-run.php +++ b/pts-core/functions/pts-functions-run.php @@ -88,6 +88,102 @@ function pts_prompt_results_identifier($current_identifiers = null) return $RESULTS_IDENTIFIER; } +function pts_prompt_svg_result_options($svg_file) +{ + // Image graph result driven test selection + $svg_parser = new tandem_XmlReader($svg_file); + $svg_test = array_pop($svg_parser->getStatement("Test")); + $svg_identifier = array_pop($svg_parser->getStatement("Identifier")); + $test_to_run = null; + + if(!empty($svg_test) && !empty($svg_identifier)) + { + $run_options = array(); + if(pts_is_test($svg_test)) + { + array_push($run_options, array($svg_test, "Run this test (" . $svg_test . ")")); + } + if(pts_is_suite($svg_identifier)) + { + array_push($run_options, array($svg_identifier, "Run this suite (" . $svg_identifier . ")")); + } + else if(pts_is_global_id($svg_identifier)) + { + array_push($run_options, array($svg_identifier, "Run this Phoronix Global comparison (" . $svg_identifier . ")")); + } + + $run_option_count = count($run_options); + if($run_option_count > 0) + { + if($run_option_count == 1) + { + $test_to_run = $run_options[0][0]; + } + else + { + do + { + echo "\n"; + for($i = 0; $i < $run_option_count; $i++) + { + echo ($i + 1) . ": " . $run_options[$i][1] . "\n"; + } + echo "\nPlease Enter Your Choice: "; + + $run_choice = trim(fgets(STDIN)); + } + while($run_choice < 1 || $run_choice > $run_option_count); + $test_to_run = $run_options[($run_choice - 1)][0]; + } + } + } + + return $test_to_run; +} +function pts_validate_save_results_name($proposed_save_name, $to_run, $to_run_type) +{ + $custom_title = null; + + do + { + if(is_file(SAVE_RESULTS_DIR . $proposed_save_name . "/composite.xml")) + { + $xml_parser = new tandem_XmlReader(SAVE_RESULTS_DIR . $proposed_save_name . "/composite.xml"); + $test_suite = $xml_parser->getXMLValue(P_RESULTS_SUITE_NAME); + + if($to_run_type != "GLOBAL_COMPARISON") + { + if($test_suite != $to_run) + { + $is_validated = false; + } + else + { + $is_validated = true; + } + } + else + { + $is_validated = true; //TODO: add type comparison check when doing a global comparison + } + } + else + { + $is_validated = true; + } + + if(!$is_validated) + { + echo pts_string_header("This saved file-name is associated with a different test (" . $test_suite . ") from " . $to_run . ". Enter a new name for saving the results."); + $new_name = pts_prompt_save_file_name(false); + $proposed_save_name = $new_name[0]; + $custom_title = $new_name[1]; + } + } + while(!$is_validated); + + return array($proposed_save_name, $custom_title); +} function pts_prompt_test_options($identifier) { $xml_parser = new pts_test_tandem_XmlReader(pts_location_test($identifier)); @@ -195,6 +291,53 @@ function pts_prompt_test_options($identifier) return array($USER_ARGS, $TEXT_ARGS); } +function pts_generate_batch_run_options($identifier) +{ + // Batch mode for single test + $batch_all_args_real = array(); + $batch_all_args_description = array(); + $description_separate = " "; + $test_options = pts_test_options($identifier); + + for($this_option_pos = 0; $this_option_pos < count($test_options); $this_option_pos++) + { + $o = $test_options[$this_option_pos]; + $option_count = $o->option_count(); + + $option_args = array(); + $option_args_description = array(); + + for($i = 0; $i < $o->option_count(); $i++) + { + // A bit redundant processing, but will ensure against malformed XML problems and extra stuff added + $this_arg = $o->get_option_prefix() . $o->get_option_value($i) . $o->get_option_postfix(); + $this_arg_description = $o->get_name() . ": " . $o->get_option_name($i); + + if(($cut_point = strpos($this_arg_description, "(")) > 1 && strpos($this_arg_description, ")") > $cut_point) + { + $this_arg_description = substr($this_arg_description, 0, $cut_point); + } + array_push($option_args, $this_arg); + array_push($option_args_description, $this_arg_description); + } + + if($i > 1) + { + $description_separate = " - "; + } + + array_push($batch_all_args_real, $option_args); + array_push($batch_all_args_description, $option_args_description); + } + + $TEST_ARGS = array(); + pts_all_combos($TEST_ARGS, "", $batch_all_args_real, 0); + + $TEST_ARGS_DESCRIPTION = array(); + pts_all_combos($TEST_ARGS_DESCRIPTION, "", $batch_all_args_description, 0, $description_separate); + + return array($TEST_ARGS, $TEST_ARGS_DESCRIPTION); +} function pts_swap_user_variables($user_str) { if(strpos($user_str, "$") !== false) @@ -391,10 +534,10 @@ function pts_input_string_to_identifier($input) return $input; } -function pts_verify_test_installation($TO_RUN) +function pts_verify_test_installation($identifier) { // Verify a test is installed - $tests = pts_contained_tests($TO_RUN); + $tests = pts_contained_tests($identifier); $needs_installing = array(); foreach($tests as $test) @@ -428,7 +571,7 @@ function pts_verify_test_installation($TO_RUN) $message .= "- " . $single_package . "\n"; } - $message .= "\nTo install these tests, run: phoronix-test-suite install " . $TO_RUN; + $message .= "\nTo install these tests, run: phoronix-test-suite install " . $identifier; echo pts_string_header($message); } |