summaryrefslogtreecommitdiffstats
path: root/pts-core/functions/pts-functions_tests.php
diff options
context:
space:
mode:
authorMichael Larabel <michael@phx-laptop.(none)>2008-10-09 14:26:21 -0400
committerMichael Larabel <michael@phx-laptop.(none)>2008-10-09 14:26:21 -0400
commit7a0fa4ad29350dcef6bef7972e5724f0b45520d8 (patch)
treebffe5d28cab31aec1238e1eb11559f8afad427ad /pts-core/functions/pts-functions_tests.php
parentf62ec5fbb084d26220d928d7b54f51641ab1ab85 (diff)
downloadphoronix-test-suite-upstream-7a0fa4ad29350dcef6bef7972e5724f0b45520d8.tar.gz
phoronix-test-suite-upstream-7a0fa4ad29350dcef6bef7972e5724f0b45520d8.tar.xz
phoronix-test-suite-upstream-7a0fa4ad29350dcef6bef7972e5724f0b45520d8.zip
pts-core: Keep a running average how long it takes to run a given test.
This is stored in the AverageRunTime tag within the pts-install.xml
Diffstat (limited to 'pts-core/functions/pts-functions_tests.php')
-rw-r--r--pts-core/functions/pts-functions_tests.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/pts-core/functions/pts-functions_tests.php b/pts-core/functions/pts-functions_tests.php
index 795f6e5..8152490 100644
--- a/pts-core/functions/pts-functions_tests.php
+++ b/pts-core/functions/pts-functions_tests.php
@@ -97,7 +97,7 @@ function pts_test_generate_install_xml($identifier)
file_put_contents(TEST_ENV_DIR . $identifier . "/pts-install.xml", $xml_writer->getXML());
}
-function pts_test_refresh_install_xml($identifier)
+function pts_test_refresh_install_xml($identifier, $this_test_duration = 0)
{
// Refresh the pts-install.xml for a test
if(is_file(TEST_ENV_DIR . $identifier . "/pts-install.xml"))
@@ -105,12 +105,23 @@ function pts_test_refresh_install_xml($identifier)
$xml_parser = new tandem_XmlReader(TEST_ENV_DIR . $identifier . "/pts-install.xml", FALSE);
$xml_writer = new tandem_XmlWriter();
+ $test_duration = $xml_parser->getXMLValue(P_INSTALL_TEST_AVG_RUNTIME);
+ if(!is_numeric($test_duration))
+ {
+ $test_duration = $this_test_duration;
+ }
+ if(is_numeric($this_test_duration) && $this_test_duration > 0)
+ {
+ $test_duration = ceil((($test_duration * $xml_parser->getXMLValue(P_INSTALL_TEST_TIMESRUN)) + $this_test_duration) / ($xml_parser->getXMLValue(P_INSTALL_TEST_TIMESRUN) + 1));
+ }
+
$xml_writer->addXmlObject(P_INSTALL_TEST_NAME, 1, $xml_parser->getXMLValue(P_INSTALL_TEST_NAME));
$xml_writer->addXmlObject(P_INSTALL_TEST_VERSION, 1, $xml_parser->getXMLValue(P_INSTALL_TEST_VERSION));
$xml_writer->addXmlObject(P_INSTALL_TEST_CHECKSUM, 1, $xml_parser->getXMLValue(P_INSTALL_TEST_CHECKSUM));
$xml_writer->addXmlObject(P_INSTALL_TEST_INSTALLTIME, 2, $xml_parser->getXMLValue(P_INSTALL_TEST_INSTALLTIME));
$xml_writer->addXmlObject(P_INSTALL_TEST_LASTRUNTIME, 2, date("Y-m-d H:i:s"));
- $xml_writer->addXmlObject(P_INSTALL_TEST_TIMESRUN, 2, $xml_parser->getXMLValue(P_INSTALL_TEST_TIMESRUN) + 1);
+ $xml_writer->addXmlObject(P_INSTALL_TEST_TIMESRUN, 2, ($xml_parser->getXMLValue(P_INSTALL_TEST_TIMESRUN) + 1));
+ $xml_writer->addXmlObject(P_INSTALL_TEST_AVG_RUNTIME, 2, $test_duration, 2);
file_put_contents(TEST_ENV_DIR . $identifier . "/pts-install.xml", $xml_writer->getXML());
return TRUE;