diff options
author | Michael Larabel <michael@phx-laptop.(none)> | 2008-11-30 20:00:21 -0500 |
---|---|---|
committer | Michael Larabel <michael@phx-laptop.(none)> | 2008-11-30 20:00:21 -0500 |
commit | 260ff17a89a15ad897d4e0a4c060510686d55030 (patch) | |
tree | 0ed8e30086e407b0dc9cb5a18bf78aea53031a23 | |
parent | 068c038200c3fedc39b3a1fa28724eff115a79ec (diff) | |
download | phoronix-test-suite-upstream-260ff17a89a15ad897d4e0a4c060510686d55030.tar.gz phoronix-test-suite-upstream-260ff17a89a15ad897d4e0a4c060510686d55030.tar.xz phoronix-test-suite-upstream-260ff17a89a15ad897d4e0a4c060510686d55030.zip |
pts-core: Major Self-Contained Test Profile (SCTP) update. Also adds in
convert-test-to-sctp option.
-rw-r--r-- | TYDAL-CHANGE-LOG | 1 | ||||
-rwxr-xr-x | install-sh | 2 | ||||
-rwxr-xr-x | phoronix-test-suite | 9 | ||||
-rw-r--r-- | pts-core/functions/pts-functions-run.php | 1 | ||||
-rw-r--r-- | pts-core/functions/pts-functions-sctp.php | 11 | ||||
-rw-r--r-- | pts-core/functions/pts-functions_config.php | 1 | ||||
-rw-r--r-- | pts-core/functions/pts-init.php | 3 | ||||
-rw-r--r-- | pts-core/functions/pts-interfaces.php | 6 | ||||
-rw-r--r-- | pts-core/options/convert_test_profile_to_sctp.php | 95 |
9 files changed, 117 insertions, 12 deletions
diff --git a/TYDAL-CHANGE-LOG b/TYDAL-CHANGE-LOG index 97e3ffd..010c123 100644 --- a/TYDAL-CHANGE-LOG +++ b/TYDAL-CHANGE-LOG @@ -28,6 +28,7 @@ Phoronix Test Suite (Git) - pts-core: Add download-test-files option to download files for a test/suite but don't install - pts-core: Add build-suite option that guides the user through automatically building their own test suite - pts-core: Clean up / functionize more benchmark run code +- pts-core: Major Self-Contained Test Profile (SCTP) update. Also adds in convert-test-to-sctp option. - pts: Add adjustable file size support for bonnie test profile - pts: Update sqlite test profile to version 3.6.6.2 - pts: Update iozone test profile to version 3.315 and add size user option @@ -27,7 +27,7 @@ else fi # Ensure the user is in the correct directory -if [ ! -f pts-core/pts-run-cmd.php ] || [ ! -f pts-core/pts-run-test.php ] +if [ ! -f pts-core/phoronix-test-suite.php ] then cat <<'EOT' diff --git a/phoronix-test-suite b/phoronix-test-suite index 07c4f9e..26dae44 100755 --- a/phoronix-test-suite +++ b/phoronix-test-suite @@ -24,7 +24,6 @@ # Full path to root directory of the actual Phoronix Test Suite code export PTS_DIR=`pwd` CALL_DIR=`pwd` -OPTION_HANDLE=$1 OPTION_ARG=$2 if [ $PTS_DIR != `pwd` ] @@ -78,8 +77,9 @@ fi export SCTP_FILE=`echo $CALL_DIR/$1 | sed 's:\./::g'` if [ -e $SCTP_FILE ] then - OPTION_HANDLE="benchmark" - OPTION_ARG=$SCTP_FILE + export PTS_COMMAND="benchmark" + $PHP_BIN pts-core/phoronix-test-suite.php BENCHMARK $SCTP_FILE + exit fi export PTS_COMMAND=$1 @@ -134,6 +134,9 @@ case "$1" in "list-suites") $PHP_BIN pts-core/phoronix-test-suite.php LIST_SUITES ;; +"convert-test-to-sctp") + $PHP_BIN pts-core/phoronix-test-suite.php CONVERT_TEST_PROFILE_TO_SCTP $OPTION_ARG + ;; "list-modules") $PHP_BIN pts-core/phoronix-test-suite.php LIST_MODULES ;; diff --git a/pts-core/functions/pts-functions-run.php b/pts-core/functions/pts-functions-run.php index 2ae7359..a108bee 100644 --- a/pts-core/functions/pts-functions-run.php +++ b/pts-core/functions/pts-functions-run.php @@ -847,6 +847,7 @@ function pts_run_test($test_identifier, $extra_arguments = "", $arguments_descri } if($times_to_run > 1 && $i < ($times_to_run - 1)) { + echo pts_call_test_script($test_identifier, "interim", null, $test_directory, $extra_runtime_variables); pts_module_process("__interim_test_run", $pts_test_result); sleep(1); // Rest for a moment between tests } diff --git a/pts-core/functions/pts-functions-sctp.php b/pts-core/functions/pts-functions-sctp.php index 5ece9d5..ce0a377 100644 --- a/pts-core/functions/pts-functions-sctp.php +++ b/pts-core/functions/pts-functions-sctp.php @@ -23,7 +23,7 @@ function pts_sctp_test_directory() { - return PTS_TEMP_DIR . "sctp/" . basename(SCTP_FILE) . "/"; + return SCTP_DIR . basename(SCTP_FILE, ".sctp") . "/"; } function pts_remove_sctp_test_files() { @@ -39,16 +39,15 @@ function pts_generate_sctp_layer() pts_exit("\n" . SCTP_FILE . " is not a valid self-contained test profile!\n"); } - if(!is_dir(PTS_TEMP_DIR . "sctp/")) - { - mkdir(PTS_TEMP_DIR . "sctp/"); - } if(!is_dir($test_directory)) { mkdir($test_directory); } - $sctp_stages = array("install" => P_TEST_SCTP_INSTALLSCRIPT, "downloads" => P_TEST_SCTP_DOWNLOADS, "parse-results" => P_TEST_SCTP_RESULTSPARSER, "pre" => P_TEST_SCTP_PRERUN, "post" => P_TEST_SCTP_POSTRUN); + $sctp_stages = array("install" => P_TEST_SCTP_INSTALLSCRIPT, "downloads" => P_TEST_SCTP_DOWNLOADS, "parse-results" => P_TEST_SCTP_RESULTSPARSER, + "pre" => P_TEST_SCTP_PRERUN, "interim" => P_TEST_SCTP_INTERIMRUN, "post" => P_TEST_SCTP_POSTRUN, "validate-result" => P_TEST_SCTP_VALIDATE_RESULT, + "validate-install" => P_TEST_SCTP_VALIDATE_INSTALL); + foreach($sctp_stages as $stage_file => $stage_point) { $object = $xml_parser->getXMLValue($stage_point); diff --git a/pts-core/functions/pts-functions_config.php b/pts-core/functions/pts-functions_config.php index 063b8a8..e56967e 100644 --- a/pts-core/functions/pts-functions_config.php +++ b/pts-core/functions/pts-functions_config.php @@ -124,6 +124,7 @@ function pts_user_config_init($UserName = null, $UploadKey = null, $BatchOptions $config->addXmlObject(P_OPTION_PROMPT_DOWNLOADLOC, 3, pts_read_user_config(P_OPTION_PROMPT_DOWNLOADLOC, "FALSE", $read_config)); $config->addXmlObject(P_OPTION_TEST_ENVIRONMENT, 3, pts_read_user_config(P_OPTION_TEST_ENVIRONMENT, "~/.phoronix-test-suite/installed-tests/", $read_config)); $config->addXmlObject(P_OPTION_CACHE_DIRECTORY, 3, pts_read_user_config(P_OPTION_CACHE_DIRECTORY, "~/.phoronix-test-suite/download-cache/", $read_config)); + $config->addXmlObject(P_OPTION_SCTP_DIRECTORY, 3, pts_read_user_config(P_OPTION_SCTP_DIRECTORY, "~/.phoronix-test-suite/sctp/", $read_config)); $config->addXmlObject(P_OPTION_TEST_SLEEPTIME, 4, pts_read_user_config(P_OPTION_TEST_SLEEPTIME, "8", $read_config)); $config->addXmlObject(P_OPTION_LOG_VSYSDETAILS, 4, pts_read_user_config(P_OPTION_LOG_VSYSDETAILS, "FALSE", $read_config)); diff --git a/pts-core/functions/pts-init.php b/pts-core/functions/pts-init.php index 348d8c1..30bca33 100644 --- a/pts-core/functions/pts-init.php +++ b/pts-core/functions/pts-init.php @@ -33,6 +33,7 @@ function pts_init() pts_config_init(); define("TEST_ENV_DIR", pts_find_home(pts_read_user_config(P_OPTION_TEST_ENVIRONMENT, "~/.phoronix-test-suite/installed-tests/"))); define("SAVE_RESULTS_DIR", pts_find_home(pts_read_user_config(P_OPTION_RESULTS_DIRECTORY, "~/.phoronix-test-suite/test-results/"))); + define("SCTP_DIR", pts_find_home(pts_read_user_config(P_OPTION_SCTP_DIRECTORY, "~/.phoronix-test-suite/sctp/"))); define("PTS_DOWNLOAD_CACHE_DIR", pts_find_home(pts_download_cache())); pts_extended_init(); } @@ -150,7 +151,7 @@ function pts_extended_init() @file_put_contents(PTS_DOWNLOAD_CACHE_DIR . "make-cache-howto", "A download cache is used for conserving time and bandwidth by eliminating the need for the Phoronix Test Suite to download files that have already been downloaded once. A download cache can also be transferred between PCs running the Phoronix Test Suite. For more information on this feature, view the included documentation. To generate a download cache, run:\n\nphoronix-test-suite make-download-cache\n"); } - $directory_check = array(TEST_ENV_DIR, SAVE_RESULTS_DIR, XML_SUITE_LOCAL_DIR, TEST_RESOURCE_LOCAL_DIR, XML_PROFILE_LOCAL_DIR); + $directory_check = array(TEST_ENV_DIR, SAVE_RESULTS_DIR, XML_SUITE_LOCAL_DIR, TEST_RESOURCE_LOCAL_DIR, XML_PROFILE_LOCAL_DIR, SCTP_DIR); foreach($directory_check as $dir) { if(!is_dir($dir)) diff --git a/pts-core/functions/pts-interfaces.php b/pts-core/functions/pts-interfaces.php index 21df029..c08639c 100644 --- a/pts-core/functions/pts-interfaces.php +++ b/pts-core/functions/pts-interfaces.php @@ -74,10 +74,13 @@ define("P_TEST_OPTIONS_MENU_GROUP_VALUE", P_TEST_OPTIONS_MENU_GROUP . "/" . S_TE // SELF-CONTAINED TEST PROFILE SPECIFICATION // -define("P_TEST_SCTP_INSTALLSCRIPT", "PhoronixTestSuite/SelfContained/Installation"); // Installation routine +define("P_TEST_SCTP_INSTALLSCRIPT", "PhoronixTestSuite/SelfContained/Install"); // Installation routine +define("P_TEST_SCTP_VALIDATE_INSTALL", "PhoronixTestSuite/SelfContained/ValidateInstall"); // Validate installation routine define("P_TEST_SCTP_DOWNLOADS", "PhoronixTestSuite/SelfContained/Downloads"); // Downloads XML file define("P_TEST_SCTP_RESULTSPARSER", "PhoronixTestSuite/SelfContained/ResultsParser"); // Results Parser +define("P_TEST_SCTP_VALIDATE_RESULT", "PhoronixTestSuite/SelfContained/ValidateResult"); // Validate results routine define("P_TEST_SCTP_PRERUN", "PhoronixTestSuite/SelfContained/PreRun"); // Pre-run script +define("P_TEST_SCTP_INTERIMRUN", "PhoronixTestSuite/SelfContained/InterimRun"); // Interim-run script define("P_TEST_SCTP_POSTRUN", "PhoronixTestSuite/SelfContained/PostRun"); // Pre-run script // @@ -183,6 +186,7 @@ define("P_OPTION_TEST_ENVIRONMENT", "PhoronixTestSuite/Options/Installation/Envi define("P_OPTION_CACHE_DIRECTORY", "PhoronixTestSuite/Options/Installation/CacheDirectory"); // Directory for reading/writing to download cache define("P_OPTION_CACHE_SEARCHMEDIA", "PhoronixTestSuite/Options/Installation/SearchMediaForCache"); // Search /media/ devices for a remote download cache define("P_OPTION_PROMPT_DOWNLOADLOC", "PhoronixTestSuite/Options/Installation/PromptForDownloadMirror"); // Results save directory +define("P_OPTION_SCTP_DIRECTORY", "PhoronixTestSuite/Options/Installation/SelfContainedTestProfileDirectory"); // Directory for reading/writing to download cache define("P_OPTION_BATCH_CONFIGURED", "PhoronixTestSuite/Options/BatchMode/Configured"); // Batch mode has been configured define("P_OPTION_BATCH_SAVERESULTS", "PhoronixTestSuite/Options/BatchMode/SaveResults"); // Batch mode save results diff --git a/pts-core/options/convert_test_profile_to_sctp.php b/pts-core/options/convert_test_profile_to_sctp.php new file mode 100644 index 0000000..36dd49d --- /dev/null +++ b/pts-core/options/convert_test_profile_to_sctp.php @@ -0,0 +1,95 @@ +<?php + +/* + Phoronix Test Suite + URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/ + Copyright (C) 2008, Phoronix Media + Copyright (C) 2008, Michael Larabel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +class convert_test_profile_to_sctp implements pts_option_interface +{ + public static function run($r) + { + $to_convert = $r[0]; + + if(pts_is_test($to_convert)) + { + $test_profile_xml = file_get_contents(pts_location_test($to_convert)); + + // TODO: Fix downloads.xml reading + //if(is_file(($file = pts_location_test_resources($to_convert) . "downloads.xml"))) + //{ + // $test_downloads = file_get_contents($file); + //} + if(is_file(($file = pts_location_test_resources($to_convert) . "install.sh")) || is_file(($file = pts_location_test_resources($to_convert) . "install.php"))) + { + $test_install = file_get_contents($file); + } + if(is_file(($file = pts_location_test_resources($to_convert) . "parse-results.sh")) || is_file(($file = pts_location_test_resources($to_convert) . "parse-results.php"))) + { + $test_parse_results = file_get_contents($file); + } + if(is_file(($file = pts_location_test_resources($to_convert) . "pre.sh")) || is_file(($file = pts_location_test_resources($to_convert) . "pre.php"))) + { + $test_pre = file_get_contents($file); + } + if(is_file(($file = pts_location_test_resources($to_convert) . "interim.sh")) || is_file(($file = pts_location_test_resources($to_convert) . "interim.php"))) + { + $test_interim = file_get_contents($file); + } + if(is_file(($file = pts_location_test_resources($to_convert) . "post.sh")) || is_file(($file = pts_location_test_resources($to_convert) . "post.php"))) + { + $test_post = file_get_contents($file); + } + if(is_file(($file = pts_location_test_resources($to_convert) . "validate-install.sh")) || is_file(($file = pts_location_test_resources($to_convert) . "validate-install.php"))) + { + $test_validate_install = file_get_contents($file); + } + if(is_file(($file = pts_location_test_resources($to_convert) . "validate-result.sh")) || is_file(($file = pts_location_test_resources($to_convert) . "validate-result.php"))) + { + $test_validate_result = file_get_contents($file); + } + + $xml_writer = new tandem_XmlWriter(); + $xml_writer->addXmlObject(P_TEST_SCTP_INSTALLSCRIPT, 0, $test_install); + $xml_writer->addXmlObject(P_TEST_SCTP_VALIDATE_INSTALL, 0, $test_validate_install); + $xml_writer->addXmlObject(P_TEST_SCTP_DOWNLOADS, 0, $test_downloads); + $xml_writer->addXmlObject(P_TEST_SCTP_RESULTSPARSER, 0, $test_parse_results); + $xml_writer->addXmlObject(P_TEST_SCTP_VALIDATE_RESULT, 0, $test_validate_result); + $xml_writer->addXmlObject(P_TEST_SCTP_PRERUN, 0, $test_pre); + $xml_writer->addXmlObject(P_TEST_SCTP_INTERIMRUN, 0, $test_interim); + $xml_writer->addXmlObject(P_TEST_SCTP_POSTRUN, 0, $test_post); + $sctp_xml = $xml_writer ->getXML(); + + $test_profile_xml = substr($test_profile_xml, 0, strrpos($test_profile_xml, "</PhoronixTestSuite>")); + $sctp_xml = substr($sctp_xml, strpos($sctp_xml, "<PhoronixTestSuite>") + 19); + + $sctp_file = "#!/usr/bin/env /usr/bin/phoronix-test-suite\n" . $test_profile_xml . "\n" . $sctp_xml; + + file_put_contents(SCTP_DIR . "test.sctp", $sctp_file); + chmod(SCTP_DIR . "test.sctp", 0755); + + echo "\n"; + } + else + { + echo "\n" . $to_info . " is not recognized.\n"; + } + } +} + +?> |