TL;DR: 2 issues and 1 question for uploading files to CDash:
- Images uploaded via
ATTACHED_FILES
are not shown directly but are presented as .tgz - Images uploaded via
CTestMeasurement...
are truncated to 64kb in a default database setup (MariaDB 10.6). - Why are there two different locations for storing uploaded images/files?
More Details:
I experimented with uploading images from tests with ctest, and found it nice that this already exists and is quite well supported! I did have minor issues though:
-
As reported in this discussion, images uploaded via the ATTACHED_FILES mechanism end up as .tgz files instead of being directly shown. It would be nice if CDash directly would display such image files (same as for files uploaded via the
CTestMeasurement
mechanism, see below). The tarball adds unnecessary additional steps for each check (in addition to opening the specific test, one needs to download, extract gz, etxtract tar, and open the image). -
A workaround is to use the
<CTestMeasurement ...
test output as described here in the CTest documentation under Attached Files / Additional Test Measurements. Images uploaded withtype="image/png"
(or jpg/…) are shown directly in the test results - exactly what I want.
This is however a bit more complex for some cases than simply setting theATTACHED_FILES
property. We do kind of integration tests, and so our tests directly run a (shipped) command line tool where we do not want to include logic for creating the<CTestMeasurement...
XML output. So we would need to wrap the call to this tool into a custom script that runs the actual test, and afterwards outputs that required xml snippet.
When I tested the<CTestMeasurement ...
approach, I found that the uploaded image was truncated (CDash 3.4.0, database not completely newly created but probably not older than from 3.3.0). After some digging I found out that in the database in theimage
table, only the first 64KB were stored due to theimg
column being of typeBLOB
which can only story 64kb in mysql/mariadb. Is this intentional? While I agree that some restriction on the file sizes of uploaded test files does make sense, I did not see any mention of the 64kb limit in the documentation. After changing the column type toMEDIUMBLOB
, everything worked as expected. Looking at the database setup script for the image table, this column uses the ‘binary’ type from Illuminate; the Illuminate documentation on binary says this maps to BLOB but does not explicitly mention whether there is a way to specify a “larger” blob type like mediumblob or longblob there - possibly by adding a size parameter to thebinary
call? -
What I also found out is that files uploaded via
ATTACHED_FILES
are stored completely differently (these go into thetestmeasurement
table) than images uploaded via theCTestMeasurement
mechanism (these go into theimages
table). Thevalue
column in thetestmeasurement
table uses amediumtext
(extended by this change, so it isn’t affected by the 64kb restrictions, though it uses a little more memory due to it being I think base64 encoded).
I find it confusing that images uploaded via the CTestMeasurement do not go intotestmeasurement
; why are there even two storage locations for the same kind of data?