summaryrefslogtreecommitdiffstats
path: root/pts-core
diff options
context:
space:
mode:
authorMichael Larabel <michael@phx-laptop.(none)>2008-05-02 15:21:09 -0400
committerMichael Larabel <michael@phx-laptop.(none)>2008-05-02 15:21:09 -0400
commit482c7e7cf4037172e2fad259659205032760ddf9 (patch)
treec62e40ab865172afc9a5a80804a0d69ad047e80c /pts-core
parentfea968de84548b9fcb901c9315f9439f9e808c3c (diff)
downloadphoronix-test-suite-upstream-482c7e7cf4037172e2fad259659205032760ddf9.tar.gz
phoronix-test-suite-upstream-482c7e7cf4037172e2fad259659205032760ddf9.tar.xz
phoronix-test-suite-upstream-482c7e7cf4037172e2fad259659205032760ddf9.zip
More cleaning of Phoronix Test Suite
Diffstat (limited to 'pts-core')
-rw-r--r--pts-core/functions/pts-functions-run.php28
-rw-r--r--pts-core/functions/pts-functions.php18
-rw-r--r--pts-core/pts-run-benchmark.php41
3 files changed, 45 insertions, 42 deletions
diff --git a/pts-core/functions/pts-functions-run.php b/pts-core/functions/pts-functions-run.php
index 2ec9b52..c9223e5 100644
--- a/pts-core/functions/pts-functions-run.php
+++ b/pts-core/functions/pts-functions-run.php
@@ -1,5 +1,22 @@
<?php
+function pts_prompt_results_identifier()
+{
+ $RESULTS_IDENTIFIER = null;
+
+ if(!defined("PTS_BATCH_MODE") || pts_read_user_config("PhoronixTestSuite/Options/BatchMode/PromptForTestIdentifier", "TRUE") == "TRUE")
+ do
+ {
+ echo "Enter a unique identifier for distinguishing this series of tests: ";
+ $RESULTS_IDENTIFIER = trim(str_replace(array('/'), '', fgets(STDIN)));
+ }
+ while(empty($RESULTS_IDENTIFIER));
+
+ if(empty($RESULTS_IDENTIFIER))
+ $RESULTS_IDENTIFIER = date("Y-m-d H:i");
+
+ return $RESULTS_IDENTIFIER;
+}
function pts_verify_test_installation($TO_RUN)
{
$needs_installing = array();
@@ -66,7 +83,9 @@ function pts_recurse_call_benchmark($benchmarks_array, $arguments_array, $save_r
{
for($i = 0; $i < count($benchmarks_array); $i++)
{
- if(pts_benchmark_type($benchmarks_array[$i]) == "TEST_SUITE")
+ $test_type = pts_benchmark_type($benchmarks_array[$i]);
+
+ if($test_type == "TEST_SUITE")
{
$xml_parser = new tandem_XmlReader(file_get_contents(XML_SUITE_DIR . $benchmarks_array[$i] . ".xml"));
@@ -76,7 +95,7 @@ function pts_recurse_call_benchmark($benchmarks_array, $arguments_array, $save_r
pts_recurse_call_benchmark($sub_suite_benchmarks, $sub_arguments, $save_results, $tandem_xml, $results_identifier, $sub_arguments_description);
}
- else
+ else if($test_type == "BENCHMARK")
{
$test_result = pts_run_benchmark($benchmarks_array[$i], $arguments_array[$i], $arguments_description[$i]);
@@ -166,8 +185,7 @@ function pts_save_benchmark_file($PROPOSED_FILE_NAME, &$RESULTS = null, $RAW_TEX
}
function pts_run_benchmark($benchmark_identifier, $extra_arguments = "", $arguments_description = "")
{
- if(!defined("SCREENSAVER_KILLED"))
- shell_exec("xdg-screensaver reset 2>&1");
+ pts_interrupt_screensaver();
if(pts_process_active($benchmark_identifier))
{
@@ -255,8 +273,6 @@ function pts_run_benchmark($benchmark_identifier, $extra_arguments = "", $argume
echo $BENCHMARK_RESULTS = pts_exec("cd $to_execute && ./$execute_binary $PTS_BENCHMARK_ARGUMENTS");
- echo shell_exec("echo $?") . "\n";
-
if(!($i == 0 && $ignore_first_run == "TRUE" && $times_to_run > 1))
{
if(is_file(BENCHMARK_RESOURCE_DIR . $benchmark_identifier . "/parse-results.php"))
diff --git a/pts-core/functions/pts-functions.php b/pts-core/functions/pts-functions.php
index da878c3..80ee0c1 100644
--- a/pts-core/functions/pts-functions.php
+++ b/pts-core/functions/pts-functions.php
@@ -537,5 +537,23 @@ function pts_shutdown()
// Remove process
pts_process_remove("phoronix-test-suite");
}
+function pts_disable_screensaver()
+{
+ if(pts_read_user_config("PhoronixTestSuite/Options/Benchmarking/ToggleScreensaver", "FALSE") == "TRUE")
+ {
+ shell_exec("gconftool --type bool --set /apps/gnome-screensaver/idle_activation_enabled false");
+ define("SCREENSAVER_KILLED", 1);
+ }
+}
+function pts_enable_screensaver()
+{
+ if(defined("SCREENSAVER_KILLED"))
+ shell_exec("gconftool --type bool --set /apps/gnome-screensaver/idle_activation_enabled true");
+}
+function pts_interrupt_screensaver()
+{
+ if(!defined("SCREENSAVER_KILLED"))
+ shell_exec("xdg-screensaver reset");
+}
?>
diff --git a/pts-core/pts-run-benchmark.php b/pts-core/pts-run-benchmark.php
index 14b63a8..8d769ff 100644
--- a/pts-core/pts-run-benchmark.php
+++ b/pts-core/pts-run-benchmark.php
@@ -44,15 +44,6 @@ if(!$TO_RUN_TYPE)
$TO_RUN_TYPE = "LOCAL_COMPARISON";
$PROPOSED_FILE_NAME = $TO_RUN;
$RES_NULL = null;
-
- if(!defined("PTS_BATCH_MODE") || pts_read_user_config("PhoronixTestSuite/Options/BatchMode/PromptForTestIdentifier", "TRUE") == "TRUE")
- do
- {
- echo "Enter a unique identifier for distinguishing this series of tests: ";
- $RESULTS_IDENTIFIER = trim(str_replace(array('/'), '', fgets(STDIN)));
- }while(empty($RESULTS_IDENTIFIER));
-
- $RESULTS = new tandem_XmlWriter();
}
else if(trim(@file_get_contents("http://www.phoronix-test-suite.com/global/profile-check.php?id=$TO_RUN")) == "REMOTE_FILE")
{
@@ -61,17 +52,7 @@ if(!$TO_RUN_TYPE)
$PROPOSED_FILE_NAME = $TO_RUN;
$RES_NULL = null;
define("GLOBAL_COMPARISON", 1);
-
pts_save_result($PROPOSED_FILE_NAME . "/composite.xml", @file_get_contents("http://www.phoronix-test-suite.com/global/pts-results-viewer.php?id=$TO_RUN"));
-
- if(!defined("PTS_BATCH_MODE") || pts_read_user_config("PhoronixTestSuite/Options/BatchMode/PromptForTestIdentifier", "TRUE") == "TRUE")
- do
- {
- echo "Enter a unique identifier for distinguishing this series of tests: ";
- $RESULTS_IDENTIFIER = trim(str_replace(array('/'), '', fgets(STDIN)));
- }while(empty($RESULTS_IDENTIFIER));
-
- $RESULTS = new tandem_XmlWriter();
}
else
{
@@ -95,27 +76,15 @@ else
if(empty($PROPOSED_FILE_NAME))
$PROPOSED_FILE_NAME = date("Y-m-d-Hi");
-
- if(!defined("PTS_BATCH_MODE") || pts_read_user_config("PhoronixTestSuite/Options/BatchMode/PromptForTestIdentifier", "TRUE") == "TRUE")
- do
- {
- echo "Enter a unique identifier for distinguishing this series of tests: ";
- $RESULTS_IDENTIFIER = trim(str_replace(array('/'), '', fgets(STDIN)));
- }while(empty($RESULTS_IDENTIFIER));
-
- $RESULTS = new tandem_XmlWriter();
}
}
-if(!isset($RESULTS_IDENTIFIER) || empty($RESULTS_IDENTIFIER))
- $RESULTS_IDENTIFIER = date("Y-m-d H:i");
+$RESULTS = new tandem_XmlWriter();
-// Kill the screensaver
-if(pts_read_user_config("PhoronixTestSuite/Options/Benchmarking/ToggleScreensaver", "FALSE") == "TRUE")
-{
- shell_exec("gconftool --type bool --set /apps/gnome-screensaver/idle_activation_enabled false 2>&1");
- define("SCREENSAVER_KILLED", 1);
-}
+if($SAVE_RESULTS)
+ $RESULTS_IDENTIFIER = pts_prompt_results_identifier();
+
+pts_disable_screensaver(); // Kill the screensaver
if($TO_RUN_TYPE == "BENCHMARK")
{