[gegl/gsoc2009-gpu] Automated tests that rely on GPU support should be skipped when it is disabled



commit 57fd7c88d70701f730496fe3c1c8e3f16e70e198
Author: Jerson Michael Perpetua <jersonperpetua gmail com>
Date:   Thu Aug 27 08:20:13 2009 +0800

    Automated tests that rely on GPU support should be skipped when it is disabled

 tests/test-gegl-buffer-gpu-scale-normal.c          |   10 +++++++++-
 tests/test-gegl-gpu-texture-clear-subrect.c        |    8 ++++++++
 tests/test-gegl-gpu-texture-clear.c                |    8 ++++++++
 tests/test-gegl-gpu-texture-copy-subrect.c         |    8 ++++++++
 tests/test-gegl-gpu-texture-copy.c                 |    8 ++++++++
 tests/test-gegl-gpu-texture-dup.c                  |    8 ++++++++
 tests/test-gegl-gpu-texture-set-subrect.c          |    8 ++++++++
 tests/test-gegl-gpu-texture-set.c                  |    8 ++++++++
 tests/test-gegl-tile-cow-consistency.c             |    8 ++++++++
 tests/test-gegl-tile-cow.c                         |    7 +++++--
 ...t-gegl-tile-lock-mode-gpu-write-then-gpu-read.c |    8 ++++++++
 .../test-gegl-tile-lock-mode-gpu-write-then-read.c |    8 ++++++++
 .../test-gegl-tile-lock-mode-write-then-gpu-read.c |    8 ++++++++
 tests/test-gegl-tile-lock-mode-write-then-read.c   |    8 ++++++++
 14 files changed, 110 insertions(+), 3 deletions(-)
---
diff --git a/tests/test-gegl-buffer-gpu-scale-normal.c b/tests/test-gegl-buffer-gpu-scale-normal.c
index b946be1..80ad08b 100644
--- a/tests/test-gegl-buffer-gpu-scale-normal.c
+++ b/tests/test-gegl-buffer-gpu-scale-normal.c
@@ -21,6 +21,7 @@
 
 #include "gegl.h"
 #include "gegl-utils.h"
+#include "gegl-gpu-init.h"
 #include "gegl-gpu-texture.h"
 #include "gegl-buffer.h"
 
@@ -141,6 +142,12 @@ main (gint    argc,
 
   gegl_init (&argc, &argv);
 
+  if (!gegl_gpu_is_accelerated ())
+    {
+      g_warning ("GPU-support is disabled. Skipping.\n");
+      goto skip;
+    }
+
   gpu_buffer = gegl_buffer_new (&buffer_extents, babl_format ("RGBA float"));
 
   for (iteration_cnt = 0; iteration_cnt < MAX_TEST_ITERATIONS; iteration_cnt++)
@@ -538,8 +545,9 @@ abort_test3:
     }
 
 abort:
-
   gegl_buffer_destroy (gpu_buffer);
+
+skip:
   gegl_exit ();
 
   return retval;
diff --git a/tests/test-gegl-gpu-texture-clear-subrect.c b/tests/test-gegl-gpu-texture-clear-subrect.c
index 9c0375a..46be74b 100644
--- a/tests/test-gegl-gpu-texture-clear-subrect.c
+++ b/tests/test-gegl-gpu-texture-clear-subrect.c
@@ -20,6 +20,7 @@
 
 #include "gegl.h"
 #include "gegl-utils.h"
+#include "gegl-gpu-init.h"
 #include "gegl-gpu-texture.h"
 
 #define SUCCESS 0
