]> mj.ucw.cz Git - libucw.git/blobdiff - images/image-test.c
Opt: Documented opt and its interaction with conf
[libucw.git] / images / image-test.c
index 0a22d47907abcf648d605316943e9a0e461e098d..aeae9dd2380f9f43cde72ffd792282ff7cb102cb 100644 (file)
@@ -9,12 +9,12 @@
 
 #undef LOCAL_DEBUG
 
 
 #undef LOCAL_DEBUG
 
-#include "lib/lib.h"
-#include "lib/mempool.h"
-#include "lib/fastbuf.h"
-#include "lib/threads.h"
-#include "images/images.h"
-#include "images/color.h"
+#include <ucw/lib.h>
+#include <ucw/mempool.h>
+#include <ucw/fastbuf.h>
+#include <ucw/threads.h>
+#include <images/images.h>
+#include <images/color.h>
 
 #include <stdlib.h>
 #include <string.h>
 
 #include <stdlib.h>
 #include <string.h>
@@ -64,7 +64,7 @@ test_image_iface(void)
   ASSERT(i1->pixel_size == 4);
   ASSERT(IMAGE_SSE_ALIGN_SIZE >= 16);
   ASSERT(!(i1->row_size & (IMAGE_SSE_ALIGN_SIZE - 1)));
   ASSERT(i1->pixel_size == 4);
   ASSERT(IMAGE_SSE_ALIGN_SIZE >= 16);
   ASSERT(!(i1->row_size & (IMAGE_SSE_ALIGN_SIZE - 1)));
-  ASSERT(!((addr_int_t)i1->pixels & (IMAGE_SSE_ALIGN_SIZE - 1)));
+  ASSERT(!((uintptr_t)i1->pixels & (IMAGE_SSE_ALIGN_SIZE - 1)));
   image_destroy(i1);
 
   i1 = image_new(&ctx, 283, 329, COLOR_SPACE_RGB, NULL);
   image_destroy(i1);
 
   i1 = image_new(&ctx, 283, 329, COLOR_SPACE_RGB, NULL);
@@ -93,6 +93,8 @@ test_image_iface(void)
   mp_delete(pool);
 }
 
   mp_delete(pool);
 }
 
+#ifdef CONFIG_UCW_THREADS
+
 #define TEST_THREADS_COUNT 4
 
 static void *
 #define TEST_THREADS_COUNT 4
 
 static void *
@@ -187,13 +189,16 @@ test_threads_thread(void *param UNUSED)
   return NULL;
 }
 
   return NULL;
 }
 
+#endif
+
 static void
 test_threads(void)
 {
 static void
 test_threads(void)
 {
+#ifdef CONFIG_UCW_THREADS
   pthread_t threads[TEST_THREADS_COUNT - 1];
   pthread_attr_t attr;
   if (pthread_attr_init(&attr) < 0 ||
   pthread_t threads[TEST_THREADS_COUNT - 1];
   pthread_attr_t attr;
   if (pthread_attr_init(&attr) < 0 ||
-      pthread_attr_setstacksize(&attr, default_thread_stack_size) < 0)
+      pthread_attr_setstacksize(&attr, ucwlib_thread_stack_size) < 0)
     ASSERT(0);
   for (uns i = 0; i < TEST_THREADS_COUNT - 1; i++)
     {
     ASSERT(0);
   for (uns i = 0; i < TEST_THREADS_COUNT - 1; i++)
     {
@@ -204,6 +209,9 @@ test_threads(void)
   for (uns i = 0; i < TEST_THREADS_COUNT - 1; i++)
     if (pthread_join(threads[i], NULL) < 0)
       die("Cannot join thread: %m");
   for (uns i = 0; i < TEST_THREADS_COUNT - 1; i++)
     if (pthread_join(threads[i], NULL) < 0)
       die("Cannot join thread: %m");
+#else
+  msg(L_WARN, "Disabled CONFIG_UCW_THREADS, threaded tests skipped");
+#endif
 }
 
 int
 }
 
 int