summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Larabel <michael@phx-laptop.(none)>2008-04-24 20:29:28 -0400
committerMichael Larabel <michael@phx-laptop.(none)>2008-04-24 20:29:28 -0400
commit51671d7de76254b0cfa9a385e6add726a68b5067 (patch)
tree02dc7e8dfbd02e20eacd63c5b6057062a26f42f5
parent7b9bb4db6b404f84e053247b3568dd538b56c152 (diff)
downloadphoronix-test-suite-upstream-51671d7de76254b0cfa9a385e6add726a68b5067.tar.gz
phoronix-test-suite-upstream-51671d7de76254b0cfa9a385e6add726a68b5067.tar.xz
phoronix-test-suite-upstream-51671d7de76254b0cfa9a385e6add726a68b5067.zip
Clean up text headers in stdout
-rw-r--r--pts-core/functions/pts-functions-install.php6
-rw-r--r--pts-core/functions/pts-functions-run.php10
-rw-r--r--pts-core/functions/pts-functions.php5
-rw-r--r--pts-core/pts-run-benchmark.php8
-rw-r--r--pts-core/pts-run-cmd.php48
5 files changed, 27 insertions, 50 deletions
diff --git a/pts-core/functions/pts-functions-install.php b/pts-core/functions/pts-functions-install.php
index 81964f3..3a9cf6f 100644
--- a/pts-core/functions/pts-functions-install.php
+++ b/pts-core/functions/pts-functions-install.php
@@ -70,9 +70,7 @@ function pts_install_benchmark($Benchmark)
mkdir(BENCHMARK_ENV_DIR . "pts-shared");
}
- echo "\n=================================\n";
- echo "Installing Benchmark: $Benchmark";
- echo "\n=================================\n";
+ echo pts_string_header("Installing Benchmark:" . $Benchmark);
echo pts_exec("cd " . BENCHMARK_RESOURCE_DIR . "$Benchmark/ && sh install.sh " . BENCHMARK_ENV_DIR . $Benchmark) . "\n";
file_put_contents(BENCHMARK_ENV_DIR . "$Benchmark/pts-install", md5_file(BENCHMARK_RESOURCE_DIR . "$Benchmark/install.sh"));
@@ -105,7 +103,7 @@ function pts_external_dependency_generic($Name)
if(!defined("PTS_MANUAL_SUPPORT"))
define("PTS_MANUAL_SUPPORT", 1);
- $generic_information = "=================================\n" . $title[$selection] . "\n=================================\nPossible Package Names: " . $possible_packages[$selection] . "\n\n";
+ echo pts_string_header($title[$selection] . "\nPossible Package Names: " . $possible_packages[$selection]);
}
}
}
diff --git a/pts-core/functions/pts-functions-run.php b/pts-core/functions/pts-functions-run.php
index 3e022b6..4c7945a 100644
--- a/pts-core/functions/pts-functions-run.php
+++ b/pts-core/functions/pts-functions-run.php
@@ -142,8 +142,7 @@ function pts_run_benchmark($benchmark_identifier, $extra_arguments = "", $argume
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";
-
+ echo pts_string_header("NOTE: This test installation is out of date.\nFor best results, the $benchmark_title test should be re-installed.");
// Auto reinstall
//require_once("pts-core/functions/pts-functions-run.php");
//pts_install_benchmark($benchmark_identifier);
@@ -154,13 +153,11 @@ function pts_run_benchmark($benchmark_identifier, $extra_arguments = "", $argume
if(is_file(BENCHMARK_RESOURCE_DIR . $benchmark_identifier . "/pre.sh"))
{
- //echo "\n=================================\nExecuting Pre-Benchmark Tasks\n=================================\n";
echo shell_exec("sh " . BENCHMARK_RESOURCE_DIR . $benchmark_identifier . "/pre.sh " . BENCHMARK_ENV_DIR . "$benchmark_identifier");
}
if(!empty($pre_run_message))
{
- echo "\n=================================\nPre-Run Message\n=================================\n";
echo $pre_run_message . "\n";
echo "\nHit Any Key To Continue Benchmarking.\n";
fgets(STDIN);
@@ -168,7 +165,7 @@ function pts_run_benchmark($benchmark_identifier, $extra_arguments = "", $argume
for($i = 0; $i < $times_to_run; $i++)
{
- echo "\n=================================\n$benchmark_title Benchmark (Run " . ($i + 1) . " of " . $times_to_run . ")\n=================================\n";
+ echo pts_string_header($benchmark_title . " Benchmark (Run " . ($i + 1) . " of " . $times_to_run . ")");
$result_output = array();
echo $BENCHMARK_RESULTS = pts_exec("cd $to_execute; ./$execute_binary $PTS_BENCHMARK_ARGUMENTS");
@@ -182,7 +179,6 @@ function pts_run_benchmark($benchmark_identifier, $extra_arguments = "", $argume
if(is_file(BENCHMARK_RESOURCE_DIR . $benchmark_identifier . "/post.sh"))
{
- //echo "\n=================================\nExecuting Post-Benchmark Tasks\n=================================\n";
echo pts_exec("sh " . BENCHMARK_RESOURCE_DIR . $benchmark_identifier . "/post.sh " . BENCHMARK_ENV_DIR . "$benchmark_identifier");
}
@@ -206,7 +202,7 @@ function pts_run_benchmark($benchmark_identifier, $extra_arguments = "", $argume
$RETURN_STRING .= "\nAverage: $AVG_RESULT $result_scale";
- echo "\n=================================\n$RETURN_STRING\n=================================\n";
+ echo pts_string_header($RETURN_STRING);
}
else
$AVG_RESULT = -1;
diff --git a/pts-core/functions/pts-functions.php b/pts-core/functions/pts-functions.php
index 099ca2e..5adeba2 100644
--- a/pts-core/functions/pts-functions.php
+++ b/pts-core/functions/pts-functions.php
@@ -442,5 +442,8 @@ function pts_clean_information_string($str)
return $str;
}
-
+function pts_string_header($heading)
+{
+ return "\n" . str_repeat('=', 42) . "\n" . $heading . "\n" . str_repeat('=', 42) . "\n\n";
+}
?>
diff --git a/pts-core/pts-run-benchmark.php b/pts-core/pts-run-benchmark.php
index 78bfe22..006fb08 100644
--- a/pts-core/pts-run-benchmark.php
+++ b/pts-core/pts-run-benchmark.php
@@ -190,9 +190,7 @@ if($TO_RUN_TYPE == "BENCHMARK")
}
else if($TO_RUN_TYPE == "TEST_SUITE")
{
- echo "\n=================================\n";
- echo ucwords($TO_RUN) . " Test Suite";
- echo "\n=================================\n";
+ echo pts_string_header(ucwords($TO_RUN) . " Test Suite");
echo "\nRunning Benchmarks For " . ucwords($TO_RUN) . " Test Suite...\n\n";
@@ -215,9 +213,7 @@ else if($TO_RUN_TYPE == "TEST_SUITE")
}
else if($SAVE_RESULTS && ($TO_RUN_TYPE == "GLOBAL_COMPARISON" || $TO_RUN_TYPE == "LOCAL_COMPARISON"))
{
- echo "\n=================================\n";
- echo "Global Comparison Against: " . $TO_RUN;
- echo "\n=================================\n";
+ echo pts_string_header("Global Comparison Against: " . $TO_RUN);
$xml_parser = new tandem_XmlReader(file_get_contents(SAVE_RESULTS_DIR . $TO_RUN . "/composite.xml"));
$CUSTOM_TITLE = $xml_parser->getXMLValue("PhoronixTestSuite/Suite/Title");
diff --git a/pts-core/pts-run-cmd.php b/pts-core/pts-run-cmd.php
index 50453be..c0d65e6 100644
--- a/pts-core/pts-run-cmd.php
+++ b/pts-core/pts-run-cmd.php
@@ -49,9 +49,7 @@ switch($COMMAND)
echo "Results Uploaded To: " . $upload_url . "\n\n"; // TODO: Add checks to make sure it did work out
break;
case "LIST_SAVED_RESULTS":
- echo "\n=================================\n";
- echo "Phoronix Test Suite - Saved Results\n";
- echo "=================================\n\n";
+ echo pts_string_header("Phoronix Test Suite - Saved Results");
foreach(glob(SAVE_RESULTS_DIR . "*/composite.xml") as $benchmark_file)
{
$xml_parser = new tandem_XmlReader(file_get_contents($benchmark_file));
@@ -131,25 +129,21 @@ switch($COMMAND)
pts_install_package_on_distribution($ARG_1);
break;
case "LIST_TESTS":
- echo "\n=================================\n";
- echo "Phoronix Test Suite - Benchmarks\n";
- echo "=================================\n\n";
- 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");
- $identifier = basename($benchmark_file, ".xml");
- $license = $xml_parser->getXMLValue("PTSBenchmark/PhoronixTestSuite/License");
- $status = $xml_parser->getXMLValue("PTSBenchmark/PhoronixTestSuite/Status");
+ echo pts_string_header("Phoronix Test Suite - Benchmarks");
+ 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");
+ $identifier = basename($benchmark_file, ".xml");
+ $license = $xml_parser->getXMLValue("PTSBenchmark/PhoronixTestSuite/License");
+ $status = $xml_parser->getXMLValue("PTSBenchmark/PhoronixTestSuite/Status");
- printf("%-18ls - %-30ls [Status: %s, License: %s]\n", $identifier, $name, $status, $license);
- }
+ printf("%-18ls - %-30ls [Status: %s, License: %s]\n", $identifier, $name, $status, $license);
+ }
echo "\n";
break;
case "LIST_SUITES":
- echo "\n=================================\n";
- echo "Phoronix Test Suite - Suites\n";
- echo "=================================\n\n";
+ echo pts_string_header("Phoronix Test Suite - Suites");
$benchmark_suites = array();
foreach(glob(XML_SUITE_DIR . "*.xml") as $benchmark_file)
{
@@ -175,9 +169,7 @@ switch($COMMAND)
$tests_in_suite = array_unique($tests_in_suite);
$unique_tests = count($tests_in_suite);
- echo "\n=================================\n";
- echo $suite_name . " (" . $ARG_1 . " v" . $suite_version . ")\n";
- echo "=================================\n\n";
+ echo pts_string_header($suite_name . " (" . $ARG_1 . " v" . $suite_version . ")");
echo "Maintainer: " . $suite_maintainer . "\n";
echo "Suite Type: " . $suite_type . "\n";
@@ -219,9 +211,7 @@ switch($COMMAND)
$test_status = $xml_parser->getXMLValue("PTSBenchmark/PhoronixTestSuite/Status");
$test_maintainer = $xml_parser->getXMLValue("PTSBenchmark/PhoronixTestSuite/Maintainer");
- echo "\n=================================\n";
- echo $test_title . " (" . $ARG_1 . " v" . $test_version . ")\n";
- echo "=================================\n\n";
+ echo pts_string_header($test_title . " (" . $ARG_1 . " v" . $test_version . ")");
echo "Maintainer: " . $test_maintainer . "\n";
echo "Test Type: " . $test_type . "\n";
@@ -245,18 +235,12 @@ switch($COMMAND)
pts_user_config_init();
break;
case "SYS_INFO":
- echo "\n=================================\n";
- echo "Phoronix Test Suite v" . PTS_VERSION . " (" . PTS_CODENAME . ")\n";
- echo "System Information";
- echo "\n=================================\n\n";
+ echo pts_string_header("Phoronix Test Suite v" . PTS_VERSION . " (" . PTS_CODENAME . ")\n" . "System Information");
echo "Hardware:\n" . pts_hw_string() . "\n\n";
echo "Software:\n" . pts_sw_string() . "\n\n";
break;
case "DIAGNOSTICS_DUMP":
- echo "\n=================================\n";
- echo "Phoronix Test Suite v" . PTS_VERSION . " (" . PTS_CODENAME . ")\n";
- echo "Diagnostics Dump";
- echo "\n=================================\n\n";
+ echo pts_string_header("Phoronix Test Suite v" . PTS_VERSION . " (" . PTS_CODENAME . ")\n" . "Diagnostics Dump");
$pts_defined_constants = get_defined_constants(true);
foreach($pts_defined_constants["user"] as $constant => $constant_value)
echo $constant . " = " . $constant_value . "\n";