@@ -92,6 +93,12 @@ main (gint    argc,
 
   gegl_init (&argc, &argv);
 
+  if (!gegl_gpu_is_accelerated ())
+    {
+      g_warning ("GPU-support is disabled. Skipping.\n");
+      goto skip;
+    }
+
   texture = gegl_gpu_texture_new (TEXTURE_WIDTH,
                                   TEXTURE_HEIGHT,
                                   babl_format ("RGBA float"));
@@ -161,6 +168,7 @@ abort:
   g_free (components);
   gegl_gpu_texture_free (texture);
 
+skip:
   gegl_exit ();
 
   return retval;
diff --git a/tests/test-gegl-gpu-texture-clear.c b/tests/test-gegl-gpu-texture-clear.c
index c853187..c5f205d 100644
--- a/tests/test-gegl-gpu-texture-clear.c
+++ b/tests/test-gegl-gpu-texture-clear.c
@@ -20,6 +20,7 @@
 
 #include "gegl.h"
 #include "gegl-utils.h"
+#include "gegl-gpu-init.h"
 #include "gegl-gpu-texture.h"
 
 #define SUCCESS 0
@@ -39,6 +40,12 @@ main (gint    argc,
 
   gegl_init (&argc, &argv);
 
+  if (!gegl_gpu_is_accelerated ())
+    {
+      g_warning ("GPU-support is disabled. Skipping.\n");
+      goto skip;
+    }
+
   texture = gegl_gpu_texture_new (TEXTURE_WIDTH,
                                   TEXTURE_HEIGHT,
                                   babl_format ("RGBA float"));
@@ -89,6 +96,7 @@ abort:
   g_free (components);
   gegl_gpu_texture_free (texture);
 
+skip:
   gegl_exit ();
 
   return retval;
diff --git a/tests/test-gegl-gpu-texture-copy-subrect.c b/tests/test-gegl-gpu-texture-copy-subrect.c
index 3763807..e7dc504 100644
--- a/tests/test-gegl-gpu-texture-copy-subrect.c
+++ b/tests/test-gegl-gpu-texture-copy-subrect.c
@@ -21,6 +21,7 @@
 
 #include "gegl.h"
 #include "gegl-utils.h"
+#include "gegl-gpu-init.h"
 #include "gegl-gpu-texture.h"
 
 #define SUCCESS 0
@@ -98,6 +99,12 @@ main (gint    argc,
 
   gegl_init (&argc, &argv);
 
+  if (!gegl_gpu_is_accelerated ())
+    {
+      g_warning ("GPU-support is disabled. Skipping.\n");
+      goto skip;
+    }
+
   texture1 = gegl_gpu_texture_new (TEXTURE_WIDTH,
                                    TEXTURE_HEIGHT,
                                    babl_format ("RGBA float"));
@@ -180,6 +187,7 @@ abort:
   gegl_gpu_texture_free (texture2);
   gegl_gpu_texture_free (texture1);
 
+skip:
   gegl_exit ();
 
   return retval;
diff --git a/tests/test-gegl-gpu-texture-copy.c b/tests/test-gegl-gpu-texture-copy.c
index f1bf54d..5636c16 100644
--- a/tests/test-gegl-gpu-texture-copy.c
+++ b/tests/test-gegl-gpu-texture-copy.c
@@ -20,6 +20,7 @@
 
 #include "gegl.h"
 #include "gegl-utils.h"
+#include "gegl-gpu-init.h"
 #include "gegl-gpu-texture.h"
 
 #define SUCCESS 0
@@ -44,6 +45,12 @@ main (gint    argc,
 
   gegl_init (&argc, &argv);
 
+  if (!gegl_gpu_is_accelerated ())
+    {
+      g_warning ("GPU-support is disabled. Skipping.\n");
+      goto skip;
+    }
+
   texture1 = gegl_gpu_texture_new (TEXTURE_WIDTH,
                                    TEXTURE_HEIGHT,
                                    babl_format ("RGBA float"));
@@ -98,6 +105,7 @@ abort:
   gegl_gpu_texture_free (texture2);
   gegl_gpu_texture_free (texture1);
 
+skip:
   gegl_exit ();
 
   return retval;
diff --git a/tests/test-gegl-gpu-texture-dup.c b/tests/test-gegl-gpu-texture-dup.c
index 8bbf137..fde038c 100644
--- a/tests/test-gegl-gpu-texture-dup.c
+++ b/tests/test-gegl-gpu-texture-dup.c
@@ -20,6 +20,7 @@
 
 #include "gegl.h"
 #include "gegl-utils.h"
+#include "gegl-gpu-init.h"
 #include "gegl-gpu-texture.h"
 
 #define SUCCESS 0
@@ -44,6 +45,12 @@ main (gint    argc,
 
   gegl_init (&argc, &argv);
 
+  if (!gegl_gpu_is_accelerated ())
+    {
+      g_warning ("GPU-support is disabled. Skipping.\n");
+      goto skip;
+    }
+
   texture1 = gegl_gpu_texture_new (TEXTURE_WIDTH,
                                    TEXTURE_HEIGHT,
                                    babl_format ("RGBA float"));
@@ -91,6 +98,7 @@ abort:
   gegl_gpu_texture_free (texture2);
   gegl_gpu_texture_free (texture1);
 
+skip:
   gegl_exit ();
 
   return retval;
diff --git a/tests/test-gegl-gpu-texture-set-subrect.c b/tests/test-gegl-gpu-texture-set-subrect.c
index f93ba44..3bc22e4 100644
--- a/tests/test-gegl-gpu-texture-set-subrect.c
+++ b/tests/test-gegl-gpu-texture-set-subrect.c
@@ -21,6 +21,7 @@
 
 #include "gegl.h"
 #include "gegl-utils.h"
+#include "gegl-gpu-init.h"
 #include "gegl-gpu-texture.h"
 
 #define SUCCESS 0
@@ -97,6 +98,12 @@ main (gint    argc,
 
   gegl_init (&argc, &argv);
 
+  if (!gegl_gpu_is_accelerated ())
+    {
+      g_warning ("GPU-support is disabled. Skipping.\n");
+      goto skip;
+    }
+
   texture = gegl_gpu_texture_new (TEXTURE_WIDTH,
                                   TEXTURE_HEIGHT,
                                   babl_format ("RGBA float"));
@@ -166,6 +173,7 @@ abort:
 
   gegl_gpu_texture_free (texture);
 
+skip:
   gegl_exit ();
 
   return retval;
diff --git a/tests/test-gegl-gpu-texture-set.c b/tests/test-gegl-gpu-texture-set.c
index 36edefd..5c11046 100644
--- a/tests/test-gegl-gpu-texture-set.c
+++ b/tests/test-gegl-gpu-texture-set.c
@@ -21,6 +21,7 @@
 
 #include "gegl.h"
 #include "gegl-utils.h"
+#include "gegl-gpu-init.h"
 #include "gegl-gpu-texture.h"
 
 #define SUCCESS 0
@@ -44,6 +45,12 @@ main (gint    argc,
 
   gegl_init (&argc, &argv);
 
+  if (!gegl_gpu_is_accelerated ())
+    {
+      g_warning ("GPU-support is disabled. Skipping.\n");
+      goto skip;
+    }
+
   texture = gegl_gpu_texture_new (TEXTURE_WIDTH,
                                   TEXTURE_HEIGHT,
                                   babl_format ("RGBA float"));
@@ -90,6 +97,7 @@ abort:
 
   gegl_gpu_texture_free (texture);
 
+skip:
   gegl_exit ();
 
   return retval;
diff --git a/tests/test-gegl-tile-cow-consistency.c b/tests/test-gegl-tile-cow-consistency.c
index 3a0da67..f652a16 100644
--- a/tests/test-gegl-tile-cow-consistency.c
+++ b/tests/test-gegl-tile-cow-consistency.c
@@ -21,6 +21,7 @@
 
 #include "gegl.h"
 #include "gegl-utils.h"
+#include "gegl-gpu-init.h"
 #include "gegl-gpu-texture.h"
 
 #include "../../gegl/buffer/gegl-tile.h"
@@ -44,6 +45,12 @@ main (gint    argc,
 
   gegl_init (&argc, &argv);
 
+  if (!gegl_gpu_is_accelerated ())
+    {
+      g_warning ("GPU-support is disabled. Skipping.\n");
+      goto skip;
+    }
+
   tile = gegl_tile_new (TEXTURE_WIDTH,
                         TEXTURE_HEIGHT,
                         babl_format ("RGBA float"));
@@ -91,6 +98,7 @@ abort:
   g_object_unref (tile2);
   g_object_unref (tile);
 
+skip:
   gegl_exit ();
 
   return retval;
diff --git a/tests/test-gegl-tile-cow.c b/tests/test-gegl-tile-cow.c
index b419d7b..23df799 100644
--- a/tests/test-gegl-tile-cow.c
+++ b/tests/test-gegl-tile-cow.c
@@ -20,6 +20,7 @@
 #include <babl/babl.h>
 
 #include "gegl.h"
+#include "gegl-gpu-init.h"
 #include "gegl-gpu-texture.h"
 
 #include "../../gegl/buffer/gegl-tile.h"
@@ -56,7 +57,8 @@ main (gint    argc,
       goto abort;
     }
 
-  if (gegl_tile_get_gpu_data (tile) != gegl_tile_get_gpu_data (tile2))
+  if (   gegl_gpu_is_accelerated ()
+      && gegl_tile_get_gpu_data (tile) != gegl_tile_get_gpu_data (tile2))
     {
       g_printerr ("Test on tile GPU data equality after tile duplication "
                   "failed. Aborting\n");
@@ -77,7 +79,8 @@ main (gint    argc,
       goto abort;
     }
 
-  if (gegl_tile_get_gpu_data (tile) == gegl_tile_get_gpu_data (tile2))
+  if (   gegl_gpu_is_accelerated ()
+      && gegl_tile_get_gpu_data (tile) == gegl_tile_get_gpu_data (tile2))
     {
       g_printerr ("Test on tile GPU data inequality after uncloning failed. "
                   "Aborting\n");
diff --git a/tests/test-gegl-tile-lock-mode-gpu-write-then-gpu-read.c b/tests/test-gegl-tile-lock-mode-gpu-write-then-gpu-read.c
index 075776c..78b7dbe 100644
--- a/tests/test-gegl-tile-lock-mode-gpu-write-then-gpu-read.c
+++ b/tests/test-gegl-tile-lock-mode-gpu-write-then-gpu-read.c
@@ -21,6 +21,7 @@
 
 #include "gegl.h"
 #include "gegl-utils.h"
+#include "gegl-gpu-init.h"
 #include "gegl-gpu-texture.h"
 
 #include "../../gegl/buffer/gegl-tile.h"
@@ -44,6 +45,12 @@ main (gint    argc,
 
   gegl_init (&argc, &argv);
 
+  if (!gegl_gpu_is_accelerated ())
+    {
+      g_warning ("GPU-support is disabled. Skipping.\n");
+      goto skip;
+    }
+
   tile = gegl_tile_new (TEXTURE_WIDTH,
                         TEXTURE_HEIGHT,
                         babl_format ("RGBA float"));
@@ -108,6 +115,7 @@ main (gint    argc,
   g_free (components);
   g_object_unref (tile);
 
+skip:
   gegl_exit ();
 
   return retval;
diff --git a/tests/test-gegl-tile-lock-mode-gpu-write-then-read.c b/tests/test-gegl-tile-lock-mode-gpu-write-then-read.c
index 577f589..c3263a2 100644
--- a/tests/test-gegl-tile-lock-mode-gpu-write-then-read.c
+++ b/tests/test-gegl-tile-lock-mode-gpu-write-then-read.c
@@ -21,6 +21,7 @@
 
 #include "gegl.h"
 #include "gegl-utils.h"
+#include "gegl-gpu-init.h"
 #include "gegl-gpu-texture.h"
 
 #include "../../gegl/buffer/gegl-tile.h"
@@ -44,6 +45,12 @@ main (gint    argc,
 
   gegl_init (&argc, &argv);
 
+  if (!gegl_gpu_is_accelerated ())
+    {
+      g_warning ("GPU-support is disabled. Skipping.\n");
+      goto skip;
+    }
+
   tile = gegl_tile_new (TEXTURE_WIDTH,
                         TEXTURE_HEIGHT,
                         babl_format ("RGBA float"));
@@ -100,6 +107,7 @@ main (gint    argc,
   g_free (components);
   g_object_unref (tile);
 
+skip:
   gegl_exit ();
 
   return retval;
diff --git a/tests/test-gegl-tile-lock-mode-write-then-gpu-read.c b/tests/test-gegl-tile-lock-mode-write-then-gpu-read.c
index 3f21aed..a4d1dbf 100644
--- a/tests/test-gegl-tile-lock-mode-write-then-gpu-read.c
+++ b/tests/test-gegl-tile-lock-mode-write-then-gpu-read.c
@@ -21,6 +21,7 @@
 
 #include "gegl.h"
 #include "gegl-utils.h"
+#include "gegl-gpu-init.h"
 #include "gegl-gpu-texture.h"
 
 #include "../../gegl/buffer/gegl-tile.h"
@@ -44,6 +45,12 @@ main (gint    argc,
 
   gegl_init (&argc, &argv);
 
+  if (!gegl_gpu_is_accelerated ())
+    {
+      g_warning ("GPU-support is disabled. Skipping.\n");
+      goto skip;
+    }
+
   tile = gegl_tile_new (TEXTURE_WIDTH,
                         TEXTURE_HEIGHT,
                         babl_format ("RGBA float"));
@@ -108,6 +115,7 @@ main (gint    argc,
   g_free (components);
   g_object_unref (tile);
 
+skip:
   gegl_exit ();
 
   return retval;
diff --git a/tests/test-gegl-tile-lock-mode-write-then-read.c b/tests/test-gegl-tile-lock-mode-write-then-read.c
index 4879ef2..a5709ec 100644
--- a/tests/test-gegl-tile-lock-mode-write-then-read.c
+++ b/tests/test-gegl-tile-lock-mode-write-then-read.c
@@ -21,6 +21,7 @@
 
 #include "gegl.h"
 #include "gegl-utils.h"
+#include "gegl-gpu-init.h"
 #include "gegl-gpu-texture.h"
 
 #include "../../gegl/buffer/gegl-tile.h"
@@ -44,6 +45,12 @@ main (gint    argc,
 
   gegl_init (&argc, &argv);
 
+  if (!gegl_gpu_is_accelerated ())
+    {
+      g_warning ("GPU-support is disabled. Skipping.\n");
+      goto skip;
+    }
+
   tile = gegl_tile_new (TEXTURE_WIDTH,
                         TEXTURE_HEIGHT,
                         babl_format ("RGBA float"));
@@ -102,6 +109,7 @@ main (gint    argc,
   g_free (components);
   g_object_unref (tile);
 
+skip:
   gegl_exit ();
 
   return retval;



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