MantisBT - CDash
View Issue Details
0011939CDash(No Category)public2011-03-08 10:262012-01-18 02:32
vipwolf 
Julien Jomier 
normalmajoralways
resolvedfixed 
LinuxGentoo2010
1.8 
2.0 
0011939: CDASH cannot display Attached Files
I tried the new ATTACHED_FILES command introduced in cmake 2.8 with the following command:

set_tests_properties(${TEST} PROPERTIES ATTACHED_FILES "somelogfile.log")

This results in the Test.xml file to contain a line with the following code
<NamedMeasurement name="Attached File" encoding="base64" compression="tar/gzip" filename="network_test1.log" type="file">
<Value> H4sIAAAAAAAAA+2XW2/aSBTH87yfYh57kczcbSP1wcZ2hZRkq2Sz+4gcewhWjIf60rSr/fB7BmhjkyE0Je1qpRweLGT0O/8512G00Es1arJFqYrqb1WPmjob3c2b0XVXlPmoVU07qlR7p+vbmflCnFLfnDzNCMYuxugEMUkYgSeiRDLzXJtwiUSECCY4k5xzeE1dJtEJfqKfH7KuadP6BOP7ENh/lzZN8Sv0/GIjYky9MSWO70tKGKQjisOr9+jVWTA93+TnnxtV3ahWr9pZqdMc7d

I guess this is a tar/gziped version of my logfile and the whole tar/gzip is Base64 encoded. So far so good.

On the CDASH site however the gzipped file is not decoded so all I get is a meaningless Base64 encoded string of my logfile instead of the logfile itself. I guess the decompression routine needs to run over the Attached files and either create the file somewhere for download or in case of txt files display them.
1. Add set_tests_properties(${TEST} PROPERTIES ATTACHED_FILES "somelogfile.log") to CMakeFiles.txt
2. run ctest -T submit
3. Check output on website
I tried turning of the compression of the server but got no meaningfull output as all old tests are compressed.
No tags attached.
Issue History
2011-03-08 10:26vipwolfNew Issue
2011-03-09 05:24vipwolfNote Added: 0025700
2012-01-17 12:30Julien JomierAssigned To => Julien Jomier
2012-01-17 12:30Julien JomierStatusnew => assigned
2012-01-18 02:32Julien JomierNote Added: 0028346
2012-01-18 02:32Julien JomierStatusassigned => resolved
2012-01-18 02:32Julien JomierFixed in Version => 2.0
2012-01-18 02:32Julien JomierResolutionopen => fixed

Notes
(0025700)
vipwolf   
2011-03-09 05:24   
I made a quick hack to extract the files to a local directory and link to the extracted files instead of showing the base64 encoded content. The "patch" relies on the Archive class from the pear project:

--- testDetails.php 2010-12-13 10:32:32.000000000 +0100
+++ testDetails.php 2011-03-09 11:20:04.000000000 +0100
@@ -26,6 +26,7 @@
 include('login.php');
 include_once("cdash/common.php");
 include('cdash/version.php');
+require_once('Archive/Tar.php');
 
 $testid = $_GET["test"];
 // Checks
@@ -240,7 +241,7 @@
 
 //get any measurements associated with this test
 $xml .= "<measurements>";
-$query = "SELECT name,type,value FROM testmeasurement WHERE testid = '$testid' ORDER BY id";
+$query = "SELECT id,name,type,value FROM testmeasurement WHERE testid = '$testid' ORDER BY id";
 $result = pdo_query($query);
 while($row = pdo_fetch_array($result))
   {
@@ -263,6 +264,30 @@
     {
     $value = nl2br($value);
     }
+ if($row["type"] == "file" )
+ {
+ $outdir="./files/$testid";
+ $tarfile = $outdir.'/'.$row["id"].'.tar.gz';
+ if($outdir!=""&&!file_exists($outdir))
+ {
+ mkdir($outdir,0777);
+ }
+ if($tarfile!=""&&!file_exists($tarfile))
+ {
+ $thandle = fopen($tarfile, "w");
+ fwrite($thandle,base64_decode($value));
+ fclose($thandle);
+ }
+ $tar = new Archive_Tar($tarfile, true);
+ $content =$tar->listContent();
+ $file =basename($content[0]["filename"]);
+ if(!file_exists("$outdir/$file"))
+ {
+ $dir = dirname($content[0]["filename"]);
+ $tar->extractList($content[0]["filename"],$outdir,$dir);
+ }
+ $value = "<a href=$outdir/$file>$file</a>";
+ }
     
   $xml .= add_XML_value("value", $value);
   $xml .= "</measurement>";
(0028346)
Julien Jomier   
2012-01-18 02:32   
Files can now be downloaded as .tgz from the tests page. Thanks for the report.