summaryrefslogtreecommitdiffstats
path: root/pts-core/functions/pts-functions_tests.php
diff options
context:
space:
mode:
authorMichael Larabel <michael@phx-laptop.(none)>2008-11-13 12:06:25 -0500
committerMichael Larabel <michael@phx-laptop.(none)>2008-11-13 12:06:25 -0500
commit60ca7cf2001baa4fc37d54a867751e72571e4079 (patch)
treeb956c628c54b670bba632c6a82e5ff7af1cd2c6e /pts-core/functions/pts-functions_tests.php
parent1f67addf9f2fbf555ba071f2e357e8c7a12e6fb6 (diff)
downloadphoronix-test-suite-upstream-60ca7cf2001baa4fc37d54a867751e72571e4079.tar.gz
phoronix-test-suite-upstream-60ca7cf2001baa4fc37d54a867751e72571e4079.tar.xz
phoronix-test-suite-upstream-60ca7cf2001baa4fc37d54a867751e72571e4079.zip
pts-core: Unify the XSL for the PTS Results Viewer and use a PHP
function to insert the respective PNG/SVG markup when saving the results
Diffstat (limited to 'pts-core/functions/pts-functions_tests.php')
-rw-r--r--pts-core/functions/pts-functions_tests.php20
1 files changed, 18 insertions, 2 deletions
diff --git a/pts-core/functions/pts-functions_tests.php b/pts-core/functions/pts-functions_tests.php
index 52a3b93..dcb9a7a 100644
--- a/pts-core/functions/pts-functions_tests.php
+++ b/pts-core/functions/pts-functions_tests.php
@@ -46,7 +46,6 @@ function pts_save_result($save_to = null, $save_results = null)
}
pts_copy(RESULTS_VIEWER_DIR . "pts.js", SAVE_RESULTS_DIR . "pts-results-viewer/pts.js");
- pts_copy(RESULTS_VIEWER_DIR . "pts-results-viewer.xsl", SAVE_RESULTS_DIR . "pts-results-viewer/pts-results-viewer.xsl");
pts_copy(RESULTS_VIEWER_DIR . "pts-viewer.css", SAVE_RESULTS_DIR . "pts-results-viewer/pts-viewer.css");
pts_copy(RESULTS_VIEWER_DIR . "pts-logo.png", SAVE_RESULTS_DIR . "pts-results-viewer/pts-logo.png");
@@ -115,6 +114,7 @@ function pts_save_result($save_to = null, $save_results = null)
// Render to PNG
$t->setRenderer("PNG");
pts_copy(RESULTS_VIEWER_DIR . "pts-results-viewer.xsl", $save_to_dir . "/pts-results-viewer.xsl");
+ file_put_contents($save_to_dir . "/pts-results-viewer.xsl", pts_get_results_viewer_xsl_formatted("PNG"));
}
else
{
@@ -126,7 +126,7 @@ function pts_save_result($save_to = null, $save_results = null)
// Render to SVG
$t->setRenderer("SVG");
- pts_copy(RESULTS_VIEWER_DIR . "pts-svg-results-viewer.xsl", $save_to_dir . "/pts-results-viewer.xsl");
+ file_put_contents($save_to_dir . "/pts-results-viewer.xsl", pts_get_results_viewer_xsl_formatted("SVG"));
}
$t->loadGraphIdentifiers($results_identifiers[$i]);
@@ -210,6 +210,22 @@ function pts_save_result($save_to = null, $save_results = null)
return $bool;
}
+function pts_get_results_viewer_xsl_formatted($format_type = "PNG")
+{
+ $raw_xsl = file_get_contents(RESULTS_VIEWER_DIR . "pts-results-viewer.xsl");
+
+ if($format_type == "SVG")
+ {
+ $graph_string = "<object type=\"image/svg+xml\"><xsl:attribute name=\"data\">result-graphs/<xsl:number value=\"position()\" />.svg</xsl:attribute></object>";
+ }
+ else
+ {
+ // Default to PNG
+ $graph_string = "<img><xsl:attribute name=\"src\">result-graphs/<xsl:number value=\"position()\" />.png</xsl:attribute></img>";
+ }
+
+ return str_replace("<!-- GRAPH TAGS -->", $graph_string, $raw_xsl);
+}
function pts_global_upload_result($result_file, $tags = "")
{
// Upload a test result to the Phoronix Global database