tasn pushed a commit to branch master.

commit 11cc575120b163b5ad9f4b17efbb6eda982d262f
Author: Tom Hacohen <[email protected]>
Date:   Wed May 15 16:48:04 2013 +0100

    Added html output for easier viewing of the errors.
---
 src/bin/exactness.c | 57 +++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 42 insertions(+), 15 deletions(-)

diff --git a/src/bin/exactness.c b/src/bin/exactness.c
index 15b1e15..9af42df 100644
--- a/src/bin/exactness.c
+++ b/src/bin/exactness.c
@@ -168,27 +168,54 @@ main(int argc, char *argv[])
          exactness_ctx.tests_executed,
          eina_inlist_count(EINA_INLIST_GET(test_list)));
 
-   if (exactness_ctx.errors)
+   if (exactness_ctx.errors || exactness_ctx.compare_errors)
      {
-        Eina_List *itr;
-        List_Entry *ent;
-        printf("List of tests that failed execution:\n");
-        EINA_LIST_FOREACH(exactness_ctx.errors, itr, ent)
+        FILE *report_file;
+        char report_filename[EXACTNESS_PATH_MAX] = "";
+        /* Generate the filename. */
+        snprintf(report_filename, EXACTNESS_PATH_MAX,
+              "%s/%s/errors.html",
+              exactness_config.dest_dir, CURRENT_SUBDIR);
+        report_file = fopen(report_filename, "w+");
+        printf("%s %p\n", report_filename, report_file);
+        fprintf(report_file,
+              "<html><head><title>Exactness report</title></head><body>");
+
+        if (exactness_ctx.errors)
           {
-             printf("\t* %s\n", ent->name);
+             fprintf(report_file,
+                   "<h1>Tests that failed execution:</h1><br/><ul>");
+             Eina_List *itr;
+             List_Entry *ent;
+             printf("List of tests that failed execution:\n");
+             EINA_LIST_FOREACH(exactness_ctx.errors, itr, ent)
+               {
+                  printf("\t* %s\n", ent->name);
+
+                  fprintf(report_file, "<li>%s</li>", ent->name);
+               }
+             fprintf(report_file, "</ul>");
           }
-        ret = 1;
-     }
 
-   if (exactness_ctx.compare_errors)
-     {
-        char *test_name;
-        printf("List of images that failed comparison:\n");
-        EINA_LIST_FREE(exactness_ctx.compare_errors, test_name)
+        if (exactness_ctx.compare_errors)
           {
-             printf("\t* %s\n", test_name);
-             free(test_name);
+             fprintf(report_file,
+                   "<h1>Images that failed comparison: (Original, Current, 
Diff)</h1><br/><ul>");
+             char *test_name;
+             printf("List of images that failed comparison:\n");
+             EINA_LIST_FREE(exactness_ctx.compare_errors, test_name)
+               {
+                  printf("\t* %s\n", test_name);
+
+                  fprintf(report_file, "<li><h2>%s</h2> <img src='../orig/%s' 
/> <img src='%s' /> <img src='comp_%s' /></li>", test_name, test_name, 
test_name, test_name);
+                  free(test_name);
+               }
+             fprintf(report_file, "</ul>");
           }
+        fprintf(report_file,
+              "</body></html>");
+
+        printf("Report html: %s\n", report_filename);
         ret = 1;
      }
 

-- 

------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d

Reply via email to