summaryrefslogtreecommitdiffstats
path: root/pts-core/functions/pts-functions_tests.php
diff options
context:
space:
mode:
authorMichael Larabel <michael@phx-laptop.(none)>2008-11-12 14:06:06 -0500
committerMichael Larabel <michael@phx-laptop.(none)>2008-11-13 10:34:51 -0500
commit3f51156bb15da98e5a9907af9993683af5da4e6c (patch)
tree2998df3502763c319a8c8ea7c934c34c61706030 /pts-core/functions/pts-functions_tests.php
parent1cdd034748ec7a98f88acaa9c90f07c11a2a96e0 (diff)
downloadphoronix-test-suite-upstream-3f51156bb15da98e5a9907af9993683af5da4e6c.tar.gz
phoronix-test-suite-upstream-3f51156bb15da98e5a9907af9993683af5da4e6c.tar.xz
phoronix-test-suite-upstream-3f51156bb15da98e5a9907af9993683af5da4e6c.zip
pts-core: Drop pts-functions-extras.php and move those functions to
other files
Diffstat (limited to 'pts-core/functions/pts-functions_tests.php')
-rw-r--r--pts-core/functions/pts-functions_tests.php85
1 files changed, 85 insertions, 0 deletions
diff --git a/pts-core/functions/pts-functions_tests.php b/pts-core/functions/pts-functions_tests.php
index 9627026..52a3b93 100644
--- a/pts-core/functions/pts-functions_tests.php
+++ b/pts-core/functions/pts-functions_tests.php
@@ -767,5 +767,90 @@ function pts_objects_test_downloads($test_identifier)
return $obj_r;
}
+function pts_remove_saved_result($identifier)
+{
+ // Remove a saved result file
+ $return_value = false;
+
+ if(is_file(SAVE_RESULTS_DIR . $identifier . "/composite.xml"))
+ {
+ @unlink(SAVE_RESULTS_DIR . $identifier . "/composite.xml");
+
+ foreach(glob(SAVE_RESULTS_DIR . $identifier . "/result-graphs/*.png") as $remove_file)
+ {
+ @unlink($remove_file);
+ }
+ foreach(glob(SAVE_RESULTS_DIR . $identifier . "/result-graphs/*.svg") as $remove_file)
+ {
+ @unlink($remove_file);
+ }
+
+ foreach(glob(SAVE_RESULTS_DIR . $identifier . "/test-*.xml") as $remove_file)
+ {
+ @unlink($remove_file);
+ }
+
+ @unlink(SAVE_RESULTS_DIR . $identifier . "/pts-results-viewer.xsl");
+ @rmdir(SAVE_RESULTS_DIR . $identifier . "/result-graphs/");
+ @rmdir(SAVE_RESULTS_DIR . $identifier);
+ echo "Removed: $identifier\n";
+ $return_value = true;
+ }
+ return $return_value;
+}
+function pts_print_format_tests($object, &$write_buffer, $steps = -1)
+{
+ // Print out a text tree that shows the suites and tests within an object
+ $steps++;
+ if(is_suite($object))
+ {
+ $xml_parser = new tandem_XmlReader(@file_get_contents(pts_location_suite($object)));
+ $tests_in_suite = array_unique($xml_parser->getXMLArrayValues(P_SUITE_TEST_NAME));
+
+ if($steps > 0)
+ {
+ asort($tests_in_suite);
+ }
+
+ if($steps == 0)
+ {
+ $write_buffer .= $object . "\n";
+ }
+ else
+ {
+ $write_buffer .= str_repeat(" ", $steps) . "+ " . $object . "\n";
+ }
+
+ foreach($tests_in_suite as $test)
+ {
+ $write_buffer .= pts_print_format_tests($test, $write_buffer, $steps);
+ }
+ }
+ else
+ {
+ $write_buffer .= str_repeat(" ", $steps) . "* " . $object . "\n";
+ }
+}
+function pts_dependency_name($dependency)
+{
+ // Find the name of a dependency
+ $return_title = "";
+ if(is_file(XML_DISTRO_DIR . "generic-packages.xml"))
+ {
+ $xml_parser = new tandem_XmlReader(XML_DISTRO_DIR . "generic-packages.xml");
+ $package_name = $xml_parser->getXMLArrayValues(P_EXDEP_PACKAGE_GENERIC);
+ $title = $xml_parser->getXMLArrayValues(P_EXDEP_PACKAGE_TITLE);
+
+ for($i = 0; $i < count($title) && empty($return_title); $i++)
+ {
+ if($dependency == $package_name[$i])
+ {
+ $return_title = $title[$i];
+ }
+ }
+ }
+
+ return $return_title;
+}
?>