[gegl] gegl-tester: add support for alternative hashes



commit 1cbb1e55ce4b12bc10711cf571160bc0e3c95597
Author: Øyvind Kolås <pippin gimp org>
Date:   Sun Mar 12 13:12:45 2017 +0100

    gegl-tester: add support for alternative hashes
    
    OpenCL and/or different machines produce slightly different hashes, the regular
    regression testing suite uses reference images and a fuzzy comparison that
    permits tiny differences to pass, this commit adds support for two more
    alternative hashes, we should strive to not need using them. When used we
    should add a comment about the differences/architectures/code paths causing the
    need for multiple semi-valid hashes of the output.

 operations/common/image-compare.c |    3 ++-
 tools/gegl-tester.c               |   12 +++++++++---
 2 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/operations/common/image-compare.c b/operations/common/image-compare.c
index c0482ea..4a4e73c 100644
--- a/operations/common/image-compare.c
+++ b/operations/common/image-compare.c
@@ -113,7 +113,8 @@ process (GeglOperation       *operation,
         {
           gdouble diff = sqrt (SQR (data_in1[0] - data_in2[0]) +
                                SQR (data_in1[1] - data_in2[1]) +
-                               SQR (data_in1[2] - data_in2[2]));
+                               SQR (data_in1[2] - data_in2[2]) +
+                               SQR (data_in1[3] - data_in2[3]));
 
           gdouble alpha_diff = fabs (data_in1[3] - data_in2[3]) * 100.0;
 
diff --git a/tools/gegl-tester.c b/tools/gegl-tester.c
index 79b2405..41405d7 100644
--- a/tools/gegl-tester.c
+++ b/tools/gegl-tester.c
@@ -76,7 +76,7 @@ operation_to_path (const gchar *op_name,
 }
 
 static void
-standard_output (const gchar *op_name, const gchar *ref_hash)
+standard_output (const gchar *op_name)
 {
   GeglNode *composition, *input, *aux, *operation, *crop, *output, *translate;
   GeglNode *background,  *over;
@@ -184,11 +184,13 @@ process_operations (GType type)
   for (i = 0; i < count; i++)
     {
       GeglOperationClass *operation_class;
-      const gchar        *xml, *name, *hash;
+      const gchar        *xml, *name, *hash, *hashB, *hashC;
       gboolean            matches;
 
       operation_class = g_type_class_ref (operations[i]);
       hash            = gegl_operation_class_get_key (operation_class, "reference-hash");
+      hashB           = gegl_operation_class_get_key (operation_class, "reference-hashB");
+      hashC           = gegl_operation_class_get_key (operation_class, "reference-hashC");
       xml             = gegl_operation_class_get_key (operation_class, "reference-composition");
       name            = gegl_operation_class_get_key (operation_class, "name");
 
@@ -236,7 +238,7 @@ process_operations (GType type)
                  g_type_is_a (operations[i], GEGL_TYPE_OPERATION_TEMPORAL)))
         {
           g_printf ("%s ", name);
-          standard_output (name, hash);
+          standard_output (name);
         }
 
       if (matches && hash)
@@ -245,6 +247,10 @@ process_operations (GType type)
         gchar *gothash = compute_hash_for_path (output_path);
         if (g_str_equal (hash, gothash))
           g_printf (" OK\n");
+        else if (hashB && g_str_equal (hashB, gothash))
+          g_printf (" OK (hash b)\n");
+        else if (hashC && g_str_equal (hashC, gothash))
+          g_printf (" OK (hash c)\n");
         else
         {
           g_printf (" FAIL %s != %s\n", hash, gothash);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]