diff options
author | Michael Larabel <michael@phx-laptop.(none)> | 2008-04-24 20:05:06 -0400 |
---|---|---|
committer | Michael Larabel <michael@phx-laptop.(none)> | 2008-04-24 20:05:06 -0400 |
commit | 7b9bb4db6b404f84e053247b3568dd538b56c152 (patch) | |
tree | 78a5e5fd749b45556452af52dcd3bac6369681dd | |
parent | e9aa9a9b2011bb10cc5de8c8bd73d1f20fec2cbb (diff) | |
download | phoronix-test-suite-upstream-7b9bb4db6b404f84e053247b3568dd538b56c152.tar.gz phoronix-test-suite-upstream-7b9bb4db6b404f84e053247b3568dd538b56c152.tar.xz phoronix-test-suite-upstream-7b9bb4db6b404f84e053247b3568dd538b56c152.zip |
Clean up *_LOCATION definitions to all *_DIR
-rw-r--r-- | CHANGE-LOG | 5 | ||||
-rw-r--r-- | pts-core/functions/pts-functions-install.php | 36 | ||||
-rw-r--r-- | pts-core/functions/pts-functions-merge.php | 4 | ||||
-rw-r--r-- | pts-core/functions/pts-functions-run.php | 42 | ||||
-rw-r--r-- | pts-core/functions/pts-functions.php | 59 | ||||
-rw-r--r-- | pts-core/functions/pts-functions_config.php | 6 | ||||
-rw-r--r-- | pts-core/objects/pts_Graph.php | 2 | ||||
-rw-r--r-- | pts-core/pts-merge-results.php | 4 | ||||
-rw-r--r-- | pts-core/pts-run-benchmark.php | 14 | ||||
-rw-r--r-- | pts-core/pts-run-cmd.php | 34 |
10 files changed, 107 insertions, 99 deletions
@@ -1,5 +1,10 @@ PHORONIX TEST SUITE CHANGE-LOG +Phoronix Test Suite + +- Add support so distribution vendors / package mantainers can create their own defaults for user configuration options as a template at /pts/etc/user-config-template.xml +- Clean up all of the *_LOCATION defintions to using *_DIR + Phoronix Test Suite 0.4.0 April 24, 2008 diff --git a/pts-core/functions/pts-functions-install.php b/pts-core/functions/pts-functions-install.php index 697206e..81964f3 100644 --- a/pts-core/functions/pts-functions-install.php +++ b/pts-core/functions/pts-functions-install.php @@ -15,7 +15,7 @@ function pts_recurse_install_benchmark($TO_INSTALL, &$INSTALL_OBJ) { echo "\nInstalling Benchmarks For " . ucwords($TO_INSTALL) . " Test Suite...\n\n"; - $xml_parser = new tandem_XmlReader(file_get_contents(XML_SUITE_LOCATION . "$TO_INSTALL.xml")); + $xml_parser = new tandem_XmlReader(file_get_contents(XML_SUITE_DIR . $TO_INSTALL . ".xml")); $suite_benchmarks = $xml_parser->getXMLArrayValues("PTSuite/PTSBenchmark/Benchmark"); foreach($suite_benchmarks as $benchmark) @@ -49,33 +49,33 @@ function pts_install_benchmark($Benchmark) if(pts_benchmark_type($Benchmark) != "BENCHMARK") return; - if(is_file(BENCHMARK_ENVIRONMENT . "$Benchmark/pts-install") && file_get_contents(BENCHMARK_ENVIRONMENT . "$Benchmark/pts-install") == md5_file(BENCHMARK_RESOURCE_LOCATION . "$Benchmark/install.sh")) + if(is_file(BENCHMARK_ENV_DIR . "$Benchmark/pts-install") && file_get_contents(BENCHMARK_ENV_DIR . "$Benchmark/pts-install") == md5_file(BENCHMARK_RESOURCE_DIR . "$Benchmark/install.sh")) { echo ucwords($Benchmark) . " is already installed, skipping installation routine...\n"; } else { - if(is_file(BENCHMARK_RESOURCE_LOCATION . "$Benchmark/install.sh")) + if(is_file(BENCHMARK_RESOURCE_DIR . "$Benchmark/install.sh")) { - if(!is_dir(BENCHMARK_ENVIRONMENT)) + if(!is_dir(BENCHMARK_ENV_DIR)) { - mkdir(BENCHMARK_ENVIRONMENT); + mkdir(BENCHMARK_ENV_DIR); } - if(!is_dir(BENCHMARK_ENVIRONMENT . $Benchmark)) + if(!is_dir(BENCHMARK_ENV_DIR . $Benchmark)) { - mkdir(BENCHMARK_ENVIRONMENT . $Benchmark); + mkdir(BENCHMARK_ENV_DIR . $Benchmark); } - if(!is_dir(BENCHMARK_ENVIRONMENT . "pts-shared")) + if(!is_dir(BENCHMARK_ENV_DIR . "pts-shared")) { - mkdir(BENCHMARK_ENVIRONMENT . "pts-shared"); + mkdir(BENCHMARK_ENV_DIR . "pts-shared"); } echo "\n=================================\n"; echo "Installing Benchmark: $Benchmark"; echo "\n=================================\n"; - echo pts_exec("cd " . BENCHMARK_RESOURCE_LOCATION . "$Benchmark/ && sh install.sh " . BENCHMARK_ENVIRONMENT . $Benchmark) . "\n"; + echo pts_exec("cd " . BENCHMARK_RESOURCE_DIR . "$Benchmark/ && sh install.sh " . BENCHMARK_ENV_DIR . $Benchmark) . "\n"; - file_put_contents(BENCHMARK_ENVIRONMENT . "$Benchmark/pts-install", md5_file(BENCHMARK_RESOURCE_LOCATION . "$Benchmark/install.sh")); + file_put_contents(BENCHMARK_ENV_DIR . "$Benchmark/pts-install", md5_file(BENCHMARK_RESOURCE_DIR . "$Benchmark/install.sh")); } else echo ucwords($Benchmark) . " has no installation script, skipping installation routine...\n"; @@ -85,9 +85,9 @@ function pts_external_dependency_generic($Name) { $generic_information = ""; - if(is_file(DISTRO_XML_LOCATION . "generic-packages.xml")) + if(is_file(XML_DISTRO_DIR . "generic-packages.xml")) { - $xml_parser = new tandem_XmlReader(file_get_contents(DISTRO_XML_LOCATION . "generic-packages.xml")); + $xml_parser = new tandem_XmlReader(file_get_contents(XML_DISTRO_DIR . "generic-packages.xml")); $package_name = $xml_parser->getXMLArrayValues("PhoronixTestSuite/ExternalDependencies/Package/GenericName"); $title = $xml_parser->getXMLArrayValues("PhoronixTestSuite/ExternalDependencies/Package/Title"); $possible_packages = $xml_parser->getXMLArrayValues("PhoronixTestSuite/ExternalDependencies/Package/PossibleNames"); @@ -143,8 +143,8 @@ function pts_install_packages_on_distribution_process($install_objects) $distribution = strtolower(os_vendor()); - if(is_file(DISTRO_SCRIPT_LOCATION . "install-" . $distribution . "-packages.sh") || is_link(DISTRO_SCRIPT_LOCATION . "install-" . $distribution . "-packages.sh")) - echo pts_exec("cd " . DISTRO_SCRIPT_LOCATION . " && sh install-" . $distribution . "-packages.sh $install_objects"); + if(is_file(SCRIPT_DISTRO_DIR . "install-" . $distribution . "-packages.sh") || is_link(SCRIPT_DISTRO_DIR . "install-" . $distribution . "-packages.sh")) + echo pts_exec("cd " . SCRIPT_DISTRO_DIR . " && sh install-" . $distribution . "-packages.sh $install_objects"); else echo "Distribution install script not found!"; } @@ -154,7 +154,7 @@ function pts_install_external_dependencies_list($Benchmark, &$INSTALL_OBJ) if(pts_benchmark_type($Benchmark) != "BENCHMARK") return; - $xml_parser = new tandem_XmlReader(file_get_contents(XML_PROFILE_LOCATION . $Benchmark . ".xml")); + $xml_parser = new tandem_XmlReader(file_get_contents(XML_PROFILE_DIR . $Benchmark . ".xml")); $title = $xml_parser->getXMLValue("PTSBenchmark/Information/Title"); $dependencies = $xml_parser->getXMLValue("PTSBenchmark/Information/ExternalDependencies"); @@ -182,9 +182,9 @@ function pts_package_generic_to_distro_name(&$package_install_array, $generic_na $vendor = strtolower(os_vendor()); $generated = false; - if(is_file(DISTRO_XML_LOCATION . $vendor . "-packages.xml")) + if(is_file(XML_DISTRO_DIR . $vendor . "-packages.xml")) { - $xml_parser = new tandem_XmlReader(file_get_contents(DISTRO_XML_LOCATION . $vendor . "-packages.xml")); + $xml_parser = new tandem_XmlReader(file_get_contents(XML_DISTRO_DIR . $vendor . "-packages.xml")); $generic_package = $xml_parser->getXMLArrayValues("PhoronixTestSuite/ExternalDependencies/Package/GenericName"); $distro_package = $xml_parser->getXMLArrayValues("PhoronixTestSuite/ExternalDependencies/Package/PackageName"); $file_check = $xml_parser->getXMLArrayValues("PhoronixTestSuite/ExternalDependencies/Package/FileCheck"); diff --git a/pts-core/functions/pts-functions-merge.php b/pts-core/functions/pts-functions-merge.php index 997d489..aa9c546 100644 --- a/pts-core/functions/pts-functions-merge.php +++ b/pts-core/functions/pts-functions-merge.php @@ -6,8 +6,8 @@ function pts_find_file($file) { if(is_file($file)) $USE_FILE = $file; - else if(is_file(SAVE_RESULTS_LOCATION . $file . "/composite.xml")) - $USE_FILE = SAVE_RESULTS_LOCATION . $file . "/composite.xml"; + else if(is_file(SAVE_RESULTS_DIR . $file . "/composite.xml")) + $USE_FILE = SAVE_RESULTS_DIR . $file . "/composite.xml"; else if(trim(file_get_contents("http://www.phoronix-test-suite.com/global/profile-check.php?id=$file")) == "REMOTE_FILE") $USE_FILE = "http://www.phoronix-test-suite.com/global/pts-results-viewer.php?id=$file"; else diff --git a/pts-core/functions/pts-functions-run.php b/pts-core/functions/pts-functions-run.php index 7cf4586..3e022b6 100644 --- a/pts-core/functions/pts-functions-run.php +++ b/pts-core/functions/pts-functions-run.php @@ -6,7 +6,7 @@ function pts_recurse_call_benchmark($benchmarks_array, $arguments_array, $save_r { if(pts_benchmark_type($benchmarks_array[$i]) == "TEST_SUITE") { - $xml_parser = new tandem_XmlReader(file_get_contents(XML_SUITE_LOCATION . $benchmarks_array[$i] . ".xml")); + $xml_parser = new tandem_XmlReader(file_get_contents(XML_SUITE_DIR . $benchmarks_array[$i] . ".xml")); $sub_suite_benchmarks = $xml_parser->getXMLArrayValues("PTSuite/PTSBenchmark/Benchmark"); $sub_arguments = $xml_parser->getXMLArrayValues("PTSuite/PTSBenchmark/Arguments"); @@ -32,7 +32,7 @@ function pts_record_benchmark_result(&$tandem_xml, $benchmark, $arguments, $iden { global $BENCHMARK_RAN; - $xml_parser = new tandem_XmlReader(file_get_contents(XML_PROFILE_LOCATION . $benchmark . ".xml")); + $xml_parser = new tandem_XmlReader(file_get_contents(XML_PROFILE_DIR . $benchmark . ".xml")); $benchmark_title = $xml_parser->getXMLValue("PTSBenchmark/Information/Title"); $benchmark_version = $xml_parser->getXMLValue("PTSBenchmark/Information/Version"); $result_scale = $xml_parser->getXMLValue("PTSBenchmark/Information/ResultScale"); @@ -45,15 +45,15 @@ function pts_record_benchmark_result(&$tandem_xml, $benchmark, $arguments, $iden if(!empty($default_test_descriptor)) $description = $default_test_descriptor; - else if(is_file(BENCHMARK_ENVIRONMENT . "$benchmark/pts-test-description")) - $description = @file_get_contents(BENCHMARK_ENVIRONMENT . "$benchmark/pts-test-description"); + else if(is_file(BENCHMARK_ENV_DIR . "$benchmark/pts-test-description")) + $description = @file_get_contents(BENCHMARK_ENV_DIR . "$benchmark/pts-test-description"); else $description = "Phoronix Test Suite v" . PTS_VERSION; } if(empty($benchmark_version)) { - if(is_file(BENCHMARK_ENVIRONMENT . "$benchmark/pts-test-version")) - $benchmark_version = @file_get_contents(BENCHMARK_ENVIRONMENT . "$benchmark/pts-test-version"); + if(is_file(BENCHMARK_ENV_DIR . "$benchmark/pts-test-version")) + $benchmark_version = @file_get_contents(BENCHMARK_ENV_DIR . "$benchmark/pts-test-version"); } @@ -76,7 +76,7 @@ function pts_record_benchmark_result(&$tandem_xml, $benchmark, $arguments, $iden function pts_save_benchmark_file($PROPOSED_FILE_NAME, &$RESULTS = null, $RAW_TEXT = null) { $j = 1; - while(is_file(SAVE_RESULTS_LOCATION . $PROPOSED_FILE_NAME . "/test-$j.xml")) + while(is_file(SAVE_RESULTS_DIR . $PROPOSED_FILE_NAME . "/test-$j.xml")) $j++; $REAL_FILE_NAME = $PROPOSED_FILE_NAME . "/test-" . $j . ".xml"; @@ -90,14 +90,14 @@ function pts_save_benchmark_file($PROPOSED_FILE_NAME, &$RESULTS = null, $RAW_TEX pts_save_result($REAL_FILE_NAME, $R_FILE); - if(!is_file(SAVE_RESULTS_LOCATION . $PROPOSED_FILE_NAME . "/composite.xml")) + if(!is_file(SAVE_RESULTS_DIR . $PROPOSED_FILE_NAME . "/composite.xml")) { - pts_save_result($PROPOSED_FILE_NAME . "/composite.xml", file_get_contents(SAVE_RESULTS_LOCATION . $REAL_FILE_NAME)); + pts_save_result($PROPOSED_FILE_NAME . "/composite.xml", file_get_contents(SAVE_RESULTS_DIR . $REAL_FILE_NAME)); } else { // Merge Results - $MERGED_RESULTS = pts_merge_benchmarks(file_get_contents(SAVE_RESULTS_LOCATION . $PROPOSED_FILE_NAME . "/composite.xml"), file_get_contents(SAVE_RESULTS_LOCATION . $REAL_FILE_NAME)); + $MERGED_RESULTS = pts_merge_benchmarks(file_get_contents(SAVE_RESULTS_DIR . $PROPOSED_FILE_NAME . "/composite.xml"), file_get_contents(SAVE_RESULTS_DIR . $REAL_FILE_NAME)); pts_save_result($PROPOSED_FILE_NAME . "/composite.xml", $MERGED_RESULTS); } return $REAL_FILE_NAME; @@ -114,7 +114,7 @@ function pts_run_benchmark($benchmark_identifier, $extra_arguments = "", $argume } pts_process_register($benchmark_identifier); - $xml_parser = new tandem_XmlReader(file_get_contents(XML_PROFILE_LOCATION . "$benchmark_identifier.xml")); + $xml_parser = new tandem_XmlReader(file_get_contents(XML_PROFILE_DIR . "$benchmark_identifier.xml")); $execute_binary = $xml_parser->getXMLValue("PTSBenchmark/Information/Executable"); $benchmark_title = $xml_parser->getXMLValue("PTSBenchmark/Information/Title"); $times_to_run = intval($xml_parser->getXMLValue("PTSBenchmark/Information/TimesToRun")); @@ -130,17 +130,17 @@ function pts_run_benchmark($benchmark_identifier, $extra_arguments = "", $argume if(empty($execute_binary)) $execute_binary = $benchmark_identifier; - if(is_file(BENCHMARK_ENVIRONMENT . "$benchmark_identifier/$execute_binary") || is_link(BENCHMARK_ENVIRONMENT . "$benchmark_identifier/$execute_binary")) - $to_execute = BENCHMARK_ENVIRONMENT . "$benchmark_identifier/"; + if(is_file(BENCHMARK_ENV_DIR . "$benchmark_identifier/$execute_binary") || is_link(BENCHMARK_ENV_DIR . "$benchmark_identifier/$execute_binary")) + $to_execute = BENCHMARK_ENV_DIR . "$benchmark_identifier/"; else if(is_file($execute_path . $execute_binary) || is_link($execute_path . $execute_binary)) //TODO: Support multiple paths in PossiblePaths separated by : delimiter. $to_execute = $execute_path; else { - echo "This application executable could not be found in " . $execute_path . ". or " . BENCHMARK_ENVIRONMENT . "$benchmark_identifier/.\nBenchmark terminating."; + echo "This application executable could not be found in " . $execute_path . ". or " . BENCHMARK_ENV_DIR . "$benchmark_identifier/.\nBenchmark terminating."; return; } - if(is_dir(BENCHMARK_ENVIRONMENT . "$benchmark_identifier/") && file_get_contents(BENCHMARK_ENVIRONMENT . "$benchmark_identifier/pts-install") != md5_file(BENCHMARK_RESOURCE_LOCATION . "$benchmark_identifier/install.sh")) + if(is_dir(BENCHMARK_ENV_DIR . "$benchmark_identifier/") && file_get_contents(BENCHMARK_ENV_DIR . "$benchmark_identifier/pts-install") != md5_file(BENCHMARK_RESOURCE_DIR . "$benchmark_identifier/install.sh")) { echo "\n=================================\nNOTE: Your benchmarking installation is out of date!\nFor best results, the $benchmark_title benchmark should be reinstalled.\n=================================\n\n"; @@ -152,10 +152,10 @@ function pts_run_benchmark($benchmark_identifier, $extra_arguments = "", $argume $PTS_BENCHMARK_ARGUMENTS = trim($default_arguments . " " . $extra_arguments); $BENCHMARK_RESULTS_ARRAY = array(); - if(is_file(BENCHMARK_RESOURCE_LOCATION . $benchmark_identifier . "/pre.sh")) + if(is_file(BENCHMARK_RESOURCE_DIR . $benchmark_identifier . "/pre.sh")) { //echo "\n=================================\nExecuting Pre-Benchmark Tasks\n=================================\n"; - echo shell_exec("sh " . BENCHMARK_RESOURCE_LOCATION . $benchmark_identifier . "/pre.sh " . BENCHMARK_ENVIRONMENT . "$benchmark_identifier"); + echo shell_exec("sh " . BENCHMARK_RESOURCE_DIR . $benchmark_identifier . "/pre.sh " . BENCHMARK_ENV_DIR . "$benchmark_identifier"); } if(!empty($pre_run_message)) @@ -173,17 +173,17 @@ function pts_run_benchmark($benchmark_identifier, $extra_arguments = "", $argume echo $BENCHMARK_RESULTS = pts_exec("cd $to_execute; ./$execute_binary $PTS_BENCHMARK_ARGUMENTS"); - if(is_file(BENCHMARK_RESOURCE_LOCATION . $benchmark_identifier . "/parse-results.php")) + if(is_file(BENCHMARK_RESOURCE_DIR . $benchmark_identifier . "/parse-results.php")) { - $BENCHMARK_RESULTS = pts_exec("cd " . BENCHMARK_RESOURCE_LOCATION . $benchmark_identifier . "/ && php parse-results.php \"$BENCHMARK_RESULTS\""); + $BENCHMARK_RESULTS = pts_exec("cd " . BENCHMARK_RESOURCE_DIR . $benchmark_identifier . "/ && php parse-results.php \"$BENCHMARK_RESULTS\""); } array_push($BENCHMARK_RESULTS_ARRAY, $BENCHMARK_RESULTS); } - if(is_file(BENCHMARK_RESOURCE_LOCATION . $benchmark_identifier . "/post.sh")) + if(is_file(BENCHMARK_RESOURCE_DIR . $benchmark_identifier . "/post.sh")) { //echo "\n=================================\nExecuting Post-Benchmark Tasks\n=================================\n"; - echo pts_exec("sh " . BENCHMARK_RESOURCE_LOCATION . $benchmark_identifier . "/post.sh " . BENCHMARK_ENVIRONMENT . "$benchmark_identifier"); + echo pts_exec("sh " . BENCHMARK_RESOURCE_DIR . $benchmark_identifier . "/post.sh " . BENCHMARK_ENV_DIR . "$benchmark_identifier"); } // End diff --git a/pts-core/functions/pts-functions.php b/pts-core/functions/pts-functions.php index f4c6535..099ca2e 100644 --- a/pts-core/functions/pts-functions.php +++ b/pts-core/functions/pts-functions.php @@ -50,18 +50,19 @@ define("PTS_CODENAME", "TRONDHEIM"); define("PTS_TYPE", "DESKTOP"); define("THIS_RUN_TIME", time()); -define("XML_PROFILE_LOCATION", PTS_DIR . "pts/benchmark-profiles/"); -define("XML_SUITE_LOCATION", PTS_DIR . "pts/benchmark-suites/"); -define("DISTRO_XML_LOCATION", PTS_DIR . "pts/distro-xml/"); -define("DISTRO_SCRIPT_LOCATION", PTS_DIR . "pts/distro-scripts/"); -define("BENCHMARK_RESOURCE_LOCATION", PTS_DIR . "pts/benchmark-resources/"); -define("RESULTS_VIEWER_LOCATION", PTS_DIR . "pts-core/pts-results-viewer/"); +define("XML_PROFILE_DIR", PTS_DIR . "pts/benchmark-profiles/"); +define("XML_SUITE_DIR", PTS_DIR . "pts/benchmark-suites/"); +define("XML_DISTRO_DIR", PTS_DIR . "pts/distro-xml/"); +define("SCRIPT_DISTRO_DIR", PTS_DIR . "pts/distro-scripts/"); +define("BENCHMARK_RESOURCE_DIR", PTS_DIR . "pts/benchmark-resources/"); +define("ETC_DIR", PTS_DIR . "pts/etc/"); +define("RESULTS_VIEWER_DIR", PTS_DIR . "pts-core/pts-results-viewer/"); define("PTS_USER_DIR", pts_find_home("~/.phoronix-test-suite/")); //define("FONT_DIRECTORY" "/usr/share/fonts/"); pts_config_init(); -define("BENCHMARK_ENVIRONMENT", pts_find_home(pts_read_user_config("PhoronixTestSuite/Options/Benchmarking/EnvironmentDirectory", "~/.phoronix-test-suite/installed-tests/"))); -define("SAVE_RESULTS_LOCATION", pts_find_home(pts_read_user_config("PhoronixTestSuite/Options/Results/Directory", "~/.phoronix-test-suite/test-results/"))); +define("BENCHMARK_ENV_DIR", pts_find_home(pts_read_user_config("PhoronixTestSuite/Options/Benchmarking/EnvironmentDirectory", "~/.phoronix-test-suite/installed-tests/"))); +define("SAVE_RESULTS_DIR", pts_find_home(pts_read_user_config("PhoronixTestSuite/Options/Results/Directory", "~/.phoronix-test-suite/test-results/"))); // Etc $PTS_GLOBAL_ID = 1; @@ -77,7 +78,7 @@ register_shutdown_function("pts_process_remove", "phoronix-test-suite"); function pts_benchmark_names_to_array() { $benchmark_names = array(); - foreach(glob(XML_PROFILE_LOCATION . "*.xml") as $benchmark_file) + foreach(glob(XML_PROFILE_DIR . "*.xml") as $benchmark_file) { $xml_parser = new tandem_XmlReader(file_get_contents($benchmark_file)); $benchmark_name = $xml_parser->getXMLValue("PTSBenchmark/Information/Title"); @@ -90,7 +91,7 @@ function pts_benchmark_names_to_array() function pts_suite_names_to_array() { $benchmark_suites = array(); - foreach(glob(XML_SUITE_LOCATION . "*.xml") as $benchmark_file) + foreach(glob(XML_SUITE_DIR . "*.xml") as $benchmark_file) { $xml_parser = new tandem_XmlReader(file_get_contents($benchmark_file)); $benchmark_name = $xml_parser->getXMLValue("PTSuite/PhoronixTestSuite/Title"); @@ -106,7 +107,7 @@ function pts_benchmark_name_to_identifier($name) return false; $identifier = false; - foreach(glob(XML_PROFILE_LOCATION . "*.xml") as $benchmark_file) + foreach(glob(XML_PROFILE_DIR . "*.xml") as $benchmark_file) { $xml_parser = new tandem_XmlReader(file_get_contents($benchmark_file)); @@ -122,9 +123,9 @@ function pts_benchmark_identifier_to_name($identifier) return false; $name = false; - if(is_file(XML_PROFILE_LOCATION . "$identifier.xml")) + if(is_file(XML_PROFILE_DIR . "$identifier.xml")) { - $xml_parser = new tandem_XmlReader(file_get_contents(XML_PROFILE_LOCATION . $identifier . ".xml")); + $xml_parser = new tandem_XmlReader(file_get_contents(XML_PROFILE_DIR . $identifier . ".xml")); $name = $xml_parser->getXMLValue("PTSBenchmark/Information/Title"); } @@ -135,9 +136,9 @@ function pts_benchmark_type($identifier) if(empty($identifier)) return false; - if(is_file(XML_PROFILE_LOCATION . $identifier . ".xml")) + if(is_file(XML_PROFILE_DIR . $identifier . ".xml")) return "BENCHMARK"; - else if(is_file(XML_SUITE_LOCATION . $identifier . ".xml")) + else if(is_file(XML_SUITE_DIR . $identifier . ".xml")) return "TEST_SUITE"; else return false; @@ -150,7 +151,7 @@ function pts_copy($from, $to) function pts_save_result($save_to = null, $save_results = null, $directory = null) { if($directory == null) - $directory = SAVE_RESULTS_LOCATION; + $directory = SAVE_RESULTS_DIR; if(strpos($save_to, ".xml") === FALSE) { @@ -169,9 +170,9 @@ function pts_save_result($save_to = null, $save_results = null, $directory = nul mkdir($directory . "pts-results-viewer"); } - pts_copy(RESULTS_VIEWER_LOCATION . "pts.js", $directory . "pts-results-viewer/pts.js"); - pts_copy(RESULTS_VIEWER_LOCATION . "pts-results-viewer.xsl", $directory . "pts-results-viewer/pts-results-viewer.xsl"); - pts_copy(RESULTS_VIEWER_LOCATION . "pts-viewer.css", $directory . "pts-results-viewer/pts-viewer.css"); + pts_copy(RESULTS_VIEWER_DIR . "pts.js", $directory . "pts-results-viewer/pts.js"); + pts_copy(RESULTS_VIEWER_DIR . "pts-results-viewer.xsl", $directory . "pts-results-viewer/pts-results-viewer.xsl"); + pts_copy(RESULTS_VIEWER_DIR . "pts-viewer.css", $directory . "pts-results-viewer/pts-viewer.css"); if(!is_file($save_to_dir . "/pts-results-viewer.xsl") && !is_link($save_to_dir . "/pts-results-viewer.xsl")) link($directory . "pts-results-viewer/pts-results-viewer.xsl", $save_to_dir . "/pts-results-viewer.xsl"); @@ -248,23 +249,23 @@ function pts_save_result($save_to = null, $save_results = null, $directory = nul } function pts_process_register($process) { - if(!is_dir(BENCHMARK_ENVIRONMENT)) - mkdir(BENCHMARK_ENVIRONMENT); - if(!is_dir(BENCHMARK_ENVIRONMENT . ".processes")) - mkdir(BENCHMARK_ENVIRONMENT . ".processes"); + if(!is_dir(BENCHMARK_ENV_DIR)) + mkdir(BENCHMARK_ENV_DIR); + if(!is_dir(BENCHMARK_ENV_DIR . ".processes")) + mkdir(BENCHMARK_ENV_DIR . ".processes"); - return file_put_contents(BENCHMARK_ENVIRONMENT . ".processes/$process.p", time()); + return file_put_contents(BENCHMARK_ENV_DIR . ".processes/$process.p", time()); } function pts_process_remove($process) { - if(is_file(BENCHMARK_ENVIRONMENT . ".processes/$process.p")) - return unlink(BENCHMARK_ENVIRONMENT . ".processes/$process.p"); + if(is_file(BENCHMARK_ENV_DIR . ".processes/$process.p")) + return unlink(BENCHMARK_ENV_DIR . ".processes/$process.p"); } function pts_process_active($process) { - if(is_file(BENCHMARK_ENVIRONMENT . ".processes/$process.p")) + if(is_file(BENCHMARK_ENV_DIR . ".processes/$process.p")) { - $process_time = intval(file_get_contents(BENCHMARK_ENVIRONMENT . ".processes/$process.p")); + $process_time = intval(file_get_contents(BENCHMARK_ENV_DIR . ".processes/$process.p")); if((time() - $process_time) < 30) // TODO: Replace Lock With Pid based instead of time. return true; @@ -321,7 +322,7 @@ function pts_input_correct_results_path($path) { if(strpos($path, '/') === FALSE) { - $path = SAVE_RESULTS_LOCATION . $path; + $path = SAVE_RESULTS_DIR . $path; } if(strpos($MERGE_TO, ".xml") === FALSE) { diff --git a/pts-core/functions/pts-functions_config.php b/pts-core/functions/pts-functions_config.php index baffb3e..4df7143 100644 --- a/pts-core/functions/pts-functions_config.php +++ b/pts-core/functions/pts-functions_config.php @@ -14,6 +14,8 @@ function pts_user_config_init($UserName = NULL, $UploadKey = NULL) { if(is_file(PTS_USER_DIR . "user-config.xml")) $file = file_get_contents(PTS_USER_DIR . "user-config.xml"); + else if(is_file(ETC_DIR . "user-config-template.xml")) + $file = file_get_contents(ETC_DIR . "user-config-template.xml"); else $file = ""; $read_config = new tandem_XmlReader($file); @@ -43,8 +45,8 @@ function pts_graph_config_init() { if(is_file(PTS_USER_DIR . "graph-config.xml")) $file = file_get_contents(PTS_USER_DIR . "graph-config.xml"); - else if(is_file(RESULTS_VIEWER_LOCATION . "graph-config-template.xml")) - $file = file_get_contents(RESULTS_VIEWER_LOCATION . "graph-config-template.xml"); + else if(is_file(RESULTS_VIEWER_DIR . "graph-config-template.xml")) + $file = file_get_contents(RESULTS_VIEWER_DIR . "graph-config-template.xml"); else $file = ""; $read_config = new tandem_XmlReader($file); diff --git a/pts-core/objects/pts_Graph.php b/pts-core/objects/pts_Graph.php index deaee8e..030b306 100644 --- a/pts-core/objects/pts_Graph.php +++ b/pts-core/objects/pts_Graph.php @@ -88,7 +88,7 @@ class pts_Graph // Directory for TTF Fonts if(!defined("FONT_DIRECTORY")) { - putenv("GDFONTPATH=" . RESULTS_VIEWER_LOCATION); + putenv("GDFONTPATH=" . RESULTS_VIEWER_DIR); //putenv("GDFONTPATH=" . getcwd()); // The directory where the TTF font files should be. getcwd() will look in the same directory as this file } else diff --git a/pts-core/pts-merge-results.php b/pts-core/pts-merge-results.php index 11235c6..5094551 100644 --- a/pts-core/pts-merge-results.php +++ b/pts-core/pts-merge-results.php @@ -25,7 +25,7 @@ if(empty($MERGE_TO)) { $rand_file = rand(1000, 9999); $MERGE_TO = "merge-$rand_file/"; - }while(is_dir(SAVE_RESULTS_LOCATION . $MERGE_TO)); + }while(is_dir(SAVE_RESULTS_DIR . $MERGE_TO)); $MERGE_TO .= "composite.xml"; } @@ -33,6 +33,6 @@ if(empty($MERGE_TO)) // Merge Results $MERGED_RESULTS = pts_merge_benchmarks(file_get_contents($BASE_FILE), file_get_contents($MERGE_FROM_FILE)); pts_save_result($MERGE_TO, $MERGED_RESULTS); -display_web_browser(SAVE_RESULTS_LOCATION . $MERGE_TO); +display_web_browser(SAVE_RESULTS_DIR . $MERGE_TO); ?> diff --git a/pts-core/pts-run-benchmark.php b/pts-core/pts-run-benchmark.php index 1cceabb..78bfe22 100644 --- a/pts-core/pts-run-benchmark.php +++ b/pts-core/pts-run-benchmark.php @@ -124,7 +124,7 @@ if(!isset($RESULTS_IDENTIFIER) || empty($RESULTS_IDENTIFIER)) if($TO_RUN_TYPE == "BENCHMARK") { - $xml_parser = new tandem_XmlReader(file_get_contents(XML_PROFILE_LOCATION . "$TO_RUN.xml")); + $xml_parser = new tandem_XmlReader(file_get_contents(XML_PROFILE_DIR . "$TO_RUN.xml")); $settings_name = $xml_parser->getXMLArrayValues("PTSBenchmark/Settings/Option/DisplayName"); $settings_argument = $xml_parser->getXMLArrayValues("PTSBenchmark/Settings/Option/ArgumentName"); $settings_identifier = $xml_parser->getXMLArrayValues("PTSBenchmark/Settings/Option/Identifier"); @@ -179,7 +179,7 @@ if($TO_RUN_TYPE == "BENCHMARK") if($SAVE_RESULTS) { - $xml_parser = new tandem_XmlReader(file_get_contents(XML_PROFILE_LOCATION . "$TO_RUN.xml")); + $xml_parser = new tandem_XmlReader(file_get_contents(XML_PROFILE_DIR . "$TO_RUN.xml")); $test_description = $xml_parser->getXMLValue("PTSBenchmark/Information/Description"); $test_version = $xml_parser->getXMLValue("PTSBenchmark/PhoronixTestSuite/Version"); $test_type = $xml_parser->getXMLValue("PTSBenchmark/PhoronixTestSuite/ApplicationType"); @@ -196,7 +196,7 @@ else if($TO_RUN_TYPE == "TEST_SUITE") echo "\nRunning Benchmarks For " . ucwords($TO_RUN) . " Test Suite...\n\n"; - $xml_parser = new tandem_XmlReader(file_get_contents(XML_SUITE_LOCATION . "$TO_RUN.xml")); + $xml_parser = new tandem_XmlReader(file_get_contents(XML_SUITE_DIR . $TO_RUN . ".xml")); if($SAVE_RESULTS) { @@ -219,7 +219,7 @@ else if($SAVE_RESULTS && ($TO_RUN_TYPE == "GLOBAL_COMPARISON" || $TO_RUN_TYPE == echo "Global Comparison Against: " . $TO_RUN; echo "\n=================================\n"; - $xml_parser = new tandem_XmlReader(file_get_contents(SAVE_RESULTS_LOCATION . $TO_RUN . "/composite.xml")); + $xml_parser = new tandem_XmlReader(file_get_contents(SAVE_RESULTS_DIR . $TO_RUN . "/composite.xml")); $CUSTOM_TITLE = $xml_parser->getXMLValue("PhoronixTestSuite/Suite/Title"); $test_description = $xml_parser->getXMLValue("PhoronixTestSuite/Suite/Description"); $test_version = $xml_parser->getXMLValue("PhoronixTestSuite/Suite/Version"); @@ -263,8 +263,8 @@ if($SAVE_RESULTS) if($BENCHMARK_RAN) { pts_save_benchmark_file($PROPOSED_FILE_NAME, $RESULTS); - echo "Results Saved To: " . SAVE_RESULTS_LOCATION . $PROPOSED_FILE_NAME . "/composite.xml\n"; - display_web_browser(SAVE_RESULTS_LOCATION . $PROPOSED_FILE_NAME . "/composite.xml"); + echo "Results Saved To: " . SAVE_RESULTS_DIR . $PROPOSED_FILE_NAME . "/composite.xml\n"; + display_web_browser(SAVE_RESULTS_DIR . $PROPOSED_FILE_NAME . "/composite.xml"); $upload_results = pts_bool_question("Would you like to upload these results to PTS Global (Y/n)?", true, "UPLOAD_RESULTS"); @@ -273,7 +273,7 @@ if($SAVE_RESULTS) echo "\nTags are optional and used on PTS Global for making it easy to share, search, and organize test results. Example tags could be the type of test performed (i.e. WINE tests) or the hardware used (i.e. Dual-Core SMP).\n\nEnter the tags you wish to provide (separated by commas): "; $tags_input = trim(preg_replace("/[^a-zA-Z0-9s, -]/", "", fgets(STDIN))); - echo "\nResults Uploaded To: " . pts_global_upload_result(SAVE_RESULTS_LOCATION . $PROPOSED_FILE_NAME . "/composite.xml", $tags_input) . "\n"; + echo "\nResults Uploaded To: " . pts_global_upload_result(SAVE_RESULTS_DIR . $PROPOSED_FILE_NAME . "/composite.xml", $tags_input) . "\n"; } echo "\n"; diff --git a/pts-core/pts-run-cmd.php b/pts-core/pts-run-cmd.php index 0f23a8d..50453be 100644 --- a/pts-core/pts-run-cmd.php +++ b/pts-core/pts-run-cmd.php @@ -13,19 +13,19 @@ if(isset($argv[3])) switch($COMMAND) { case "REMOVE_RESULT": - if(is_file(SAVE_RESULTS_LOCATION . $ARG_1 . "/composite.xml")) + if(is_file(SAVE_RESULTS_DIR . $ARG_1 . "/composite.xml")) { - unlink(SAVE_RESULTS_LOCATION . $ARG_1 . "/composite.xml"); + unlink(SAVE_RESULTS_DIR . $ARG_1 . "/composite.xml"); - foreach(glob(SAVE_RESULTS_LOCATION . $ARG_1 . "/result-graphs/*.png") as $remove_file) + foreach(glob(SAVE_RESULTS_DIR . $ARG_1 . "/result-graphs/*.png") as $remove_file) unlink($remove_file); - foreach(glob(SAVE_RESULTS_LOCATION . $ARG_1 . "/test-*.xml") as $remove_file) + foreach(glob(SAVE_RESULTS_DIR . $ARG_1 . "/test-*.xml") as $remove_file) unlink($remove_file); - unlink(SAVE_RESULTS_LOCATION . $ARG_1 . "/pts-results-viewer.xsl"); - rmdir(SAVE_RESULTS_LOCATION . $ARG_1 . "/result-graphs/"); - rmdir(SAVE_RESULTS_LOCATION . $ARG_1); + unlink(SAVE_RESULTS_DIR . $ARG_1 . "/pts-results-viewer.xsl"); + rmdir(SAVE_RESULTS_DIR . $ARG_1 . "/result-graphs/"); + rmdir(SAVE_RESULTS_DIR . $ARG_1); echo "\nRemoved: $ARG_1\n"; } else @@ -35,8 +35,8 @@ switch($COMMAND) if(is_file($ARG_1)) $USE_FILE = $ARG_1; - else if(is_file(SAVE_RESULTS_LOCATION . $ARG_1 . "/composite.xml")) - $USE_FILE = SAVE_RESULTS_LOCATION . $ARG_1 . "/composite.xml"; + else if(is_file(SAVE_RESULTS_DIR . $ARG_1 . "/composite.xml")) + $USE_FILE = SAVE_RESULTS_DIR . $ARG_1 . "/composite.xml"; else { echo "\nThis result doesn't exist!\n"; @@ -52,7 +52,7 @@ switch($COMMAND) echo "\n=================================\n"; echo "Phoronix Test Suite - Saved Results\n"; echo "=================================\n\n"; - foreach(glob(SAVE_RESULTS_LOCATION . "*/composite.xml") as $benchmark_file) + foreach(glob(SAVE_RESULTS_DIR . "*/composite.xml") as $benchmark_file) { $xml_parser = new tandem_XmlReader(file_get_contents($benchmark_file)); $title = $xml_parser->getXMLValue("PhoronixTestSuite/Suite/Title"); @@ -75,8 +75,8 @@ switch($COMMAND) } break; case "SHOW_RESULT": - if(is_file(SAVE_RESULTS_LOCATION . $ARG_1 . "/composite.xml")) - $URL = SAVE_RESULTS_LOCATION . $ARG_1 . "/composite.xml"; + if(is_file(SAVE_RESULTS_DIR . $ARG_1 . "/composite.xml")) + $URL = SAVE_RESULTS_DIR . $ARG_1 . "/composite.xml"; //else if(trim(file_get_contents("http://www.phoronix-test-suite.com/global/profile-check.php?id=" . $ARG_1)) == "REMOTE_FILE") // $URL = "http://global.phoronix-test-suite.com/index.php?k=profile&u=" . trim($ARG_1); else @@ -134,7 +134,7 @@ switch($COMMAND) echo "\n=================================\n"; echo "Phoronix Test Suite - Benchmarks\n"; echo "=================================\n\n"; - foreach(glob(XML_PROFILE_LOCATION . "*.xml") as $benchmark_file) + foreach(glob(XML_PROFILE_DIR . "*.xml") as $benchmark_file) { $xml_parser = new tandem_XmlReader(file_get_contents($benchmark_file)); $name = $xml_parser->getXMLValue("PTSBenchmark/Information/Title"); @@ -151,7 +151,7 @@ switch($COMMAND) echo "Phoronix Test Suite - Suites\n"; echo "=================================\n\n"; $benchmark_suites = array(); - foreach(glob(XML_SUITE_LOCATION . "*.xml") as $benchmark_file) + foreach(glob(XML_SUITE_DIR . "*.xml") as $benchmark_file) { $xml_parser = new tandem_XmlReader(file_get_contents($benchmark_file)); $name = $xml_parser->getXMLValue("PTSuite/PhoronixTestSuite/Title"); @@ -165,7 +165,7 @@ switch($COMMAND) case "SUITE_INFO": if(pts_benchmark_type($ARG_1) == "TEST_SUITE") { - $xml_parser = new tandem_XmlReader(file_get_contents(XML_SUITE_LOCATION . $ARG_1 . ".xml")); + $xml_parser = new tandem_XmlReader(file_get_contents(XML_SUITE_DIR . $ARG_1 . ".xml")); $tests_in_suite = $xml_parser->getXMLArrayValues("PTSuite/PTSBenchmark/Benchmark"); $suite_name = $xml_parser->getXMLValue("PTSuite/PhoronixTestSuite/Title"); $suite_maintainer = $xml_parser->getXMLValue("PTSuite/PhoronixTestSuite/Maintainer"); @@ -187,7 +187,7 @@ switch($COMMAND) foreach($tests_in_suite as $test) { - $benchmark_file = XML_PROFILE_LOCATION . $test . ".xml"; + $benchmark_file = XML_PROFILE_DIR . $test . ".xml"; $xml_parser = new tandem_XmlReader(file_get_contents($benchmark_file)); $name = $xml_parser->getXMLValue("PTSBenchmark/Information/Title"); @@ -208,7 +208,7 @@ switch($COMMAND) case "TEST_INFO": if(pts_benchmark_type($ARG_1) == "BENCHMARK") { - $xml_parser = new tandem_XmlReader(file_get_contents(XML_PROFILE_LOCATION . $ARG_1 . ".xml")); + $xml_parser = new tandem_XmlReader(file_get_contents(XML_PROFILE_DIR . $ARG_1 . ".xml")); $test_title = $xml_parser->getXMLValue("PTSBenchmark/Information/Title"); |