diff options
author | Michael Larabel <michael@phx-laptop.(none)> | 2008-10-19 22:39:39 -0400 |
---|---|---|
committer | Michael Larabel <michael@phx-laptop.(none)> | 2008-10-19 22:39:39 -0400 |
commit | 3e76397a3718f6ad0bf709da52054e867434cfef (patch) | |
tree | 536f960624ecd652153c6edc5267e5d563c058b6 /pts-core | |
parent | 83b87790c77c30e0c9def0baf38702b9adfeac44 (diff) | |
download | phoronix-test-suite-upstream-3e76397a3718f6ad0bf709da52054e867434cfef.tar.gz phoronix-test-suite-upstream-3e76397a3718f6ad0bf709da52054e867434cfef.tar.xz phoronix-test-suite-upstream-3e76397a3718f6ad0bf709da52054e867434cfef.zip |
pts-core: Support for running a test from a PTS graph file that's
rendered as an SVG and then the user will be prompted with available
choices
Diffstat (limited to 'pts-core')
-rw-r--r-- | pts-core/functions/pts-functions-extra.php | 5 | ||||
-rw-r--r-- | pts-core/functions/pts-functions-install_dependencies.php | 31 | ||||
-rw-r--r-- | pts-core/pts-run-test.php | 45 |
3 files changed, 56 insertions, 25 deletions
diff --git a/pts-core/functions/pts-functions-extra.php b/pts-core/functions/pts-functions-extra.php index 16d562a..d88ee3c 100644 --- a/pts-core/functions/pts-functions-extra.php +++ b/pts-core/functions/pts-functions-extra.php @@ -211,10 +211,7 @@ function pts_estimated_time_string($time) { $time_trim = explode(",", $time_trim); - for($i = 0; $i < count($time_trim); $i++) - { - $time_trim[$i] = trim($time_trim[$i]); - } + $time_trim = array_map("trim", $time_trim); if(count($time_trim) == 2) { diff --git a/pts-core/functions/pts-functions-install_dependencies.php b/pts-core/functions/pts-functions-install_dependencies.php index d33b7f3..d410322 100644 --- a/pts-core/functions/pts-functions-install_dependencies.php +++ b/pts-core/functions/pts-functions-install_dependencies.php @@ -21,6 +21,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ +function pts_install_package_on_distribution($identifier) +{ + // PTS External Dependencies install on distribution + if(getenv("SILENT_INSTALL") == false) + { + echo "Checking For Needed External Dependencies.\n"; + } + + $identifier = strtolower($identifier); + $install_objects = array(); + pts_start_install_dependencies($identifier, $install_objects); + pts_install_packages_on_distribution_process($install_objects); +} function pts_start_install_dependencies($TO_INSTALL, &$PLACE_LIST) { if(IS_SCTP_MODE) @@ -95,10 +108,7 @@ function pts_install_external_dependencies_list($identifier, &$INSTALL_OBJ) { $dependencies = explode(",", $dependencies); - for($i = 0; $i < count($dependencies); $i++) - { - $dependencies[$i] = trim($dependencies[$i]); - } + $dependencies = array_map("trim", $dependencies); if(!defined("PTS_EXDEP_FIRST_RUN")) { @@ -168,19 +178,6 @@ function pts_package_generic_to_distro_name(&$package_install_array, $generic_na return $generated; } -function pts_install_package_on_distribution($identifier) -{ - // PTS External Dependencies install on distribution - if(getenv("SILENT_INSTALL") == false) - { - echo "Checking For Needed External Dependencies.\n"; - } - - $identifier = strtolower($identifier); - $install_objects = array(); - pts_start_install_dependencies($identifier, $install_objects); - pts_install_packages_on_distribution_process($install_objects); -} function pts_install_packages_on_distribution_process($install_objects) { // Do the actual installing process of packages using the distribution's package management system diff --git a/pts-core/pts-run-test.php b/pts-core/pts-run-test.php index ceb4e66..2361529 100644 --- a/pts-core/pts-run-test.php +++ b/pts-core/pts-run-test.php @@ -31,13 +31,50 @@ if(is_file($argv[1]) && substr(basename($argv[1]), -4) == ".svg") { // Image graph result driven test selection $svg_parser = new tandem_XmlReader($argv[1]); - $svg_test = $svg_parser->getStatement("Test"); - $svg_identifier = $svg_parser->getStatement("Identifier"); + $svg_test = array_pop($svg_parser->getStatement("Test")); + $svg_identifier = array_pop($svg_parser->getStatement("Identifier")); if(!empty($svg_test) && !empty($svg_identifier)) { - // TODO: Implement checks and then prompt user whether they want to - // run the test, suite, or global ID that the SVG references + $run_options = array(); + if(is_test($svg_test)) + { + array_push($run_options, array($svg_test, "Run this test (" . $svg_test . ")")); + } + + if(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) + { + $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); + $TO_RUN = $run_options[($run_choice - 1)][0]; + } + } } } |