gallium: run gallium tests if GALLIUM_TESTS=1 is set
authorMarek Olšák <marek.olsak@amd.com>
Sun, 1 Feb 2015 11:59:27 +0000 (12:59 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Fri, 6 Feb 2015 21:27:06 +0000 (22:27 +0100)
Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
src/gallium/auxiliary/target-helpers/inline_debug_helper.h
src/gallium/auxiliary/util/u_tests.c
src/gallium/auxiliary/util/u_tests.h

index 6fe667d3fbd9f2a4fe51c1f3f4908bb1b2137585..faae1800e7211babfcc12721903190293e42354f 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "pipe/p_compiler.h"
 #include "util/u_debug.h"
+#include "util/u_tests.h"
 
 
 /* Helper function to wrap a screen with
@@ -49,6 +50,9 @@ debug_screen_wrap(struct pipe_screen *screen)
    screen = noop_screen_create(screen);
 #endif
 
+   if (debug_get_bool_option("GALLIUM_TESTS", FALSE))
+      util_run_tests(screen);
+
    return screen;
 }
 
index b42f5e137ba8ec457529a527f8e065f437a3cdc4..764c4c319444747d9bb33ea02a1944556ba36701 100644 (file)
@@ -261,7 +261,14 @@ tgsi_vs_window_space_position(struct pipe_context *ctx)
  * context_create.
  */
 void
-util_run_tests(struct pipe_context *ctx)
+util_run_tests(struct pipe_screen *screen)
 {
+   struct pipe_context *ctx = screen->context_create(screen, NULL);
+
    tgsi_vs_window_space_position(ctx);
+
+   ctx->destroy(ctx);
+
+   puts("Done. Exiting..");
+   exit(0);
 }
index a1439347d271fbfe9fa037c5cff432f3b62d7aa0..49ae54f876bc91d76fbe799b5a9400cb9a02203f 100644 (file)
@@ -30,8 +30,8 @@
 
 #include "pipe/p_compiler.h"
 
-struct pipe_context;
+struct pipe_screen;
 
-void util_run_tests(struct pipe_context *ctx);
+void util_run_tests(struct pipe_screen *screen);
 
 #endif